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

Need it in R studio code please. In a study of cheddar cheese from the LaTrobe V

ID: 2949390 • Letter: N

Question

Need it in R studio code please.

In a study of cheddar cheese from the LaTrobe Valley of Victoria, Australia, samples of cheese were analyzed for their chemical composition and were subjected to taste tests. Overall taste scores were obtained by combining the scores from several tasters. This data is contained in the cheddar dataset from the Faraway package in R. Let the outcome be taste, the score of the corresponding taste test, and let Acetic, H2S, and Lactic be the three predictors. (a) Use an F test to determine if at least one of the predictors is significantly different from zero. (b) Remove all predictors that are not significant at ? 0.05. Compare that sub model to the full model using an F-test, which model is preferred? (c) Using the full model, construct a 90% bootstrap confidence interval for H25.

Explanation / Answer

SolutionA:

Rcode is

library(faraway)

glimpse(cheddar)

rmod1 <- lm(taste~.,data=cheddar)
summary(rmod1)

Output:

Call:

lm(formula = taste ~ ., data = cheddar)

Residuals:

Min 1Q Median 3Q Max

-17.390 -6.612 -1.009 4.908 25.449

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) -28.8768 19.7354 -1.463 0.15540

Acetic 0.3277 4.4598 0.073 0.94198

H2S 3.9118 1.2484 3.133 0.00425 **

Lactic 19.6705 8.6291 2.280 0.03108 *

---

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 10.13 on 26 degrees of freedom

Multiple R-squared: 0.6518, Adjusted R-squared: 0.6116

F-statistic: 16.22 on 3 and 26 DF, p-value: 3.81e-06

F=16.22

p=3.81*10^-6

p<0.05

Model is significant

REGRESSION EQ IS

(Intercept) Acetic H2S Lactic
-28.8767696 0.3277413 3.9118411 19.6705434

taset=-28.8767696+0.3277413*acetic+3.9118411H2S+19.67054348lactic

SolutionB:

ACETIC is not significant as p= 0.94198 p>0.05

H2S and lactic are significant variables

Rsq=0.6518

Adj R sq=0.6116

Residual stderrror=10.13

Now remove ACETIC ad buid model.

RCODE


rmod2 <- lm(taste~H2S+Lactic,data=cheddar)
summary(rmod2)

output:

Estimate Std. Error t value Pr(>|t|)
(Intercept) -27.592 8.982 -3.072 0.00481 **
H2S 3.946 1.136 3.475 0.00174 **
Lactic 19.887 7.959 2.499 0.01885 *

All are significant variables

p<0.05

R sq=0.6517

Adj Rsq=0.6259

Residual std errror=9.942

Use sub model

(Intercept) H2S Lactic
-27.591815 3.946267 19.887204


taste=-27.591815+3.946267*H2S+19.887204*lactic

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote