Find the answers by using R studio commands Complete parts 1, 2 and 3 below usin
ID: 3359133 • Letter: F
Question
Find the answers by using R studio commands
Complete parts 1, 2 and 3 below using the father-son heights data set http: //personal.psu.edu/acq/401/Data/FatherSonHeights.txt:
-An old friend, whom you have not seen since fourth grade, contacts you through Facebook. Some time after that you decide to meet in person but you have no idea how tall he turned out to be. Using the sons’ heights data construct an 80% PI for your friend’s height.
-Fit the simple linear regression model for predicting a son’s height from his father’s height, and construct 90% CIs for a) the slope and b) the average height of sons corresponding to 6ft tall fathers.
Y-ou remember that the father of your fourth grade friend, whom you are going to meet, was 6ft tall. Give an updated 80% PI for your friend’s height.
Explanation / Answer
1) For the first problem, we would need to get the 80% interval for the Son_height variable based on the heights of 30 samples. As we have only the sample's standard deviation, we need to run the t-test to get the 80% PI for friend's height:
R-Code & Results:
#Reading the text file into a data frame
fsheight<-read.csv('fsheight.csv')
#running t test for 80%
library(stats)
print(t.test(fsheight$S_H,conf.level = 0.8)$conf.int)
#PI for student height is (69.7656,71.7944)
2) Linear regression to predict Son's height from Father's height:
#Lin Regression of Son Height using Father Height
sonhtlin<-lm(S_H~F_H,data=fsheight)
summary(sonhtlin)
The Regression equation is Son_Height = 17.7508 + (0.75469*Father_Height) with both being significant.
90% CI for Slope & Avg height of sons corresponding to 6 ft. (72'') father:
#Confidence Interval at 90% level
confint(sonhtlin,level=.9)
5 % 95 %
(Intercept) 10.055 25.447
F_H 0.645 0.864
So, the 90% confidence interval for slope is (0.645, 0.864)
90% confidence interval for son_height where father is 72'' tall is: (10.055+(0.645*72), 25.447+(0.864*72)) = (56.526,87.650)
3) Predicting 80% PI for height of friend to be met whose father is 6 ft tall:
R Code:
#Bringing 6 ft father data as a new point for predicting son's height
newpoint<-data.frame("F_H"=72)
#Predicting so's height at 80% level
shpred<-predict.lm(sonhtlin,newdata=newpoint,level=.8,interval="prediction")
print(shpred)
fit lwr upr
72.088 69.722 74.455
Shows that the 80% PI for friend's height is (69.722, 74.455)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.