Allin Cottrell0.52015-03-22Statistics for fixed-effects estimatesMODELWIN/Analysis
This function computes the standard errors of the estimates
of the individual fixed effects for a panel-data model estimated
via gretl's "panel" command. All of the required arguments may
be obtained via accessors after fixed-effects estimation.
The matrix that is returned has one row per included unit and
three columns. The columns contain, respectively, the estimated
intercept for the unit, its standard error, and the associated
z-score.
Arguments:
series ahat: series containing the per-unit intercepts, available
as $ahat
list X: the list of regressors from the model, available as $xlist
const matrix Vb: the covariance matrix for the estimates of the
regular parameters, available via $vcv
scalar s: the standard error of regression, available as $sigma
## no-print ##
bundle b
b["Amat"] = fe_stats($ahat, $xlist, $vcv, $sigma)
return b
intercept serieslist of regressorscovariance matrixstd error of regressionscalar T = $pd
# strip out the overall constant
X -= 0
matrix V = Vb[2:,2:]
# the number of units in the sample range
scalar N = ($t2 - $t1 + 1) / T
scalar s2 = sigma^2
scalar nx = nelem(X)
matrix A = zeros(N, 3)
matrix Xbar_i
scalar Ti
scalar s
scalar i_min = min($unit)
scalar i_max = max($unit)
scalar k = 1
loop i=i_min..i_max -q
Ti = 0
Xbar_i = zeros(1,nx)
loop t=1..T -q
s = (i-1)*T + t
if (ok(ahat[s]))
if Ti == 0
A[k,1] = ahat[s]
endif
loop foreach j X -q
Xbar_i[j] += X.$j[s]
endloop
Ti++
endif
endloop
if Ti > 0
Xbar_i /= Ti
A[k,2] = sqrt(s2 / Ti + qform(Xbar_i, V))
A[k,3] = A[k,1] / A[k,2]
else
A[k,] = NA
endif
k++
endloop
colnames(A, "a_i s.e.(a_i) z")
return A
matrix A = b["Amat"]
printf "Per-unit intercepts:\n"
printf "\n%#13.6g\n", A
catch series ahat = $ahat
scalar err = $error
if err
print "fe_stats: couldn't get $ahat"
endif
return err
include fe_stats.gfn
open greene14_1.gdt
logs C Q PF
panel l_C 0 l_Q l_PF LF --fixed
matrix A = fe_stats($ahat, $xlist, $vcv, $sigma)
print A