This passage will introduce an example of time series regression analysis.
the series
The data shown below are extracted series from a study by Shumway et al.(1988) of the possible effects of temperature and pollution on weekly mortality in Los Angeles County.
library("astsa")
par(mfrow=c(3,1))
tsplot(cmort, main="Cardiovascular Mortality", ylab="")
tsplot(tempr, main="Temperature", ylab="")
tsplot(part, main="Particulates", ylab="")
There are strong seasonal components in all of the series, corresponding to winter-summer variations and the downward trend of the cardiovascular morality over the 10-year period.
scatterplot matrix
I will display a scatterplot matrix by R to explore the relation between morality and the pollutant particulates and a possible relation to temperature.
ts.plot(cmort,tempr,part,col=1:3)
legend("topright",legend=c("Mortality","Temperature","Pollution"),lty=1,col=1:3)
pairs(cbind(Mortality=cmort, Temperature=tempr, Particulates=part))
A scatterplot matrix shown below indicates a possible linear relation.
The lineplot shown above indicates that higher temperatures as well as lower temperatures are associated with increases in cardiovascular mortality.
model
Based on the scatterplot matrix, we entertain a model where M t M_t Mt denotes mortality, T t T_t Tt denotes temperature, P t P_t Pt denotes the particulate levels, T . T. T. denotes the mean of temperatures to avoid collinearity problems.
M t = β 0 + β 1 t + β 2 ( T t − T . ) + β 3 ( T t − T . ) 2 + β 4 P t + w t M_t = \beta_0 + \beta_1t + \beta_2(T_t-T.) + \beta_3(T_t-T.)^2+\beta_4P_t+w_t Mt=β0+β1t+β2(Tt−T.)+β3(Tt−T.)2+β4Pt+wt
Next, I will fit the regression model using the code below.
temp = tempr-mean(tempr)
temp2 = temp^2
trend = time(cmort)
fit = lm(cmort~ trend + temp + temp2 + part, na.action=NULL)
summary(aov(lm(cmort~ cbind(trend, temp, temp2, part))))
Output:
These results will be summarized in an ANOVA table as given below.
AIC、AICc、BIC
num = length(cmort)
AIC(fit)/num - log(2*pi)
BIC(fit)/num - log(2*pi)
AICc = log(sum(resid(fit)^2)/num + (num+5)/(num-5-2))
AICc
Output:
[1] 4.721732
[1] 4.771699
[1] 3.723158
Now, we have computed the corresponding values of AIC, AICc and BIC.