Rforch08 - R Material for Chapter 08 > attach(concent.data...

This preview shows pages 1–2. Sign up to view the full content.

R Material for Chapter 08 > attach(concent.data) > concent.data time concent 1 6 0.0290 2 6 0.0350 3 6 0.0220 4 8 0.0790 5 8 0.0650 6 8 0.0880 7 10 0.1810 8 10 0.1620 9 10 0.2040 10 12 0.4250 11 12 0.3820 12 12 0.4720 13 14 1.1630 14 14 1.0810 15 14 1.2450 16 16 2.8420 17 16 2.4680 18 16 3.0997 > mtime <- mean(time) > mtime [1] 11 > ctime <- time - mtime ## centering the variable time at its mean > ctime [1] -5 -5 -5 -3 -3 -3 -1 -1 -1 1 1 1 3 3 3 5 5 5 > sqctime <- ctime*ctime > cuctime <- ctime*sqctime > fctime <- sqctime*sqctime > reg1 <- lm(concent ~ time) ## simple linear model of time alone > summary(reg1) Call: lm(formula = concent ~ time) Residuals: Min 1Q Median 3Q Max -0.6463 -0.3679 -0.1251 0.4738 1.0786 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.95002 0.42739 -4.563 0.000319 *** time 0.24820 0.03711 6.689 5.2e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.5377 on 16 degrees of freedom Multiple R-squared: 0.7366, Adjusted R-squared: 0.7201 F-statistic: 44.74 on 1 and 16 DF, p-value: 5.203e-06 > reg2 <- lm(concent ~ ctime + sqctime) ## model using centered time and square of ## centered time

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 4

Rforch08 - R Material for Chapter 08 > attach(concent.data...

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

View Full Document
Ask a homework question - tutors are online