Can someone help me with my stat lab? We use Rstudio Complete parts 1, 2 and 3 b
ID: 3358928 • Letter: C
Question
Can someone help me with my stat lab? We use Rstudio
Complete parts 1, 2 and 3 below using the father-son heights data set http: //personal.psu.edu/acq/401/Data/FatherSonHeights.txt: 1. 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 2. 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. 3. You 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
First of all I assume that you have not created your dataset in R. So, I am starting from scratch. Follow the exact steps to get the output.
1)
Create the variable F_H and S_H for the father's height and the son's height respectively using the following code -
> S_H <- c(73.5,70,77.5,74.4,74.5,73,75.5,74.5,69,65.3,68,75,70.5,70,75.5,76.4,64,72,62.2,68,69,67.3,69,72.4,74,62.2,72,73.5,64.2,71)
> F_H <- c(73,71,76,78,77,71,77,74,69,65,68,72,74,72,75,79,63,71,61,67,66,64,68,68,72,62,70,76,62,67)
----------
Now, we need 80% PI for the son's height data. So, use the code -
t.test(S_H, conf.level = 0.8)
This will give you the output which has the 80% interval as (69.7656, 71.7944)
--------------------
2) a)
Use the following to get the simple linear regression model -
model <- lm(S_H ~ F_H)
Now, to get confidence interval of slope, use -
confint(model, 'F_H', level = 0.9)
------------------------------
b)
To get the confidence interval for son's height when father's height is 6ft is -
new.dat <- data.frame(F_H = 72)
predict(model, newdata = new.dat, interval = 'confidence', level = 0.9)
-----------------------------------
For the slope, your interval would be - (0.6454393, 0.8639308)
and the confidence interval of new predicted value would be - (71.50662, 72.66963)
______________________
__________________________________
3)
For the predicted interval, use the code -
predict(model, newdata = new.dat, interval = 'prediction', level = 0.9)
And the output would be - (69.02106, 75.15518)