Displaying 2 results from an estimated 2 matches for "cumreturn".
2007 Mar 16
1
cumsum over varying column lengths
...ative return 'returnsFromInception' for the equity starting from the
startOffset date.
Is there a better way than as follows:
n <- NROW(historicalReturns)
returnsFromInception <- matrix(nrow = 1, ncol =
NCOL(historicalInceptionDates))
for (i in 1 : NCOL(historicalReturns))
{
cumReturn <- cumsum(historicalReturns[startOffset[1, i] : n, i])
returnsFromInception[1, i] <- cumReturn[length(cumReturn)]
}
This works for me, but seems rather inelegant, and I don't like having to
use a matrix for returnsFromInception and startOffset, where vectors would
work.
Thanks for...
2012 Jan 15
1
problem with table.CAPM in PerformanceAnalytics
...])
and getting this error
Error in as.vector(data[, i]) : subscript out of bounds
I've searched around and cannot find a solution to the problem. I've used this in the past without problem and I'm not sure what I did different this time.
Other functions from that package like chat.CumReturns() work OK with this series. CAPM.Beta() does not.
You can get the series timeSeries at http://www.pazzula.com/blog/series.rda
Thanks in advance.
Dominic J. Pazzula
+-+-+-+-+-+-+-+-+-+-+-
dompazz@yahoo.com
[[alternative HTML version deleted]]