Rforch12 - R Material for Chapter 12 > attach(binjuries.data > binjuries.data year injuries 1 1 5696 2 2 5110 3 3 4731 4 4 4585 5 5 4476 6 6 4970 7

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
R Material for Chapter 12 > attach(binjuries.data) > binjuries.data ## Bicycle Injury Data year injuries 1 1 5696 2 2 5110 3 3 4731 4 4 4585 5 5 4476 6 6 4970 7 7 4991 8 8 4820 9 9 4515 10 10 4227 > reg <- lm(injuries~year) > summary(reg) Call: lm(formula = injuries ~ year) Residuals: Min 1Q Median 3Q Max -382.2 -276.3 0.4 230.0 468.6 Coefficients: Estimate Std. Error t value Pr(>|t|) ## Usual LS Fit (Intercept) 5319.73 219.50 24.236 8.96e-09 *** year -92.30 35.38 -2.609 0.0312 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 321.3 on 8 degrees of freedom Multiple R-squared: 0.4597, Adjusted R-squared: 0.3922 F-statistic: 6.807 on 1 and 8 DF, p-value: 0.03118 >library(car) ## Library required for Durbin-Watson Test > dwt(reg) ## Durbin-Watson Test lag Autocorrelation D-W Statistic p-value 1 0.380236 0.9388191 0.024 Alternative hypothesis: rho != 0 > diff1 <- rep(0,9) > for(i in 1:9) {diff1[i] <- injuries[i+1]-.380236*injuries[i]} > diff1 [1] 2944.176 2787.994 2786.103 2732.618 3268.064 3101.227 2922.242 2682.262 [9] 2510.234 > index1 <- rep(0,9) > for(i in 1:9) {index1[i] <- year[i+1]-.380236*year[i]} > index1 [1] 1.619764 2.239528 2.859292 3.479056 4.098820 4.718584 5.338348 5.958112 [9] 6.577876
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
> reg2 <- lm(diff1~index1) > summary(reg2) Call: lm(formula = diff1 ~ index1) Residuals: Min 1Q Median 3Q Max -255.1 -142.0 -106.6 109.9 408.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3015.08 214.46 14.059 2.18e-06 *** index1 -37.97 48.74 -0.779 0.461 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 234 on 7 degrees of freedom Multiple R-squared: 0.0798, Adjusted R-squared: -0.05166 F-statistic: 0.607 on 1 and 7 DF,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/08/2011 for the course STA 4211 taught by Professor Randles during the Spring '08 term at University of Florida.

Page1 / 6

Rforch12 - R Material for Chapter 12 > attach(binjuries.data > binjuries.data year injuries 1 1 5696 2 2 5110 3 3 4731 4 4 4585 5 5 4476 6 6 4970 7

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online