Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to add Q stats from -wntestq- to -esttab- table (hopefully with -estadd-)


From   Richard Herron <[email protected]>
To   [email protected]
Subject   Re: st: How to add Q stats from -wntestq- to -esttab- table (hopefully with -estadd-)
Date   Fri, 16 Sep 2011 09:39:45 -0400

I found a hackish solution.

* ----- begin code -----
* combine regressions with -eststo- and add -wntestq- with -estadd-
webuse friedman2, clear
generate ln_m1 = ln(m1)
eststo clear
eststo: quietly arima DS4.ln_m1, ar(1) ma(2)
quietly predict res_1, residuals
quietly wntestq res_1
estadd scalar Q = r(stat)

eststo: quietly arima DS4.ln_m1, ar(1) ma(1/2)
quietly predict res_2, residuals
quietly wntestq res_2
estadd scalar Q = r(stat)

eststo: quietly arima DS4.ln_m1, ar(1/2) ma(2)
quietly predict res_3, residuals
quietly wntestq res_3
estadd scalar Q = r(stat)

eststo: quietly arima DS4.ln_m1, ar(1/2) ma(1/2)
quietly predict res_4, residuals
quietly wntestq res_4
estadd scalar Q = r(stat)

* and create tables with -esttab-
esttab, stats(aic bic Q) noobslast nomtitles
* ----- end code -----

Programming is the next task in my R-to-Stata switch. I will update
when I learn how to code a -estadd_wntestq- solution.

On Wed, Sep 14, 2011 at 20:32, Richard Herron
<[email protected]> wrote:
>
> I have an -esttab- table with multiple -arima- models to which I would
> like to add Q stats made with -wntestq-. I can't use -estadd scalar-
> because Q stats are not part of -arima- objects. Is there a way that I
> can chain together -predict, residuals- and -wntestq- to add Q stats
> to my -esttab- table? Thanks!
>
> Here is some code (including how I would find Q stats "manually"):
>
> * ----- begin code -----
> * I know how to combine regressions with -eststo-
> webuse friedman2, clear
> generate ln_m1 = ln(m1)
> eststo clear
> eststo: quietly arima DS4.ln_m1, ar(1) ma(2)
> eststo: quietly arima DS4.ln_m1, ar(1) ma(1/2)
> eststo: quietly arima DS4.ln_m1, ar(1/2) ma(2)
> eststo: quietly arima DS4.ln_m1, ar(1/2) ma(1/2)
>
> * and create tables with -esttab-
> esttab, aic bic noobslast nomtitles
>
> * I would like to add Q stats to each model with -estadd-, but I can't
> figure out how
>
> * here's how I find Q stats "manually"
> quietly arima DS4.ln_m1, ar(1/2) ma(1/2)
> predict res, residuals
> wntestq res, lags(8)
> * ----- end code -----
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index