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

From: Pfaff, Bernhard <>
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:

test <- summary(stl(nottem,
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?


> 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
> e in particolare la sezione su Palese mailing list PLEASE do read the posting guide!

The information contained herein is confidential and is inte...{{dropped}} mailing list PLEASE do read the posting guide! 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