rCumSum {realized} | R Documentation |
Plots cummulative returns at a certain alignment given a return series.
rCumSum(x, period = 1, align.period = 1, plotit = FALSE, type = "l", cts = TRUE, makeReturns = FALSE)
x |
RealizedObject or TimeSeries for S+ |
period |
Sampling period |
align.period |
Align the returns to this period first |
plotit |
T for plot |
type |
Line or points |
cts |
Create calendar time sampling if a non realizedObject is passed |
makeReturns |
Prices are passed make them into log returns |
Cummulative return vector if plotit = F
Scott Payseur <spayseur@u.washington.edu>
data(msft.real.cts) data(dates.example) cumm <- list() cumm[[1]] <- rCumSum(msft.real.cts[[1]], period=1, align.period=60) cumm[[2]] <- rCumSum(msft.real.cts[[1]], period=10, align.period=60) cumm[[3]] <- rCumSum(msft.real.cts[[1]], period=20, align.period=60) cumm[[4]] <- rCumSum(msft.real.cts[[1]], period=30, align.period=60) plot(cumm[[1]], xlab="", ylab="Cumulative Ruturns", main="MSFT", sub=dates.example[[1]], type="p", col=16, lwd=2) lines(cumm[[2]], col=2, lwd=2) lines(cumm[[3]], col=3, lwd=2) lines(cumm[[4]], col=4, lwd=2)