I am trying to solve this question but my result is wrong, anyone can help me?
regression predicting calories from saturated fat, fiber, and sugar. Based on standardized regression coefficients, identify the strongest predictor.
and at the end assign the unstandardized regression coefficient of the strongest predictor to a variable
Note: Identifying the strongest predictor in a regression predicting calories from saturated fat, fiber, and sugar
Here is my code:
a <- lm(calories ~ sat_fat + fiber + sugar, data = fastfood)
# standardize
a.beta <- lm.beta(a)
print(a.beta)
summary(a.beta)
coef(a.beta)
Result:
Coefficients:
Estimate Standardized Std. Error t value Pr(>|t|)
(Intercept) 75.0383 NA 35.9388 2.088 0.03850 *
sat_fat 44.4337 0.7073 2.9552 15.036 < 2e-16 ***
fiber 13.7060 0.1282 5.2472 2.612 0.00992 **
sugar 9.1996 0.2494 1.8230 5.047 1.29e-06 ***
The sat_fat result should be 30.84 but somehow I am getting this result! I am not sure what part of my code is wrong, anyone can help?