[R] FOMULATING TIME SERIES DATA FROM DATA FRAME
Peter Maclean
pmaclean2011 at yahoo.com
Sun Jul 17 04:35:06 CEST 2011
I am estimating Value at Risk using PerfomanceAnalytics package. The variables are stored in a data frame. I formated the data variables using zoo() and as.xtx() but it is not working. The working example is below.
##########################################################
reguire(zoo)
require(PerformanceAnalytics)
reguire(xts)
year<- c(1991-12-30, 1992-12-30, 1993-12-30, 1994-12-30)
R1 <- c(12, 9, 8, 13)
R2 <- c(5,2,9, 13)
d <- data.frame(cbind(year, R1,R2))
d<- zoo(d,year)
VaR(d)
#Error in checkData(R, method = "xts", ...)
#When I use
d <- as.xts(d,order.by =year, frequency = 1)
#Error in xts(coredata(x), order.by = order.by, frequency = frequency, :
# order.by requires an appropriate time-based object
Peter Maclean
Department of Economics
UDSM
More information about the R-help
mailing list