Is there a better way to show the output from a subset VAR?

For questions and discussion related to graphs, reports, and other output, including issues related to presenting or publishing results.
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Is there a better way to show the output from a subset VAR?

Unread post by macro »

I have code that estimates a subset VAR equation-by-equation:

Code: Select all

calendar(q) 1947 1

open data data.csv
data(format = cdf, org = columns) 1970:1 2015:2 $
    gdph cdh ffed lr
close data

report(action = define, hlabels = ||"Regressor", "GDP", "Consumption"||)

linreg(print, define = eq1) gdph
# ffed{3 to 6} lr{1 2 4}
report(regress)

linreg(print, define = eq2) cdh
# ffed{1 to 3} lr{2 to 5}
report(regress)

report(action = show)
As of now, this displays

Code: Select all

Regressor      GDP      Consumption
FFED{3}      19.480062   -78.183085
           (357.632048)  (30.797323)
FFED{4}     -11.990367
           (519.483880)
FFED{5}     222.054116
           (501.160617)
FFED{6}    -799.431959
           (324.080446)
LR{1}      3427.362050
          (1170.225960)
LR{2}     -2746.678519   309.339318
          (1675.606390) (113.060738)
LR{4}      1311.521907  -245.343544
           (681.659189) (195.535344)
FFED{1}                  -35.602207
                         (27.747893)
FFED{2}                   54.292665
                         (42.386350)
LR{3}                   -233.190892
                        (202.358697)
LR{5}                    307.194045
                         (99.820578)
because any lags that aren't in the first equation are appended to the end of the regression list in the report, instead of slotted in to where they would belong if I was writing the model out by hand, where all variables have all their lags in order, e.g. FFED{1}, FFED{2}, ... LR{1}, LR{2}, ... etc.

Is there a way to display the coefficients and std errors (or tstats) from this VAR using report, or should I roll my own using some combination of %tablefromrl to fill in missing lags with blanks in each equation?
Attachments
data.csv
(5.67 KiB) Downloaded 936 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Is there a better way to show the output from a subset V

Unread post by TomDoan »

You can force a particular order by seeding in the regressors column (leaving a blank line between each regressor). For instance:

Code: Select all

report(action=define,title="Estimated Models for DOCVIS",$
 hlabels=||"Variable","Poisson","Negbin 2","Negbin 2 Het.","Negbin 1","Negbin P"||)
*
* Fill in the column with row labels
*
report(atrow=1,atcol=1,fillby=cols) "Constant" "" "Age" "" "Education" "" "Income" $
 "" "Kids" "" "Public" "" "P" "" "Alpha" "" "Female" "" "Married" "" "LnL"
macro
Posts: 70
Joined: Thu Jul 16, 2015 3:01 pm

Re: Is there a better way to show the output from a subset V

Unread post by macro »

Thank you. This is the code I'm using, and it works well.

Code: Select all

calendar(q) 1947 1

open data data.csv
data(format = cdf, org = columns) 1970:1 2015:2 $
    gdph cdh ffed lr
close data

* estimate one equation of the VAR to get the regressor labels
linreg(noprint) gdph
# ffed{1 to 6} lr{1 to 6} constant

report(action = define, hlabels = ||"Regressor", "GDP", "Consumption"||)
compute labels = %eqnreglabels(0)
declare vector[string] report_labels(2*%size(labels))
ewise report_labels(i) = %if(%mod(i,2) == 1, labels(fix(i/2)+1), "")
report(action = modify, atrow = 1, atcol = 1, fillby = cols) report_labels

linreg(noprint) gdph
# ffed{3 to 6} lr{1 2 4} constant
report(regress)

linreg(noprint) cdh
# ffed{1 to 3} lr{2 to 5} constant
report(regress)

report(action = show)
Post Reply