Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use R-studios (AND ONLY R-STUDIO) and i also need a step by step of how y

ID: 3320729 • Letter: P

Question


Please use R-studios (AND ONLY R-STUDIO) and i also need a step by step of how you got the answer. The following data are for intelligence-test (IT) scores, reading rates (RR), and grade-point averages (GPA) of 8 at-risk students. IT 184 202 202 167 202 210 199 181 RR 34 30 42 34 22 45 22 25 GPA||2.4 | 1.812.012.3] 1.813.1 || 1.7[20 Part a: Calculate the line of best fit that predicts the GPA on the basis of RR scores. Part b: Calculate the line of best fit that predicts the GPA on the basis of IT scores. Part c: Which of the two lines calculated in parts a and b best fits the data? Justify your answer.

Explanation / Answer

> IT=c(184,202,202,167,202,210,199,181)
> RR=c(34,30,42,34,22,45,22,25)
> GPA=c(2.4,1.8,2.9,2.3,1.8,3.1,1.7,2.0)
> ##(a)
> fit1=lm(GPA~IT)
> fit1

Call:
lm(formula = GPA ~ IT)

Coefficients:
(Intercept) IT  
1.031423 0.006302  

> summary(fit1)

Call:
lm(formula = GPA ~ IT)

Residuals:
Min 1Q Median 3Q Max
-0.58545 -0.50435 0.01853 0.31107 0.74524

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.031423 2.833475 0.364 0.728
IT 0.006302 0.014617 0.431 0.681

Residual standard error: 0.56 on 6 degrees of freedom
Multiple R-squared: 0.03005, Adjusted R-squared: -0.1316
F-statistic: 0.1859 on 1 and 6 DF, p-value: 0.6814

> anova(fit1)
Analysis of Variance Table

Response: GPA
Df Sum Sq Mean Sq F value Pr(>F)
IT 1 0.05829 0.05829 0.1859 0.6814
Residuals 6 1.88171 0.31362
> ##(b)
> fit2=lm(GPA~RR)
> fit2

Call:
lm(formula = GPA ~ RR)

Coefficients:
(Intercept) RR  
0.41516 0.05779  

> summary(fit2)

Call:
lm(formula = GPA ~ RR)

Residuals:
Min 1Q Median 3Q Max
-0.34887 -0.00992 0.03881 0.09157 0.14008

Coefficients:
Estimate Std. Error t value Pr(>|t|)   
(Intercept) 0.41516 0.24089 1.723 0.135583   
RR 0.05779 0.00735 7.863 0.000224 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.1691 on 6 degrees of freedom
Multiple R-squared: 0.9115, Adjusted R-squared: 0.8968
F-statistic: 61.83 on 1 and 6 DF, p-value: 0.0002239

> anova(fit2)
Analysis of Variance Table

Response: GPA
Df Sum Sq Mean Sq F value Pr(>F)   
RR 1 1.76839 1.7684 61.826 0.0002239 ***
Residuals 6 0.17161 0.0286   
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

##(c)

For model 1 R^2 is 0.03005 and for model 2 is 0.9115 which is greater than model 1 ,so model 2 is best fit.