[R-SIG-Finance] timeSeries Error

Diethelm Wuertz wuertz at itp.phys.ethz.ch
Thu Apr 22 00:53:30 CEST 2010


Attiglah, Mama wrote:
> Is anyone successful in using timeSeries function ? 
>
> All the R examples are not working, see the print below. 
>
> Anyone has experienced and fixed the pb? 
>
> Thanks 
>
>
>
>   
>> LPP = 100 * as.timeSeries(data(LPP2005REC))[, 1:3]
>>     
> Error in .local(.Object, ...) : 
>   unused argument(s) (Data = c(-0.000612745, -0.002762009, -0.001153092,
> -0.00323575, 0.00131097, 0.000539312, -0.002545021, 0.001003358,
> 0.000616951, 0.000693615, 0.000154071, 0.002999656, -0.001306436,
> -0.002232573, 0.001155402, -0.000230974, 0.000692761, 0.002075407,
> -0.000614487, -0.000307385, 0.001228973, 0.000613921, -0.000230176,
> -0.000537284, -0.001536689, 0.00307102, -0.000690158, 0.00176279,
> -0.000612792, 0.000765931, -0.000689312, -0.003223086, 0.00145935,
> 0.001303931, 0.000153292, 0.000689523, 0.000689048, 
>   
>> data(DowJones30)
>>    DowJones.ts = as.timeSeries(DowJones30)[, c("CAT", "GE", "IBM",
>>     
> "JPM", )]
> Error in .local(.Object, ...) : 
>   unused argument(s) (Data = c(5.92, 5.92, 5.88, 5.76, 5.72, 5.63, 5.53,
> 5.67, 5.68, 5.68, 5.7, 5.7, 5.97, 6.1, 6.14, 5.97, 6.1, 6.02, 6.05,
> 6.12, 6.31, 6.7, 6.64, 6.73, 6.87, 6.8, 6.75, 6.66, 6.73, 7.05, 6.88,
> 7.19, 6.97, 7.01, 6.97, 6.84, 6.74, 6.68, 6.55, 6.69, 6.6, 6.61, 6.78,
> 6.89, 6.98, 7.1, 6.98, 6.96, 6.92, 6.93, 7.11, 7.1, 7, 6.97, 6.83, 6.82,
> 6.71, 6.77, 6.79, 6.88, 6.86, 6.75, 6.65, 6.79, 6.75, 6.71, 6.69, 6.68,
> 6.62, 6.53, 6.5, 6.42, 6.74, 6.74, 7.01, 6.98, 6.95, 6.91, 7.02, 7.22,
> 7.02, 6.91, 6.97, 7.01, 
>   
>
>   


Try


libray(fPortfolio)

 > LPP = 100 * as.timeSeries(data(LPP2005REC))[, 1:3]
 > head(LPP)
GMT
                 SBI        SPI        SII
2005-11-01 -0.0612745  0.8414595 -0.3190926
2005-11-02 -0.2762009  0.2519342 -0.4117638
2005-11-03 -0.1153092  1.2707292 -0.5209409
2005-11-04 -0.3235750 -0.0702757 -0.1127165
2005-11-07  0.1310970  0.6205226 -0.1795839
2005-11-08  0.0539312  0.0329260  0.2103374

or just

 > LPP = LPP2005REC
 > head(LPP[, 1:3])
GMT
                   SBI          SPI          SII
2005-11-01 -0.000612745  0.008414595 -0.003190926
2005-11-02 -0.002762009  0.002519342 -0.004117638
2005-11-03 -0.001153092  0.012707292 -0.005209409
2005-11-04 -0.003235750 -0.000702757 -0.001127165
2005-11-07  0.001310970  0.006205226 -0.001795839
2005-11-08  0.000539312  0.000329260  0.002103374

# DowJones30 is in fEcofin

> library(fEcofin)
> data(DowJones30)
> names(DowJones30)
[1] "X.Y..m..d" "AA"        "AXP"       "T"         "BA"        
"CAT"      [7] "C"         "KO"        "DD"        "EK"        
"XOM"       "GE"       [13] "GM"        "HWP"       "HD"        
"HON"       "INTC"      "IBM"      [19] "IP"        "JPM"       
"JNJ"       "MCD"       "MRK"       "MSFT"     [25] "MMM"       
"MO"        "PG"        "SBC"       "UTX"       "WMT"      [31] "DIS"     
> DowJones.ts = as.timeSeries(DowJones30)
> head(DowJones.ts[, c("CAT", "GE", "IBM", "JPM")])
GMT
           CAT   GE   IBM  JPM
1990-12-31 9.30 4.63 27.86 2.67
1991-01-02 9.30 4.63 27.86 2.67
1991-01-03 9.15 4.53 27.95 2.67
1991-01-04 9.00 4.47 27.86 2.69
1991-01-07 8.87 4.40 27.39 2.58
1991-01-08 9.05 4.44 27.08 2.58


seems to work, at least for me.


listDescription(fPortfolio)

fPortfolio Description:

 Package:            fPortfolio
 Version:            2100.78
 Revision:           4422
 Date:               2009-09-28
 Title:              Rmetrics - Portfolio Selection and Optimization
 Author:             Rmetrics Core Team, Diethelm Wuertz
 Depends:            R (>= 2.7.0), methods, MASS, quadprog, robustbase,
                       timeDate, timeSeries, fBasics, fAssets (>=
                       2100.78), Rglpk
 Suggests:           RUnit, tcltk
 Maintainer:         Rmetrics Core Team <Rmetrics-core at r-project.org>
 Description:        Environment for teaching "Financial Engineering
                       and Computational Finance"
 NOTE:               SEVERAL PARTS ARE STILL PRELIMINARY AND MAY BE
                       CHANGED IN THE FUTURE. THIS TYPICALLY INCLUDES
                       FUNCTION AND ARGUMENT NAMES, AS WELL AS DEFAULTS
                       FOR ARGUMENTS AND RETURN VALUES.
 LazyLoad:           yes
 LazyData:           yes
 License:            GPL (>= 2)
 URL:                http://www.rmetrics.org
 Packaged:           2009-09-28 12:27:30 UTC; yankee
 Repository:         CRAN
 Date/Publication:   2009-09-28 14:10:22
 Built:              R 2.9.2; ; 2010-01-17 17:15:20 UTC; windows


 > listDescription(fEcofin)

fEcofin Description:

 Package:       fEcofin
 Version:       2100.77
 Revision:      4033
 Date:          2009-04-15
 Title:         Economic and Financial Data Sets
 Author:        Diethelm Wuertz and many others. See the SOURCE file
 Depends:       R (>= 2.6.0), utils
 Suggests:      RUnit
 Maintainer:    Rmetrics Core Team <Rmetrics-core at r-project.org>
 Description:   Environment for teaching "Financial Engineering and
                  Computational Finance"
 NOTE:          SEVERAL PARTS ARE STILL PRELIMINARY AND MAY BE CHANGED
                  IN THE FUTURE. THIS TYPICALLY INCLUDES FUNCTION AND
                  ARGUMENT NAMES, AS WELL AS DEFAULTS FOR ARGUMENTS AND
                  RETURN VALUES.
 LazyLoad:      yes
 LazyData:      yes
 License:       GPL (>= 2)
 URL:           http://www.rmetrics.org
 Built:         R 2.9.1; ; 2009-09-24 05:44:53 UTC; windows



does this help?

If you have further questions do not hesitate to contact me.

Have you heard from the Rmetrics Meielisalp Workshop?
Register at: www.rmetrics.org

kind regards
Diethelm Wuertz



> ----------
> Mama Attiglah, PhD 
> Quantitative Strategist 
> Muli Asset Class Solution & 
> Liability Driven Investment 
> State Street Global Advisors 
> London Canary Whraf 
> +44(0)203 395  6290 (Direct Line)
> +44(0)7500794963 (BB)
> +44 (0)203 395 2968 (Direct Fax) 
> --------- 
> Authorised and regulated by the Financial Services Authority. 
> State Street Global Advisors Limited, a company registered in England
> with company number 2509928 
> and VAT number 5576591 81 and whose registered office is...{{dropped:18}}
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>
>
>



More information about the R-SIG-Finance mailing list