# Rforch4 - R for Chapter 4 Running List of Functions Applied...

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, class.data: > attach(class.data) > reg < - lm(wt ~ ht) >summary(reg) ## Suppose we want to find three confidence intervals for the average wt at heights ## ht = 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(ht=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 ## ht = 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(ht=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 the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online