BUGs - timeSeries package and @Frequency slot

Daniele Amberti daniele.amberti at ors.it
Fri Oct 7 11:01:10 CEST 2011


Dear all,
below  a couple of bugs on package timeSeries 2130.92

I’d like to ask what you think about a slot @Frequency (optional) to better describe the timeSeries.
Think about time series models: in most cases you are supposed to have regularly spaced time series and being able to specify the frequency of the timeSeries object can provide an easy way to use appropriate functions like align()

Best regards,
Daniele Amberti


library(timeSeries)
data(MSFT)

MSFT1 <- window(MSFT, "2001-01-01", "2001-01-12")

# BUG 1
# alignDailySeries I suppose to be a shortcut to align
# but It is no usin align internally
# because of this we found that behavior is different with method 'fillNA':

alignDailySeries(MSFT1, method= "fillNA", include.weekends=TRUE)

align(MSFT1, by = "1d", offset = "0s",
      method = "fillNA",
      include.weekends = TRUE)

align(MSFT1, by = "1 d", offset = "0s",
      method = "fillNA",
      include.weekends = TRUE)

# and other methods seems to work:
alignDailySeries(MSFT1, method= "before", include.weekends=TRUE)

align(MSFT1, by = "1d", offset = "0s",
      method = "before",
      include.weekends = TRUE)

# we suggest to fix align and thenuse It in alignDailySeries


# BUG2
# internally at timeSeries:::.merge.timeSeries you are using this lines of code:
# data.frame(positions = tx, getDataPart(x), rec.x)
# data.frame(positions = ty, getDataPart(y), rec.y)
# if getDataPart return a non standard name for a data.frame
# e.g. start with a number # merge will have an unexpected behavior with no warning:

data1 <- 1:6
data2 <- data1 + 3
charvec1 <- paste("2009-0", 1:6, "-01", sep = "")
charvec2 <- paste("2009-0", 4:9, "-01", sep = "")

s1 <- timeSeries(data1, as.Date(charvec1), units = "s1")
s2 <- timeSeries(data2, as.Date(charvec2), units = "s2")

merge(s1, s2)

s2 <- timeSeries(data2, as.Date(charvec2), units = "2s")

merge(s1, s2)



________________________________

ORS Srl

Via Agostino Morando 1/3 12060 Roddi (Cn) - Italy
Tel. +39 0173 620211
Fax. +39 0173 620299 / +39 0173 433111
Web Site www.ors.it

------------------------------------------------------------------------------------------------------------------------
Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi allegati è vietato e potrebbe costituire reato.
Se lei avesse ricevuto erroneamente questo messaggio, Le saremmo grati se provvedesse alla distruzione dello stesso
e degli eventuali allegati.
Opinioni, conclusioni o altre informazioni riportate nella e-mail, che non siano relative alle attività e/o
alla missione aziendale di O.R.S. Srl si intendono non attribuibili alla società stessa, né la impegnano in alcun modo.


More information about the Rmetrics-core mailing list