mcov( options ) start end list of resids
# list of variables in regression format
options:
lwindow=neweywest/bartlett/damped/parzen/
quadratic/[flat]/panel/white
lags=correlated lags
LAGS gives the bandwidth
******
Examples
mcov(lwindow=bartlett,lags=lags) startl+1 endl resids
# constant
computes an estimate of the spectral density of RESIDS at frequency zero, using
“LAGS” lags. The computed matrix (which here will be 1x1) will be in %CMOM.
[%CMOM] : SYMMETRIC array for computed matrix
******
paneldols:
* Compute the long-run variance of the residuals.
*
mcov(lwindow=bartlett,lags=lags,noprint) 2 jperiods
# dolsres
compute idlrvar = %cmom(1,1)/(jperiods-1)
*
* Pull out of this regression:
* 1. The coefficients on the RHS endogenous variables
* 2. The covariance matrix of those coefficients
* 3. The precision matrix of those coefficients (inv of #2)
* 4. The matrix of reciprocal square roots of the diagonal elements of the
* covariance matrix. That's the weighting matrix for the coefficients which
* will match up with the averaged t-statistics.
*
compute bdols=%xsubvec(%beta,1,m)
compute vdols=%xsubmat(%xx,1,m,1,m)*idlrvar
compute hdols=inv(vdols)
compute ddols=inv(%sqrt(%diag(%xdiag(vdols))))
*
* Compute t-stat vs the hypothesized vector
*
ewise tdols(i) = (bdols(i)-bvec(i))*ddols(i,i)
*****************
Compute the long-run variance of the residuals.
用于计算t-statistics