Replicate value of odds observations

For questions regarding programming in the EViews programming language.

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

lilian.ferro
Posts: 5
Joined: Mon Nov 03, 2014 9:22 am

Replicate value of odds observations

Postby lilian.ferro » Wed Mar 02, 2016 2:38 pm

Hello,

I have a workfile where my id is a number (not a date).
I would like to replicate the value of the odds observations on the evens observations.
Can you help me?

Thanks,

Lilian

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

Re: Replicate value of odds observations

Postby EViews Gareth » Wed Mar 02, 2016 2:46 pm

Code: Select all

smpl if @mod(@trend,2)=0 x=x(-1) smpl @all

lilian.ferro
Posts: 5
Joined: Mon Nov 03, 2014 9:22 am

Re: Replicate value of odds observations

Postby lilian.ferro » Thu Mar 03, 2016 2:26 pm

Thank you, but the code works only with observations before the 97th obs.
Here's my code. Hope you can help me.

Code: Select all

for !i = 1 to 135 series fx_!i=(x_!i(-24)+x_!i(-48)+x_!i(-72)+x_!i(-96))/4 smpl 97 @last equation eq.ls x_!i xm_!i eq.fit fx_!i 'equation eq.ls x_!i xf_!i 'eq.fit fx_!i 'equation eq.ls x_!i xm_!i xf_!i 'eq.fit fx_!i smpl @all next smpl if @mod(@trend,2)=0 series fx_1=x_1(-1) series fx_2=x_2(-1) series fx_50=x_50(-1) series fx_53=x_53(-1) series fx_55=x_55(-1) series fx_56=x_56(-1) series fx_77=x_77(-1) series fx_94=x_94(-1) series fx_98=x_98(-1) series fx_103=x_103(-1) series fx_114=x_114(-1) series fx_117=x_117(-1) series fx_127=x_127(-1) series fx_134=x_134(-1) series fx_135=x_135(-1) smpl @all

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

Re: Replicate value of odds observations

Postby EViews Gareth » Thu Mar 03, 2016 2:29 pm

There is nothing in my code to prevent it from working on observations past the 97th.

lilian.ferro
Posts: 5
Joined: Mon Nov 03, 2014 9:22 am

Re: Replicate value of odds observations

Postby lilian.ferro » Thu Mar 03, 2016 2:55 pm

I know, but as my variable is the result of a forecast from a equation that begins in the 97th obs, your code is only working for observations before the 97th.
Can you help me with that?

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

Re: Replicate value of odds observations

Postby startz » Thu Mar 03, 2016 3:07 pm

Code: Select all

series fx_1=x_1(-1)
Do you intend to have fx on one side of the equation and x on the other?

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

Re: Replicate value of odds observations

Postby EViews Gareth » Thu Mar 03, 2016 3:08 pm

You appear to have changed my code to include an F.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests