[R-SIG-Finance] PerformanceAnalytics: periodicity() function

Peter Carl peter at braverock.com
Tue Apr 26 17:16:00 CEST 2011


If we go by the documentation in ?periodicity, it looks like a bug:

"Possible scale values are:

‘minute’,‘hourly’, ‘daily’,‘weekly’, ‘monthly’,‘quarterly’, and ‘yearly’. "

Of course, I have a vested interest in it being Jeff's issue :).

pcc
-- 
Peter Carl
http://www.braverock.com/~peter

> Folks,
>
> The variable scale is initialised as "years" in the function
> periodicity(), whereas the usage for other periods is 'quarterly',
> 'monthly' etc. This causes chart.TimeSeries() to throw an error in the
>
> switch(freq$scale, ) code because that is looking for 'yearly', not
> 'years'.
>
> E.g.
>
>> x <- structure(c(0.000452526685891801, 0.000807277725566065,
>> -0.00263743291162857,
> 0.00565791169977606, 0.000493819538511648, 0.000231269431065556,
> 0.00255725013533005, -0.000576682024023798, 0.00890528425766388,
> 0.00172948824027563, 0.00586017066434493, 0.00033513487703795,
> 0.00281930488908796, -0.00400888331693709, -0.00336887385144884,
> -0.000525136255385699, -0.0064468192138384, 0.0064614590751907,
> -0.00111345878301972), .indexCLASS = c("POSIXt", "POSIXct"), .indexTZ =
> "", .CLASS = "xts", na.action = structure(c(736L,
> 1082L), class = "omit", index = c(1261699200, 1303772400)), index =
> structure(c(1176073200,
> 1178492400, 1188169200, 1198627200, 1206316800, 1209942000, 1219618800,
> 1230249600, 1239577200, 1241391600, 1251673200, 1261958400, 1270422000,
> 1272841200, 1283122800, 1293408000, 1293494400, 1294012800, 1303686000
> ), tzone = "", tclass = c("POSIXt", "POSIXct")), .Dim = c(19L,
> 1L), .Dimnames = list(NULL, "AHA"), class = c("xts", "zoo"))
>
>> chart.TimeSeries(x)
> Error in if (format == "") { : argument is of length zero
>
>> periodicity(x)$scale
> [1] "years"
>
> Is this a bug in periodicity()?
>
> I am using PerformanceAnalytics 1.0.3.2 and R 2.11.1
>
> Thanks,
> Murali
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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