Variance by month

For questions regarding programming in the EViews programming language.

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

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Variance by month

Postby miorinnovo » Thu Mar 12, 2015 3:27 pm

Is it possible to program a monthly series from a daily series where the monthly variable is the variance of the daily series?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Variance by month

Postby EViews Glenn » Thu Mar 12, 2015 3:43 pm

Put the daily data in a daily workfile page.
Create a monthly page corresponding to those dates.
Copy the daily to the monthly performing a frequency conversion which averages the data over the high-frequency observations.
For programming, use the copy command to copy between the two pages.

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Variance by month

Postby miorinnovo » Thu Mar 12, 2015 4:05 pm

How does the variance come into it though?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Variance by month

Postby EViews Glenn » Thu Mar 12, 2015 5:15 pm

In the frequency conversion you can specify the method of going from high to low. One method is to take the variance of the high-frequency data corresponding to the lower frequency. Thus, the variance of the daily for each month is put into the corresponding month.

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Variance by month

Postby miorinnovo » Thu Mar 12, 2015 5:55 pm

I see frequency conversion in the properties for the series but there doesnt seem to be the variance option you mention.

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

Re: Variance by month

Postby EViews Gareth » Thu Mar 12, 2015 5:58 pm

Code: Select all

'create some data and pages wfcreate(page=mydaily) d7 1990 2000 series x=nrnd 'create monthly variance series series monthly_variance = @varsby(x, @datefloor(@date, "MM"))

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Variance by month

Postby miorinnovo » Thu Mar 12, 2015 6:09 pm

Thanks!

That seems to have worked. The variance I get isn't exactly the same as when I square the standard deviation in the stats table of a series with just one month of data, not sure why.

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

Re: Variance by month

Postby EViews Gareth » Thu Mar 12, 2015 6:38 pm

Population/sample difference

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Variance by month

Postby miorinnovo » Thu Mar 12, 2015 6:52 pm

Sorry how do you mean? If I have a series and copy one month of data into a new series, the standard deviation should match up with the method you gave me for variance for that month, no?

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

Re: Variance by month

Postby EViews Gareth » Thu Mar 12, 2015 7:07 pm

Do you want the population variance or the sample variance? (I.e. Divide by n or n-1)

miorinnovo
Posts: 199
Joined: Sun Mar 01, 2015 5:01 pm

Re: Variance by month

Postby miorinnovo » Thu Mar 12, 2015 7:56 pm

Oh I follow. When I put the one month of data in its own series my denominator is 12 instead of 11. Thanks again Gareth, you're the man


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest