### Analyze length on age for smallmouth bass in a northeastern MN lkae smbass=read.table("http://www.stat.umn.edu/alr/data/wblake.txt",header=TRUE) names(smbass) [1] "Age" "Length" "Scale" attach(smbass) ### construct scatter plot with regression line plot(Length~Age) regmod=lm(Length~Age) abline(coef(regmod)) ## inspect coefficients summary(regmod) Call: lm(formula = Length ~ Age) Residuals: Min 1Q Median 3Q Max -85.794 -19.499 -4.499 16.177 94.853 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 65.5272 3.1974 20.49 <2e-16 *** Age 30.3239 0.6877 44.09 <2e-16 *** --- Residual standard error: 28.65 on 437 degrees of freedom Multiple R-squared: 0.8165, Adjusted R-squared: 0.8161 F-statistic: 1944 on 1 and 437 DF, p-value: < 2.2e-16 ### find 95% confidence and prediction intervals for ### length when age=4.5 x=data.frame(Age=4.5) predict(regmod,x) [1] 201.9847 predict(regmod,x,interval="confidence") fit lwr upr [1,] 201.9847 199.2677 204.7016 predict(regmod,x,interval="prediction") fit lwr upr [1,] 201.9847 145.6184 258.3509