import;file="H:\Courses-Stern\Econometrics\Problems\DataFiles\healthcare.csv"$ sample;all$ create;agesq=age*age$ namelist ; x = one,age,agesq,educ,married,female,hhkids $ regress ; lhs=hhninc;rhs=x ; res = e $ Pooled regression and keep residuals regress ; for[public=0,1] ; lhs=hhninc;rhs=x $ Separate regressions create ; esq = e*e ; logesq = log(esq) $ Logs of squared residuals regress ; lhs = logesq ; rhs = one,public $ Looking for groupwise heteroscedasticity ? A little experiment to show the heteroscedasticity effect. draw ; n=5000$ plot;lhs=public ; rhs = e ; endpoints=-1,2$ ? Analysis of variance to see if the standard deviations are different. sample;all$ dstat;rhs=e ; str=public $ ? ?Weighted least squares regress ; lhs = logesq;rhs=one,public$ calc ; gma =b(2) $ create ; vare = exp(b(2)*public) ; wt = 1/vare $ regress ; lhs = hhninc;rhs=x $ regress ; lhs = hhninc;rhs=x;wts=wt $ regress ; lhs = hhninc;rhs=x;het$ regress ; lhs = hhninc;rhs=x ; res = e $ create ; esq = e*e $ matrix ; white = * x'[esq]x * ; Stat(b,white,x) $ ? Internal procedure regress ; lhs = hhninc ; rhs = x ; Het $ regress ; lhs = hhninc ; rhs = x ; wts = wt $ matrix ; bt = b(5:7) ; vt = varb(5:7,5:7) $ matrix ; list ; wald = bt'bt $ ? (Using built in procedure) regress ; lhs = hhninc ; rhs = x ; wts = wt ;test: married=0, female=0, hhkids=0$$ import;file="H:\Courses-Stern\Econometrics\Problems\DataFiles\cornwell-rupert.csv"$ namelist ; x = one,fem,ed,occ,ind,exp,blk,union $ namelist ; z = one,fem,ed,occ,ind, blk,union,wks,south,smsa $ regr;lhs=lwage;rhs=x$ 2sls;lhs=lwage;rhs=x;inst=z$ regress ; lhs = exp ; rhs = z ; res = ze $ regr;lhs=lwage;rhs=x,ze$ create ; i=trn(7,0)$ setpanel ; group=i;pds=ni$ ? Simple least squares regress ; lhs = lwage ; rhs = x$ ? Least squares with correction for panel effects. regress ; lhs = lwage ; rhs = x; cluster=7 $ ? Fixed effects estimator with 3 time invariant variables. regress ; lhs = lwage ; rhs = x;panel ; fixed $ ? Fixed effects estimator regress ; lhs = lwage ; rhs = one,occ,ind,exp,union;panel ; fixed $ ? Random effects estimator regress ; lhs = lwage ; rhs = one,occ,ind,exp,union;panel ; random $ ? Compute FEM and REM and find evidence in favor of one or the other. regress ; lhs = lwage ; rhs = one,occ,ind,exp,union;panel $