Retrieve Standard Error from Betasys

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Retrieve Standard Error from Betasys

Unread post by alexecon »

I am using REPORT to generate a beautiful table with the coefficients of betasys following estimation of a three variable MS-VAR. How can I retrieve the standard errors as well please? Thank you.

This is for the regime-dependent means and variances of the first equation (with the standard errors replaced with a "?"):

Code: Select all

report(action=define,hlabels=||"","Regime 1","Regime 2"||)
report(ROW=NEW,atcol=1) "Mean" betasys(1)(1,1) betasys(2)(1,1)
report(ROW=NEW,atcol=1) "Std. Err. (Mean)" ? ?
report(ROW=NEW,atcol=1) "Variance" sigmav(1)(1,1) sigmav(2)(1,1)
report(ROW=NEW,atcol=1) "Std. Err. (Variance)" ? ?
report(action=format,picture="*.###")
report(action=show, window="MS-VAR Estimates of Mean and Variance")
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Retrieve Standard Error from Betasys

Unread post by TomDoan »

If this is for a specific program, just locate where the coefficients of interest are in the regression output, and use %STDERRS(position). That is, if sigmav(1)(1,1) is the 5th coefficient, you would want %STDERRS(5). (This applies to estimation by ML or by EM with BHHH polishing, both of which create %STDERRS as part of the creation of the regression output).

If you want something more flexible (in case you change the model, which would reposition the parameters), you can do something like
dec hash[real] hashstderrs
do i=1,%nreg
   compute hashstderrs(%reglabels()(i))=%stderrs(i)
end do i
then hashstderrs("sigmav(1)(1,1)") would have the standard error for the SIGMAV(1)(1,1) coefficient, whereever it's located. (Note that you need the "..." around the name when referencing it out of the hash).
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Retrieve Standard Error from Betasys

Unread post by alexecon »

TomDoan wrote:If this is for a specific program, just locate where the coefficients of interest are in the regression output, and use %STDERRS(position). That is, if sigmav(1)(1,1) is the 5th coefficient, you would want %STDERRS(5).
This for a MSSysRegression with MCMC. Below I have copied the betasys output for the first equation of the VAR (in the first regime):

Code: Select all

BETASYS(1)(1,1) -1.066 0.367
BETASYS(1)(2,1)  0.649 0.087
BETASYS(1)(3,1)  0.013 0.041
BETASYS(1)(4,1)  1.352 0.423
What I need is to access the standard errors (0.367, 0.087, etc.) of the estimated coefficients. Using %STDERRS() doesn't give me anything, it's just a blank cell in the table.

UPDATE: I have been able to reference the standard errors in the array BSTDERRS!
TomDoan wrote:If you want something more flexible (in case you change the model, which would reposition the parameters), you can do something like
dec hash[real] hashstderrs
do i=1,%nreg
   compute hashstderrs(%reglabels()(i))=%stderrs(i)
end do i
then hashstderrs("sigmav(1)(1,1)") would have the standard error for the SIGMAV(1)(1,1) coefficient, whereever it's located. (Note that you need the "..." around the name when referencing it out of the hash).
Interestingly, this gives me a "NA"!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Retrieve Standard Error from Betasys

Unread post by TomDoan »

You didn't say these were the MC standard errors---the above works with ML or EM (with polishing by BHHH). The betasys(1)(1,1) that you're displaying won't be the MC mean; it will be the final value in the chain. If you look at the EEV Monte Carlo program, the MC means and standard errors are put into BMEANS and BSTDERRS:
@mcmcpostproc(ndraws=ndraws,mean=bmeans,stderrs=bstderrs) bgibbs
*
report(action=define)
report(atrow=1,atcol=1,fillby=cols) %parmslabels(allparms)
report(atrow=1,atcol=2,fillby=cols) bmeans
report(atrow=1,atcol=3,fillby=cols) bstderrs
report(action=format,picture="*.###")
report(action=show)
You want to pull elements out of those.
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Retrieve Standard Error from Betasys

Unread post by alexecon »

Instruction ESTIMATE saves the coefficients in %BETASYS but what about the standard errors?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Retrieve Standard Error from Betasys

Unread post by TomDoan »

%sqrt(%xdiag(%kroneker(%sigma,%xx))) will be the vector of standard errors.
alexecon
Posts: 72
Joined: Fri Oct 30, 2015 12:16 pm

Re: Retrieve Standard Error from Betasys

Unread post by alexecon »

I'm glad I asked – thank you!
Post Reply