Page 1 of 1

estimation of AR(1) model

Posted: Sun Oct 27, 2013 7:31 am
by applesnow
Hi there. I'm trying to estimate the following model, but get the error message: "Insufficient number of observations in "EQUATION AR1.LS Y C Y(-1)" - can anyone help? what should I write instead? thanks!

'a)

!n = 500 'Number of observations in workfile
!m = 10000 'Number of simulations

create arma u 1 !n 'Create workfile
rndseed 2
vector(3) vN 'define a 3 x 1 vector to store the different sample sizes
vN.fill 50, 100, 500 'we consider three different sample sizes

matrix (!m,3) mphi 'Define a !m x 3 matrix to store the slope coefficient from the regression for each iteration, sample size, and slope coefficient.
vector(3) vbetameanols
equation ar1 'Define an equation obejct

for !i = 1 to 3 'Run a loop over the different sample sizes
!d = vN(!i) 'set the sample size equal to the i'th element of vN
smpl 2 !d 'Setting sample size equal to i'th element of vN + Lagged values must exist.

for !j = 1 to !m 'Do iterations

genr e = nrnd 'Generate error terms
genr y = 0.5 + 0.1*y(-1) +e 'Initiate series
equation ar1.ls y c y(-1) 'Estimate an AR(1) model
mphi(!j,!i) = c(2) 'store the slope coefficient

next 'end for loop
next 'end for loop

Re: estimation of AR(1) model

Posted: Sun Oct 27, 2013 8:17 am
by startz
How are you setting the initial value of y?

Re: estimation of AR(1) model

Posted: Sun Oct 27, 2013 8:32 am
by applesnow
I'm not! that would make sense. how do I do that?

Re: estimation of AR(1) model

Posted: Sun Oct 27, 2013 9:02 am
by EViews Gareth
Set the sample to be the first observation only, then assign a value to Y