2
votes

I have several xts objects, most of which are daily observations. I have one which is monthly. I would like to be able to combine three of them into one xts object, which I can then use in the PerfrormanceAnalytics package (eg - charts.PerformanceSummary). I have the following:

Ret <- merge.xts(dailyReturns[,3], 
       shortBothDaily[,3], 
       shortBothMonthly[,3])

The above code gives me an xts object, with the monthly returns filled in with 'NA'. I can make this fill be equal to zero, which then allows me to plot, but it produces a step wise function:

charts.PerformanceSummary(Ret)

enter image description here

I would like something similar to this, but with a typical looking cumulative returns series for the monthly data.

I can convert the two daily series into monthly (to.monthly()), but would rather not lose the granularity in the daily returns.

Is there an elegant way to do this? To maybe fill with simulated return data? Or have PerformanceAnalytics recognize the monthly return data and plot it accordingly?

I would like to see something like this (via Bloomberg):

enter image description here

As you can see, we have a series of daily returns, with another series of monthly returns plotted over the same time period.

This is not a huge deal, but it seems fairly simple and as if it should be a common need. I was hoping there was some sort of PerformanceAnalytics way to plot monthly and daily values together.

1
It's not clear to me what you're looking for. Your monthly data does plot, with the correct time index. If you're getting your returns on a monthly basis, then it is a stepwise function. So I really don't understand what you think you should get, or how you feel it should look. We can't guess at what you want, and PerformanceAnalytics doesn't make up data.Brian G. Peterson
You're rude. Also, I know full well it is a stepwise function, but I created that as a workaround. I fully understand WHY i got what I got, but what I got is not what I want. I am asking you all if there is a way to do something different than this. I would rather seelukehawk
I apologize if I was less than clear, but I have added a chart to depict what I mean.lukehawk

1 Answers

0
votes

The Bloomberg chart is wrong. It is interpolating data where none exists.

I assume that you need cbind.

require(quantmod)
require(PerformanceAnalytics)
data(managers)
getSymbols.yahoo('IBM',from='1996-01-01',to='2006-12-31',env=.GlobalEnv)
IBM.r <- Return.calculate(Ad(IBM))
monthly.r<-cbind(IBM.r,managers[,c(8,10)],fill=0)
charts.PerformanceSummary(monthly.r)

chart output

If you would like to make up data like the Bloomberg chart does, you may do that via na.approx, but please don't confuse that with real data.