hw5 - Stats3022 HW5 Yutong Gao 7.20 (b) > dat =

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

View Full Document Right Arrow Icon
Stats3022 Yutong Gao HW5 7.20 (b) > dat = read.csv("http://users.stat.umn.edu/~graalum/data/ch7/case0702.csv", header=T) > attach(dat) > m1<-lm(PH~TIME) > newdat<-data.frame(TIME=5) > predict(m1,newdat,interval="predict") fit lwr upr 1 5.953049 5.565463 6.340635 Therefore, 95%confidence prediction interval at 5 hours after slaughter is (5.565463,6.340635). (a) > (6.340635-5.565463)/2 [1] 0.387586 * df=8 t8(.975)=2.306 > 0.387586/2.306 [1] 0.1680772 Base on the calculations,CI= Y +/- 2.306*SE, we can find the SE of prediction for the prediction of pH at 5 hours after slaughter according to the prediction interval we've got which is 0.168. 7.23 > dat = read.csv("http://users.stat.umn.edu/~graalum/data/ch7/ex0723.csv", header=T) > attach(dat) > m1<-lm(INTERVAL~DURATION) > pred.lower <- predict(m1,interval="p")[,2] Warning message: In predict.lm(m1, interval = "p") : Predictions on current data refer to _future_ responses > pred.upper <- predict(m1,interval="p")[,3] Warning message: In predict.lm(m1, interval = "p") : Predictions on current data refer to _future_ responses > plot(INTERVAL~DURATION,main="With Prediction Interval")
Background image of page 1

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

View Full DocumentRight Arrow Icon
First, we need to get a scatterplot of the duration vs. Interval. > abline(m1,col=1,lty=1)
Background image of page 2
Then, we need to figure out the regression line in order to find the prediction band. > lines(lowess(pred.lower~DURATION),col=2,lty=2)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
>lines(lowess(pred.upper~DURATION),col=2,lty=2) Therefore, the prediction band is shown as area between the two red lines in the picture above. 7.26 (a) > dat = read.csv("http://users.stat.umn.edu/~graalum/data/ch7/ex0726.csv", header=T) > attach(dat) > plot(denmark~year) > m1<-lm(denmark~year) > abline(m1,col=1,lty=1) > summary(m1) Call: lm(formula = denmark ~ year)
Background image of page 5

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

View Full DocumentRight Arrow Icon
Residuals: Min 1Q Median 3Q Max -0.003225 -0.001339 0.000089 0.001119 0.003790 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 5.987e-01 4.080e-02 14.673 <2e-16 *** year -4.289e-05 2.069e-05 -2.073 0.0442 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.001803 on 43 degrees of freedom Multiple R-squared: 0.09083, Adjusted R-squared: 0.06968 F-statistic: 4.296 on 1 and 43 DF, p-value: 0.04424 > plot(netherlands~year) > m2<-lm(netherlands~year) > abline(m2,col=1,lty=1)
Background image of page 6
> summary(m2) Call: lm(formula = netherlands ~ year) Residuals: Min 1Q Median 3Q Max -0.0031437 -0.0008246 0.0002819 0.0009287 0.0021478 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.724e-01 2.792e-02 24.08 < 2e-16 *** year -8.084e-05 1.416e-05 -5.71 9.64e-07 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Background image of page 7

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

View Full DocumentRight Arrow Icon
Residual standard error: 0.001233 on 43 degrees of freedom Multiple R-squared: 0.4313, Adjusted R-squared: 0.418
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/28/2012 for the course ECON 111 taught by Professor Aaa during the Summer '11 term at UIBE.

Page1 / 18

hw5 - Stats3022 HW5 Yutong Gao 7.20 (b) > dat =

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

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