I wonder if anyone knows about an application or user written program that can be used to estimate standard errors for OLS regression, but using alternative source of errors.
Perhaps the question could be better explained with an example.
Code:
** Say that I have the full sample sysuse auto, clear gen c=1 ** and i can estimate the full data model reg price mpg weight ** as well as its residuals predict res, res ** For some reason, however, i can only estimate the regression for a subsample set seed gen rsm=runiform()<.8 ** which i use to estimate the same model reg price mpg weight if rsm==1 ** I can easily obtain the standard errors from this model using the following code mata: y=st_data(.,"price","rsm") x=st_data(.,"mpg weight c","rsm") rr=st_data(.,"res","rsm") b=invsym(cross(x,x))*cross(x,y) diagonal(sum((y-x*b):^2)/(58-3)*invsym(cross(x,x))):^.5 /// What I wonder, however, if there is a way i can tell Stata I want to use the "population" /// residuals rr, rather than sample residuals to estimate standard errors. Something like this: diagonal(sum((rr):^2)/(58-3)*invsym(cross(x,x))):^.5 end
Fernando
0 Response to Robust standard errors with alternative application
Post a Comment