[R-SIG-Finance] help-time series

Yana Roth yana.roth at yahoo.com
Mon Mar 2 17:12:26 CET 2009


Hello,
I am working with libraries
 
timeDate)
library(timeSeries)
library(tseries)
library(RODBC)
library(PerformanceAnalytics)
library(fTrading)
 
and try to convert returns to monthly returns. I think the main problem that when it convert to time series object it doesn't prroduce the right time format , therefore when I apply 
"monthly" it doesnt read right the function.
Also when I converted data to csv it didn't help.
Anyway, I sen u the data and the code and output of error. I would b thankfull if u could help.
 data<-read.xls(file="Prices.xls")
tdata<-as.timeSeries(data) doesn't work
c(start(tdata), end(tdata))  #beginning and end of the time series (it doesnt work)
library(fCalendar)

price.ts<-timeSeries(data=data,charvec=rownames(data),
format="%Y-%m-%d",units=colnames(data))
 
produce an error
Warning message:
In timeDate(charvec = charvec, format = format, zone = zone, FinCenter = FinCenter) :
  'charvec' entries of different number of characters are replaced by NA's

 
tsret<-returns(price.ts)
head(tsret)
output
 2.621954e-05 -1.076771e-03 -0.0030647848  0.003368925
[2,] 2.621885e-05  8.432440e-04 -0.0003460069 -0.007477860
[3,] 2.621816e-05 -1.864423e-03  0.0022385116  0.005220514
[4,] 7.865036e-05  1.280149e-03  0.0002193982  0.015714158
[5,] 2.621541e-05  8.727527e-05  0.0014423604  0.001540914
[6,] 2.621472e-05 -2.186654e-03  0.0043773979 -0.009590629

applySeries(tsret, by="monthly", FUN=sum)
produce an error
Errore in midnightStandard(charvec, format) : 
  'charvec' has non-NA entries of different number of characters
Inoltre: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
 
 
thank you



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090302/765b4952/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Prices.xls
Type: application/octet-stream
Size: 120832 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090302/765b4952/attachment.obj>


More information about the R-SIG-Finance mailing list