From | "Michael Blasnik" <[email protected]> |
To | <[email protected]> |
Subject | st: Re: AR1 |
Date | Mon, 03 Oct 2005 08:31:40 -0400 |
Dear all1) It's not very helpful to say "but it doesn't work" -- if you want help you should say why it doesn't work -- did Stata give you an error? Were the results not what you expected? For the code you list, I'd guess the problem may be that `obs' is never defined as a local macro, so it is blank. The set obs command does not create a macro called obs.
I am trying to simulate an AR(1) process but it proves to be hard in Stata. My
idea was to declare a matrix and then do it in a loop, but it doesn't work.
Maybe someone can help.
Dirk
------------------
clear
set matsize 800
set obs 700
gen time=_n
tsset time
gen y=invnorm(uniform())
mkmat y
local i = 1
while `i' < `obs' {
matrix y[i+1,1]=1+0.5*y[i,1] +invnorm(uniform())
local i = `i' + 1
}
svmat y
arima y, arima(1,0,0)
---------------------------------------------------
Dirk Nachbar
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |