Page 1 of 1
Variance by month
Posted: Thu Mar 12, 2015 3:27 pm
by miorinnovo
Is it possible to program a monthly series from a daily series where the monthly variable is the variance of the daily series?
Re: Variance by month
Posted: Thu Mar 12, 2015 3:43 pm
by EViews Glenn
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.
Re: Variance by month
Posted: Thu Mar 12, 2015 4:05 pm
by miorinnovo
How does the variance come into it though?
Re: Variance by month
Posted: Thu Mar 12, 2015 5:15 pm
by EViews Glenn
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.
Re: Variance by month
Posted: Thu Mar 12, 2015 5:55 pm
by miorinnovo
I see frequency conversion in the properties for the series but there doesnt seem to be the variance option you mention.
Re: Variance by month
Posted: Thu Mar 12, 2015 5:58 pm
by EViews Gareth
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"))
Re: Variance by month
Posted: Thu Mar 12, 2015 6:09 pm
by miorinnovo
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.
Re: Variance by month
Posted: Thu Mar 12, 2015 6:38 pm
by EViews Gareth
Population/sample difference
Re: Variance by month
Posted: Thu Mar 12, 2015 6:52 pm
by miorinnovo
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?
Re: Variance by month
Posted: Thu Mar 12, 2015 7:07 pm
by EViews Gareth
Do you want the population variance or the sample variance? (I.e. Divide by n or n-1)
Re: Variance by month
Posted: Thu Mar 12, 2015 7:56 pm
by miorinnovo
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