[R-SIG-Finance] Generating Monthly Return Info

Peter Carl peter at braverock.com
Sat Mar 12 14:57:01 CET 2011


Right, you have to convert the daily returns to a cumulative series or
"wealth index" before using to.monthly on that index.  Then you can
calculate monthly returns using the 'Close' column.

HTH,

pcc
-- 
Peter Carl
http://www.braverock.com/~peter

> I tried to.monthly but it simply outputs the OHLC of the daily returns for
> the month. I'm looking for the consolidated monthly return. For example,
> f1
> is the xls object. f1$Rtrns is the daily returns. Here are the daily
> returns
> for March:
>
> 2011-03-01 -0.01573
> 2011-03-02  0.00159
> 2011-03-03  0.01722
> 2011-03-04 -0.00737
> 2011-03-07 -0.00832
> 2011-03-08  0.00892
> 2011-03-09 -0.00136
> 2011-03-10 -0.01885
>
> So, if I try to.monthly(f1$Rtrns), the march values I get back are:
>
> Mar 2011        -0.01573         0.01722       -0.01885         -0.01885
>
> Those numbers are simply the OHLC of the daily returns. I'm looking for
> the
> total return for March. Actually, I'm looking for a consolidated table of
> total returns by month. I'm just using march as an example.
>
>
>
> On Thu, Mar 10, 2011 at 11:43 PM, Peter Carl <peter at braverock.com> wrote:
>
>> ?to.monthly
>> --
>> Peter Carl
>> http://www.braverock.com/~peter
>>
>> > Newbie just learning.
>> >
>> > Trying to figure out how I generate monthly returns information. I
>> have
>> > daily returns and daily equity for a trading system over a 10 year
>> period
>> > in
>> > an xts format. I'd like to collapse the daily data into monthly data.
>> In
>> > addition, I'd like to be able to create a table of monthly returns by
>> > year.
>> > I tried table.CalendarReturns() in the PerfomanceAnalytics package but
>> it
>> > seems like it needs monthly returns as the input.
>> >
>> > Suggestions ?
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-SIG-Finance at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> > -- Subscriber-posting only. If you want to post, subscribe first.
>> > -- Also note that this is not the r-help list where general R
>> questions
>> > should go.
>> >
>>
>>
>>
>



More information about the R-SIG-Finance mailing list