[R] Testing autocorrelation & heteroskedasticity of residuals in ts

Pfaff, Bernhard Bernhard.Pfaff at drkw.com
Wed Jul 21 10:28:41 CEST 2004

> 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:

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. 
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?


> 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 

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

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

More information about the R-help mailing list