-Please answer all part and provide r code The variables are x height of father
ID: 3201683 • Letter: #
Question
-Please answer all part and provide r code
The variables are x height of father and y height of corresponding son. The unit is centimetre (cm). For input into R, the data vectors for heights of fathers and corresponding heights of their sons are x-c(1 71.6, 170, 166.4, 173.5, 167.6, 174.5, 179.7, 170.9, 194.2, 1 73. 2, 17 6, 185.4, 179.2, 181.5, 168.5, 167.8, 171.6, 159.1, 170.8, 169.9, 170.6, 166.6, 179, 179, 170.8, 171.6, 171.9, 165.8, 171. 4, 174. 8, 1 79.5, 1 79. 3, 1 84.5, 16 1. 3, 1 64.2, 1 4, 185.1, 1 72.2, 171.4, 175.9, 167.9, 175.1, 174.1, 186.8, 174.9, 173.4, 178.5, 165. 7, 1 72.5, 167. 8, 177, 1 72. 8, 1 74.5, 16 8. 2, 155, 182.6, 180.2, 174.6, 173, 168.6, 171.1, 170.8, 186.1, 170.6, 167.8, 163.5, 165. 3, 18 1.2, 1 75.9, 175.5, 171, 183.5, 169.4, 178.8, 170.3, 174.8, 158.4, 174.6, 169.4, 168.1, 174.9, 165.4., 175, 168.9, 177.3, 182. 3, 178. 7, 177. 1, 169. 8, 1 74. 3, 1 70.2, 183.2, 172.6, 167.7, 171.1, 176.5, 185.3, 172.8, 170.7, 173.4, 172.3, 169, 164.9, 163.9, 179.3, 175.1, 180.1, 167.9, 166. 7, 177.7, 176.5, 169.9, 176. 4, 182. 1, 16 7. 8, 169 163.8, 174, 175.2, 160, 174.3, 180.2, 172.7, 178.8, 174.8, 184, 1 (69.5, 169, 1 81.9, 16 4. 4, 1 72. 9, 1 72. 9, 15 7. 4, 16 8. 2, 166.2, 159.5, 171.6, 173.3, 173.9, 163.6, 163.4, 169 187.1, 179. 7, 17 1, 187. 8, 171. 8, 1 77. 8, 17 1.9, 16 9.6, 1 68.9, 1 70, 1 70. 8, 1 79 3, 174.7, 161.5 159, 174.3, 182.2, 166.2, 166.1, 173.1, 164.1, 167.3, 166.5, 170. 3, 1 79. 2, 168. 4, 169. 2, 18 3.2, 1 78.5, 1 6.9, 1 1, 165.8, 169.4, 174.7, 173.6, 174.2, 172.6, 173.9 and y c (1 86.8, 177.7, 170, 169.3, 169.6, 177. 1, 186.2, 170.7, 182.2, 176.7, 174, 177. 7, 167.9, 1 72. 3, 1 1.4, 176.4, 172.9, 158.2, 173.2, 171.8, 162.4, 172.9, 180, 186.6, 174.1, 177.7, 1 (68. 1, 169. 3, 17 1.6, 177.2, 169. 8, 1 78. 7, 1 79.5, 1 68, 1, 160, 1 7. 3, 1 78. 4, 1 1.2, 162.9, 179.8, 167.9, 186.9, 172.8, 183.3, 168.9, 170.7, 183.5, 169. 3, 1 72.1, 174.4, 169, 181.8, 168.3, 169.2, 162.8, 179.8, 171.5, 170.1, 169.6, 175.9, 180, 165.5, 177.1, 175.9, 168.4, 163. 1, 177.4, 169. 3, 180.4, 17 3.5, 178, 166.8, 174, 171.7, 181.1, 191, 159.9, 174.5, 169, 175.8, 178.8, 173.9, 174.3, 173, 178.2, 184.8, 183.5, 173. 8, 169. 6, 1 70. 1, 1 75. 2, 175.7, 179.6, 171.9, 180.2, 174, 188.8, 172.6, 163.9, 178.2, 168.2, 169.6, 169.2, 168.5, 184. 1, 180.5, 185.4, 167. 7, 168. 1, 174. 3, 169.9, 1 76. 6, 1 79. 3, 1 90.5, 1 82.5, 1 7.4, 1 1, 1 4.6, 181, 176, 178.6, 181.8, 181.2, 179.9, 181.7, 184.3, 183.4, 183.9, 169.6, 172.5, 176. 1, 1 72. 2, 171.8, 163.7, 176.2, 178.4, 168.9, 173.6, 178.8, 171, 170.1, 164 169.9, 179.7, 173. 3, 187.7, 166.8, 176. 1, 169.5, 165.5, 1 76. 8, 17 8.5, 1 74 7, 178.3, 174.7, 171.5, 172.1 179.1, 171.1, 163.6, 176.3, 182.6, 165, 182.6, 17 1.2, 168.3, 166.9, 181.9, 177.6, 177.6, 178.5, 175.2, 178.4, 171, 165.4, 179.3, 1 74.6, 179.4, 169.5, 176.6) For the questions below, use 3 decimal places. Part a The summary statistics (sample means of x and y, SDs of x and y, correlation coefficient:Explanation / Answer
Rcode:
> df<-data.frame(cbind(x,y))
> #a
> mean(x);mean(y)
[1] 172.7156
[1] 174.5506
> sd(x);sd(y)
[1] 6.529579
[1] 6.338051
> cor(x,y)
[1] 0.4456968
> #b
> model<-lm(y~x,data=df)
> summary(model)
Call:
lm(formula = y ~ x, data = df)
Residuals:
Min 1Q Median 3Q Max
-12.4162 -4.0396 -0.4506 3.9191 15.5477
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 99.82975 11.25674 8.868 0.000000000000000765 ***
x 0.43262 0.06513 6.643 0.000000000361597055 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.69 on 178 degrees of freedom
Multiple R-squared: 0.1986, Adjusted R-squared: 0.1941
F-statistic: 44.12 on 1 and 178 DF, p-value: 0.0000000003616
> #c
> predict(model,data.frame(x=c(182)),interval = "confidence")
fit lwr upr
1 178.5672 177.1097 180.0247
> abs((180.0247-178.5672)/qt(0.025,178))
[1] 0.7385802
> #d
> df1<-subset(df,x<184.51)
> df2<-subset(df1,x>179.5)
> mean(df2$y)+(((c(2,-2)*sd(y))/sqrt(dim(df2)[1])))
[1] 181.0685 174.9197
> #e
> #based on more observations.
Answer:
a)
mean of x :172.7156
mean of y:174.5506
sd of x:6.529579
sd of y:6.338051
cor(x,y):0.4456968
b)
b0:99.82975
b1:0.43262
c)
The estimated subpopulation mean is : 178.5672
The standard error for this estimate is :0.7385802
The t critical value for the 95% confidence interval is : 1.97
LCL:177.1097
UCL:180.0247
d)
LCL:174.9197
UCL:181.0685
e)
Observations.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.