Page 1 of 1

Monthly return and standard deviation

Posted: Wed Nov 06, 2013 7:09 pm
by rickyyml
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.

Re: Monthly return and standard deviation

Posted: Wed Nov 06, 2013 7:18 pm
by EViews Gareth
How are you defining monthly return?

Re: Monthly return and standard deviation

Posted: Wed Nov 06, 2013 8:26 pm
by rickyyml
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.

Re: Monthly return and standard deviation

Posted: Wed Nov 06, 2013 8:40 pm
by EViews Gareth
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.

Re: Monthly return and standard deviation

Posted: Fri Nov 08, 2013 8:08 pm
by rickyyml
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

Re: Monthly return and standard deviation

Posted: Mon Nov 11, 2013 9:08 am
by EViews Gareth

Code: Select all

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

Re: Monthly return and standard deviation

Posted: Sun Nov 17, 2013 8:44 am
by rickyyml
Hello, Gareth, thank you for your help