Workshop 8.3a: Non-independence part 1 Murray Logan 28 May 2015
Section 1 Linear modelling assumptions
Linear modelling assumptions y i = β 0 + β 1 × x i + ε i ϵ i ∼ N (0 , σ 2 ) Homogeneity of variance σ 2 . 0 0 ··· . . σ 2 0 . ··· σ 2 ) y i = β 0 + β 1 × x i + ε i ε i ∼ N ( 0 , . V = cov = . . . . . σ 2 � �� � � �� � . . ··· Linearity Normality σ 2 0 . ··· ··· Zero covariance (=independence) . . .
Variance-covariance σ 2 0 · · · 0 . . σ 2 0 · · · . V = . . . . σ 2 · · · . . σ 2 0 · · · · · · � �� � Variance-covariance matrix
Compound symmetry • constant correlation (and cov) • sphericity 1 · · · ρ ρ . . 1 · · · ρ . cor ( ε ) = . . · · · 1 . ... ρ · · · · · · 1 � �� � Correlation matrix θ + σ 2 · · · θ θ . . θ + σ 2 · · · θ . V = . . . . θ + σ 2 · · · . . θ + σ 2 · · · · · · θ � �� � Variance-covariance matrix
Temporal autocorrelation • correlation dependent on proximity • data.t 0 20 40 60 80 100 30 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 20 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● y ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 100 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 80 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 60 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● x ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 40 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 20 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 2010 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● 2005 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● year ● ● ● ● ● 2000 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● 1995 ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1990 ● ● ● ● ● ● ● ● ● ● ● ● 0 10 20 30 1990 1995 2000 2005 2010
> data.t.lm <- lm (y~x, data=data.t) Temporal autocorrelation • Relationship between Y and X . . > par (mfrow= c (2,3)) > plot (data.t.lm, which=1:6, ask=FALSE) Residuals vs Fitted Normal Q−Q Scale−Location 96 ● 20 Standardized residuals 6 ● 21 Standardized residuals 2 ● ● ● ● 6 ● 21 6 ● 21 ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1.2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ● ● ● ● ● ● ● 10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1 ● ● ● ● ● ● ● ● Residuals ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.8 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.4 ● ● ● ● ● ● ● ● ● ● ● ● ● −1 ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● −20 ● ● ● ● ● ● 96 ● −2 ● 0.0 ● ● 96 9.5 10.5 11.5 12.5 −2 −1 0 1 2 9.5 10.5 11.5 12.5 Fitted values Theoretical Quantiles Fitted values Cook's dist vs Leverage h ii ( 1 − Cook's distance Residuals vs Leverage 0.06 2.5 2 1.5 96 ● 96 7 7 ● Standardized residuals 2 ● 6 ● ● ● 7 ● ● ● 6 6 ● ● ● ● Cook's distance ● ● ● Cook's distance ● ● ● ● 0.04 ● 1 0.04 1 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● 0.02 ● 0.02 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● −1 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.5 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● −2 ● ● ● Cook's distance ● ● ● ● ● ● ● ● ● 0.00 ● 0.00 ● ● ● 96 ●● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● 0
> acf ( rstandard (data.t.lm)) Temporal autocorrelation • Relationship between Y and X . . Series rstandard(data.t.lm) 1.0 0.8 0.6 ACF 0.4 0.2 0.0 −0.2 0 5 10 15 20 Lag
> plot ( rstandard (data.t.lm)~data.t$year) Temporal autocorrelation • can we partial out time . . 2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 1 ● ● ● ● ● ● ● ● ● ● rstandard(data.t.lm) ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● −1 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● −2 ● 1990 1995 2000 2005 2010 data.t$year
x > library (car) year 1.040037 1.040037 > data.t.lm1 <- lm (y~x+year, data.t) Temporal autocorrelation • can we partial out time . . > vif ( lm (y~x+year, data=data.t)) . .
Recommend
More recommend