Skip to content
Prev 2331 / 15274 Next

filter() on zoo objects

One comment (caution?) to add to Gabor's excellent points:

If you use the *timeSeries* class - be careful as to the conversion of
irregular series to regular.

as.ts.timeSeries converts what _may_ be an irregular series into a
_regular_ one by dropping the time altogether - much like the
ts(coredata(z)) approach outlined by Gabor.

While this may be what you want - it is not necessarily correct IMO.
In fact just the choice of class can lead to unintended consequences:

Please ignore the simplicity of the example:
Call:
arima(x = Cl(MSFT), order = c(2, 0, 0))

Coefficients:
         ar1     ar2  intercept
      0.8375  0.1437    30.1932
s.e.  0.0631  0.0633     1.0612

sigma^2 estimated as 0.2238:  log likelihood = -239.51,  aic = 487.01
Call:
arima(x = as.ts(coredata(Cl(MSFT))), order = c(2, 0, 0))

Coefficients:
         ar1     ar2  intercept
      0.9582  0.0190    30.1612
s.e.  0.0569  0.0569     1.0718

sigma^2 estimated as 0.2359:  log likelihood = -216.81,  aic = 441.62
[1] "MSFT"
Call:
arima(x = Cl(MSFT), order = c(2, 0, 0))

Coefficients:
         ar1     ar2  intercept
      0.9582  0.0190    30.1612
s.e.  0.0569  0.0569     1.0718

sigma^2 estimated as 0.2359:  log likelihood = -216.81,  aic = 441.62
To me, the timeSeries class is making a decision that is not
necessarily the intended one (in general) - and the results are
therefore possibly different than what you might expect.

Jeff

On Thu, Mar 27, 2008 at 12:06 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote: