RE: [R] Testing autocorrelation & heteroskedasticity of residuals in ts

From: Pfaff, Bernhard <Bernhard.Pfaff_at_drkw.com>
Date: Wed 21 Jul 2004 - 18:28:41 EST


>
> Hi,
>
> I'm dealing with time series. I usually use stl() to
> estimate trend, stagionality and residuals. I test for
> normality of residuals using shapiro.test(), but I
> can't test for autocorrelation and heteroskedasticity.
> Is there a way to perform Durbin-Watson test and
> Breusch-Pagan test (or other simalar tests) for time
> series?
> I find dwtest() and bptest() in the package lmtest,

Hello Vito,

how about:

library(lmtest)
data(nottem)
test <- summary(stl(nottem, s.win=4))
bptest(formula(nottem ~ -1 + test$time.series[,1] + test$time.series[,2])) dwtest(formula(nottem ~ -1 + test$time.series[,1] + test$time.series[,2]))

i.e. you define the residuals by providing the residuals as formula. Note:
testres <- nottem-test$time.series[,1]-test$time.series[,2] cbind(testres, test$time.series[,3])

Anyway, are these tests applicable to stl as far as the underlying assumptions for the error term is concerned?

Bernhard

> but it requieres an lm object, while I've a ts object.
> Any help will be appreciated.
> Best
> Vito
>
> =====
> Diventare costruttori di soluzioni
>
> Visitate il portale http://www.modugno.it/
> e in particolare la sezione su Palese
http://www.modugno.it/archivio/cat_palese.shtml



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

The information contained herein is confidential and is inte...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 21 18:37:04 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:37:24 EST