From | Dirk Nachbar <[email protected]> |
To | statalist <[email protected]> |
Subject | st: AR1 |
Date | 03 Oct 2005 09:43:00 +0100 |
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 Assistant Economist Pensim2 Department for Work and Pensions Level 4, The Adelphi 1-11 John Adam St WC2N 6HT London 020 796 22705
The original of this email was scanned for viruses by the Government Secure Intranet (GSi) virus scanning service supplied exclusively by Energis in partnership with MessageLabs.
On leaving the GSi this email was certified virus-free
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |