[R-sig-finance] getReturns in fMultivar

Diethelm Wuertz wuertz at itp.phys.ethz.ch
Thu Jun 2 09:03:00 CEST 2005


As pointed out by ManojW, getReturns expects a S4 timeSeries object as 
input.

Try:
 > data(EuStockMarkets)
 > dim(EuStockMarkets)
[1] 1860    4
 > attr(EuStockMarkets, "tsp")
[1] 1991.496 1998.646  260.000
 > class(EuStockMarkets)
[1] "mts" "ts"

EuStockMarkets is a S3 mts/ts object which has no time positions as a
S4 timeSeries object does. Only start, end, and frequency are available.
So you have to re-construct the dates from the  EuStockMarkets object,
and convert EuStockMarkets to a  timeSeries object to use it together
with the functions getReturns or with returnSeries.

To plot ts and mts time series object inspect the help of the functions
plot.sts and ts.plot.

DW





ManojW wrote:

>A quick debug of getReturns reveal that the function returnSeries has some
>"issues"  handling vector data. As a stop gap arrangement, you can try to
>invoke getReturns by casting the data as a timeSeries obejct.
>
>Hope that helps.
>
>Manoj
>
>
>----- Original Message ----- 
>From: "Sanjun Chen" <sanjun.chen at gmail.com>
>To: <r-sig-finance at stat.math.ethz.ch>
>Sent: Thursday, June 02, 2005 1:04 PM
>Subject: [R-sig-finance] getReturns in fMultivar
>
>
>  
>
>>Hi,
>>I got the following message when I used the getReturns in the
>>fMultivar package. (it worked fine in previous version of fSeries).
>>
>>    
>>
>>>        data(EuStockMarkets)
>>>        dax = log(EuStockMarkets[, "DAX"])
>>>        plot(getReturns(dax))
>>>      
>>>
>>Error in ans[-1, ] : incorrect number of dimensions
>>
>>
>>Appreciate any help.
>>
>>Thanks.
>>
>>Sanjun Chen
>>
>>_______________________________________________
>>R-sig-finance at stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>    
>>
>
>_______________________________________________
>R-sig-finance at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>  
>



More information about the R-sig-finance mailing list