Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: ARIMA postestimation after -rolling- command


From   jane k <[email protected]>
To   [email protected]
Subject   st: ARIMA postestimation after -rolling- command
Date   Thu, 29 Mar 2007 10:35:47 -0700

Hello,
 
I am trying to do a rolling ARIMA (p,1,q) regression using -rolling- command but having difficulty predicting my y-hat values (not in xb form but in y), after Stata finishes its rolling procedure. I have been referring to the Stata 9 time series manual, specifically its example 3 of the -rolling- section where it suggests creating  a .do file / rclass program, but i am very inexperienced with the programming syntax; i have been attempting a lot of trial-and-error rclass program  but so far i've been unsuccessful despite the hours i've put into this trying to make it work.
 
for my specific analysis, i have set the recursive window size at (500), as i am trying to take the first five hundred data points (of my existing 1000 actual y-values), do a 1-step forecast for Y-hat_501, store that Y-hat_501, then take the 501 y-values to do another 1-step forecast on Y-hat_502.. etc. 
 
if i do not use rclass program and simply use -rolling- command with ARIMA, all my resulting coefficients from the rolling regression would be stored in data editor but i am unable to acquire my y-hat values from them (not sure if this is possible without resorting to rclass programs?)
 
i did find some examples of rclass programs scattered about the interet similar to my task (please refer to below for one),  but i could not exactly modify it to match my analysis as i do not understand the syntax very well (especially confused about setting the local values which would tell stata exactly the procedure i described above using the correct range of data). unfortunately i only own the  stata time series manual and not the programming manual.  any help would be greatly appreciated. thanks for reading i hope i made myself clear.
 
-  student
 
 
sample rclass program:


> program define rollpred
> version 6.0
> syntax varlist , [begin(int 200) end(int 10)] gen(str)
> confirm new var `gen'
> gen `gen'=.
> tempvar pred
> local obs=_N
> local i=1
> local j=`i'+(`begin'-`end')
> local n=`i'+`begin'
> quietly {
> while `j'<`obs' {
>  reg `varlist' in `i'/`j'
>  cap drop `pred'
>  predict `pred' in `n'
>  replace `gen'=`pred' in `n'
>  local i=`i'+1
>  local j=`j'+1
>  local n=`n'+1
> }
> }
> end

 
 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index