R/plot.testPort.R

`plot.testPort` <-
function(x, type='l', ...){
	if(is.null(x$returns)[1]){
		stop('Cannot plot this model since no returns data provided.\n')
	}
	hold <- dim(x$returns)[1]
	values <- apply(1+x$returns[hold:1,], 2, cumprod)
	theReturns <- c(1, as.numeric(values %*% x$X))
	Index <- 0:(length(theReturns)-1)
	plot(Index, theReturns, type=type, ...)
}

Try the stockPortfolio package in your browser

Any scripts or data that you put into this service are public.

stockPortfolio documentation built on May 29, 2017, 11:32 a.m.