Monthly return and standard deviation

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

rickyyml
Posts: 16
Joined: Tue Nov 05, 2013 1:58 am

Monthly return and standard deviation

Postby rickyyml » Wed Nov 06, 2013 7:09 pm

I am a new user of EViews, now doing a project which need to calculate the day of the week & monthly return and standard deviation base on index.

Up on now, I have calculated the daily return by:
drl=log(y/y(-1))

For the monthly return, I don't know how can I change the equation so that I can get result.

Would you please advise what should I do?

Thank you in advance.
Attachments
project q1.wf1
(158.01 KiB) Downloaded 364 times

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

Re: Monthly return and standard deviation

Postby EViews Gareth » Wed Nov 06, 2013 7:18 pm

How are you defining monthly return?

rickyyml
Posts: 16
Joined: Tue Nov 05, 2013 1:58 am

Re: Monthly return and standard deviation

Postby rickyyml » Wed Nov 06, 2013 8:26 pm

the monthly return is:

Log (closing of current/closing of last month)

In other words, only compare the closing of each month, then get the return in % by log.

I really don't know how to take the last obs of each month in calculation.

Please kindly help.

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

Re: Monthly return and standard deviation

Postby EViews Gareth » Wed Nov 06, 2013 8:40 pm

I'd probably do it by making a new monthly page in the workfile, then coping the data over using "last" as the frequency conversion method.

If you want it in the same page, something like:

Code: Select all

genr(r) lastmonth = @recode(@month(-1)=@month, lastmonth(1), y(-1))
will get you the last observation of the month.

rickyyml
Posts: 16
Joined: Tue Nov 05, 2013 1:58 am

Re: Monthly return and standard deviation

Postby rickyyml » Fri Nov 08, 2013 8:08 pm

Dear Gareth

Thank you for your quick respond.

I am thinking if I can get the monthly return simply by counting the total of the daily return in "drl", I therefore created a group "mrl" which included "month" and 'drl"

Would you please advise for calculating the standard deviation? If I want to do it by the formula:

Standard Deviation of daily return of the month X Square roof of No. of trade day of the month

Would you please advise how should I write the formula in EViews?

Thank you very much!
Ricky
Attachments
project q1.wf1
(188.61 KiB) Downloaded 323 times

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

Re: Monthly return and standard deviation

Postby EViews Gareth » Mon Nov 11, 2013 9:08 am

Code: Select all

series yearmonth = @datefloor(@date, "mm") show @stdevsby(drl, yearmonth)*@sqrt(@maxsby(@day, yearmonth))

rickyyml
Posts: 16
Joined: Tue Nov 05, 2013 1:58 am

Re: Monthly return and standard deviation

Postby rickyyml » Sun Nov 17, 2013 8:44 am

Hello, Gareth, thank you for your help


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests