folks,

is there a better way to convert a daily series of price returns to a monthly 
one than as follows:

library(xts)

a <- xts(rnorm(100) / 100, order.by = as.Date(1:100))

am <- diff(to.monthly(cumsum(a))[, 4]) # [, 4] for Close levels

the problem with this is that the entire first month of returns is lost owing 
to the differencing. i would have to prefix the first month's returns manually, 
which seems a bit ugly.

if i had the original series in levels, then there's no issue, of course, but 
all i have in this instance are returns series.

cheers,

murali



_________________________________________________________________

 Contest

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to