If you click on WINRATS and then open you should find a range of programs, LOAD PANEL.PRG and then run it. I want the more difficult bits explained (click on ‘hlp’ and figure out what is going on). Also after:
dec vect[series] idummies(10)
do i=1,10
set idummies(i) = %indiv(t)==i
end do i
Type
Print(dates) / idummies
What do you get?
Having done this email me both the results and the explanation by next Thursday. I will then email further feebdback back to you by the Friday. Finally any thoughts on how you might do the Hausmann test in panel data? Next week we will be looking at Hausmann.prg, program – also attached. It is connected with 3SLS.
*
* PANEL.PRG
* Manual example 14.2
*
cal(panelobs=20) 1935
all 10//1954:1
open data grunfeld.dat
data(format=prn,org=cols)
*
* Do fixed and random effect. The intercept is dropped
* from the fixed effects regression since it will be
* wiped out as a time-invariant variable
*
preg(method=fixed) invest
# firmvalue cstock
preg(method=random) invest
# constant firmvalue cstock
*
* Do fixed effects as least squares with dummy variables
*
dec vect[series] idummies(10)
do i=1,10
set idummies(i) = %indiv(t)==i
end do i
linreg invest
# firmvalue cstock idummies
*
* Do random effects by using panel data transformations.
* %vrandom and %vindiv are the estimates of the component
* variances from the preg instructions. The coefficient
* estimates are identical to those from pregress, but the
* standard errors are slightly different because of the
* linreg on the transformed variables estimates a new
* sigma**2, while pregress using the %vrandom value.
*
compute theta=1-sqrt(%vrandom/(%vrandom+20*%vindiv))
panel(entry=1.0,indiv=-theta) invest / ifix
panel(entry=1.0,indiv=-theta) firmvalue / ffix
panel(entry=1.0,indiv=-theta) cstock / cfix
set constfix = 1-theta
linreg ifix
# constfix ffix cfix
*
* HAUSMAN.PRG
* Manual Example 6.6
*
cal 1920 1 1
allocate 1941:1
open data klein.dat
data(org=obs,format='(7x,9f8.3)') / consumption $
profit privwage invest klagged production govtwage govtexp taxes
set wagebill = privwage+govtwage
set trend = t-1931:1
set capital = klagged+invest
smpl 1921:1 1941:1
instruments constant trend govtwage govtexp taxes profit{1} $
capital{1} production{1}
*
equation conseq consumption
# constant profit{0 1} wagebill
equation invseq invest
# constant profit{0 1} capital{1}
equation wageeq privwage
# constant production{0 1} trend
*
*
* Compute 2SLS estimates using SUR. Save the covariance matrix
* of residuals in VCV2SLS, the coefficients and %XX matrix in
* BETA2SLS and COV2SLS.
*
sur(inst,isigma=%identity(3),outsigma=vcv2sls) 3
# conseq
# invseq
# wageeq
compute [symmetric] cov2sls=%xx
compute [vector] beta2sls=%beta
*
* Compute covariance matrix of 2SLS. Apply SUR with
* ISIGMA=INV(VCV2SLS), then compute the matrix expression from
* the preceding page.
*
sur(inst,noprint,nosigma,isigma=inv(vcv2sls)) 3
# conseq
# invseq
# wageeq
compute cov2sls=%mqform(inv(%xx),cov2sls)
*
* Compute 3SLS estimates.
*
sur(inst) 3
# conseq
# invseq
# wageeq
*
compute %xx=cov2sls-%xx
test(vector=beta2sls,whole)