Regression Homework Solutions - PowerPoint PPT Presentation

About This Presentation
Title:

Regression Homework Solutions

Description:

EPP 245 Statistical Analysis of Laboratory Data. 3. October 27, 2004 ... [5] 'aliased' 'sigma' 'df' 'r.squared' [9] 'adj.r.squared' 'fstatistic' 'cov.unscaled' ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 20
Provided by: davidm133
Category:

less

Transcript and Presenter's Notes

Title: Regression Homework Solutions


1
Regression Homework Solutions
  • EPP 245/298
  • Statistical Analysis of
  • Laboratory Data

2
Exercise 5.1
gt library(ISwR) gt data(rmr) gt attach(rmr) gt
names(rmr) 1 "body.weight"
"metabolic.rate" gt plot(body.weight,metabolic.rate
) gt rmr.lm lt- lm(metabolic.rate body.weight) gt
abline(coef(rmr.lm),col"red",lwd2)
3
(No Transcript)
4
gt coef(rmr.lm) (Intercept) body.weight
811.226674 7.059528 gt 811.226674
7.05952870 1 1305.394 gt sum(coef(rmr.lm)c(1,70
)) 1 1305.394 gt predict(rmr.lm,data.frame(body.w
eight70)) 1 1305.394
5
gt summary(rmr.lm) Call lm(formula
metabolic.rate body.weight) Residuals Min
1Q Median 3Q Max -245.74 -113.99
-32.05 104.96 484.81 Coefficients
Estimate Std. Error t value Pr(gtt)
(Intercept) 811.2267 76.9755 10.539 2.29e-13
body.weight 7.0595 0.9776 7.221
7.03e-09 --- Signif. codes 0 ' 0.001
' 0.01 ' 0.05 .' 0.1 ' 1 Residual
standard error 157.9 on 42 degrees of
freedom Multiple R-Squared 0.5539, Adjusted
R-squared 0.5433 F-statistic 52.15 on 1 and 42
DF, p-value 7.025e-09
6
Coefficients Estimate Std. Error t
value Pr(gtt) (Intercept) 811.2267
76.9755 10.539 2.29e-13 body.weight 7.0595
0.9776 7.221 7.03e-09 gt 7.0595 -
1.960.9776 1 5.143404 gt 7.0595
1.960.9776 1 8.975596 gt tmp lt-
summary(rmr.lm) gt names(tmp) 1 "call"
"terms" "residuals" "coefficients"
5 "aliased" "sigma" "df"
"r.squared" 9 "adj.r.squared"
"fstatistic" "cov.unscaled" gt tmpcoef
Estimate Std. Error t value
Pr(gtt) (Intercept) 811.226674 76.9755034
10.53876 2.288384e-13 body.weight 7.059528
0.9775978 7.22130 7.025380e-09 gt
class(tmpcoef) 1 "matrix" gt dim(tmpcoef) 1
2 4
7
Coefficients Estimate Std. Error t
value Pr(gtt) (Intercept) 811.2267
76.9755 10.539 2.29e-13 body.weight 7.0595
0.9776 7.221 7.03e-09 gt 7.0595 -
1.960.9776 1 5.143404 gt 7.0595
1.960.9776 1 8.975596 gt tmpcoef2,1 -
1.96tmpcoef2,2 1 5.143436 gt tmpcoef2,1
1.96tmpcoef2,2 1 8.97562
8
Exercise 5.2
gt data(juul) gt names(juul) 1 "age"
"menarche" "sex" "igf1" "tanner"
"testvol" gt attach(juul) gt juul.lm lt-
lm(sqrt(igf1) age, sub(agegt25)) gt
summary(juul.lm) Call lm(formula sqrt(igf1)
age, subset (age gt 25)) Residuals Min
1Q Median 3Q Max -4.8642 -1.1661
0.1018 0.9450 4.1136 Coefficients
Estimate Std. Error t value Pr(gtt)
(Intercept) 18.71025 0.49462 37.828 lt2e-16
age -0.10533 0.01072 -9.829
lt2e-16 --- Signif. codes 0 ' 0.001 '
0.01 ' 0.05 .' 0.1 ' 1 Residual standard
error 1.741 on 120 degrees of freedom Multiple
R-Squared 0.446, Adjusted R-squared 0.4414
F-statistic 96.6 on 1 and 120 DF, p-value lt
2.2e-16
9
(No Transcript)
10
  • gt plot(age,igf1)
  • gt plot(ageagegt25,igf1agegt25)
  • gt abline(coef(lm(igf1 age,sub(agegt25))),col"re
    d",lwd2)
  • gt plot(ageagegt25,sqrt(igf1)agegt25)
  • gt abline(coef(juul.lm),col"red",lwd2)

11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
gt data(malaria)gt gt names(malaria) 1 "subject"
"age" "ab" "mal" gt attach(malaria) gt
hist(ab) gt hist(log(ab)) gt plot(age,log(ab)) gt
summary(lm(log(ab) age)) Coefficients
Estimate Std. Error t value Pr(gtt)
(Intercept) 3.83697 0.38021 10.092 lt2e-16
age 0.10350 0.03954 2.618
0.0103 --- Signif. codes 0 ' 0.001 '
0.01 ' 0.05 .' 0.1 ' 1 Residual standard
error 1.478 on 98 degrees of freedom Multiple
R-Squared 0.06536, Adjusted R-squared
0.05582 F-statistic 6.853 on 1 and 98 DF,
p-value 0.01025
Exercise 5.3
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com