This preview shows page 1. Sign up to view the full content.
R for Chapter 4
Running List of Functions Applied to the Data Set, data.class:
>
attach(data.class)
> reg < 
lm(weight ~ height)
>summary(reg)
##
Suppose we want to find three confidence intervals for the average weight at heights
##
height = 60, 65 and 70 inches, respectively.
Moreover, we want these intervals to simultaneously
##
contain their means with a probability of at least .88.
> predict(reg,newdata=data.frame(height=c(60,65,70)),se.fit=TRUE, interval="confidence", pred.var=TRUE,level=.96)
##
Suppose now we want to predict the weight of three individuals at heights
##
height = 60, 65 and 70 inches, respectively.
Moreover, we want these three prediction intervals
##
to simultaneously contain their weights with a probability of at least .88.
> predict(reg,newdata=data.frame(height=c(60,65,70)),se.fit=TRUE, interval="predict", pred.var=TRUE,level=.96)
## We now seek to graph 95% confidence intervals and prediction intervals
##
over the range of possible X values, forming bands around the fitted line.
##
This is NOT a band that covers all possible X values simultaneously with probability .95
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 12/10/2011 for the course STAT 4210 taught by Professor Randles during the Fall '11 term at University of Florida.
 Fall '11
 Randles
 Regression Analysis

Click to edit the document details