Standard deviation over recursive sample

For questions regarding programming in the EViews programming language.

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

Rosa.hh
Posts: 22
Joined: Tue Dec 14, 2010 8:07 am

Standard deviation over recursive sample

Postby Rosa.hh » Tue Dec 14, 2010 9:02 am

Hi!

I am using Eviews 7 and I have a question about the standard deviation function. I have a database for the period 1990Q1 to 2009Q2. I want to calculate an explanatory variable' standard deviation for the second half of my sample using the information of the first half; keeping the first observation fixed. So I want to compute it first for 1999Q4 using info from 1990Q1-1999Q3; then for 2000Q1 using info from 1990Q1-1999Q4 and so on until 2009Q2.

I have tried the programs detailed below however although it gives me information for the second half of the period (as I want to), it is calculating the standard deviation using the info. for the second half of the period instead of using the first half which is what I want.

How can I estimate the stdev for the second half of my sample using the information of the first half?

Thank you very much in advance!

!halfobs=39
!endobs=78
for !c = 1 to !halfobs
smpl @all
smpl @last-(!halfobs-!c) @last
series stdev=@stdev(a_rer_gq)

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

Re: Standard deviation over recursive sample

Postby EViews Gareth » Tue Dec 14, 2010 9:11 am

Use the @cumstdev function. Something like:

Code: Select all

series temp = @cumstdev(a_rer_gq) smpl 1999q4 @last series stdev = temp(-1) d temp

Rosa.hh
Posts: 22
Joined: Tue Dec 14, 2010 8:07 am

Re: Standard deviation over recursive sample

Postby Rosa.hh » Tue Dec 14, 2010 9:45 am

Thank you very much Gareth!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests