estimation of AR(1) model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

applesnow
Posts: 2
Joined: Sun Oct 27, 2013 7:28 am

estimation of AR(1) model

Postby applesnow » Sun Oct 27, 2013 7:31 am

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: estimation of AR(1) model

Postby startz » Sun Oct 27, 2013 8:17 am

How are you setting the initial value of y?

applesnow
Posts: 2
Joined: Sun Oct 27, 2013 7:28 am

Re: estimation of AR(1) model

Postby applesnow » Sun Oct 27, 2013 8:32 am

I'm not! that would make sense. how do I do that?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: estimation of AR(1) model

Postby EViews Gareth » Sun Oct 27, 2013 9:02 am

Set the sample to be the first observation only, then assign a value to Y


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests