# Kaggle cereal data set - Rating seems to be a function of other predictors?

I'm doing a project in linear regression and I found the Kaggle cereal data set:

https://www.kaggle.com/crawford/80-cereals

I did some regressions and, unless I made a big mistake somewhere, it looks like the rating field is a function of a few other predictors. Here is the regression equation I came up with. Notice that all of the predictors have very low p-values and the R^2 is close enough to 1 that R just shows 1. Is this an indicator that the rating is just a function of these other predictors?

##
## Call:
## lm(formula = rating ~ calories + carbo + fat + fiber + potass +
##     protein + sodium + sugars + vitamins, data = cereal, na.action = na.omit)
##
## Residuals:
##            Min             1Q         Median             3Q            Max
## -0.00000053429 -0.00000025369  0.00000003961  0.00000024239  0.00000055130
##
## Coefficients:
##                    Estimate      Std. Error    t value            Pr(>|t|)
## (Intercept) 54.927184128972  0.000000279443  196559702 <0.0000000000000002
## calories    -0.222724169867  0.000000007501  -29694282 <0.0000000000000002
## carbo        1.092450964974  0.000000034917   31287364 <0.0000000000000002
## fat         -1.691407949221  0.000000081015  -20877762 <0.0000000000000002
## fiber        3.443479791684  0.000000047562   72399805 <0.0000000000000002
## potass      -0.033993351797  0.000000001601  -21228850 <0.0000000000000002
## protein      3.273173885524  0.000000055510   58964906 <0.0000000000000002
## sodium      -0.054492702212  0.000000000491 -110974232 <0.0000000000000002
## sugars      -0.724895121249  0.000000033108  -21895192 <0.0000000000000002
## vitamins    -0.051211969530  0.000000001779  -28778552 <0.0000000000000002
##
## (Intercept) ***
## calories    ***
## carbo       ***
## fat         ***
## fiber       ***
## potass      ***
## protein     ***
## sodium      ***
## sugars      ***
## vitamins    ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0000003069 on 64 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:      1,  Adjusted R-squared:      1
## F-statistic: 1.696e+16 on 9 and 64 DF,  p-value: < 0.00000000000000022


UPDATE: For what it's worth, I tried doing a residual plot:

residuals = summary(model)$$residuals residual_model <- lm(residuals ~ cereal$$rating)

plot(cereal\$rating, residuals)
abline(residual_model, col="black")


• Have you done any exploratory analysis of the predictor variables? Have you tried doing any diagnostics of the fitted model? – vigos Mar 19 at 23:39
• @vigos I'm a student and our textbook doesn't go into exploratory analysis or diagnostistics. Any links to new methods to try would be greatly appreciated. – Farley Knight Mar 20 at 0:01
• well most likely your model is overfitting the data. You could read this as a start statisticsbyjim.com/regression/r-squared-too-high also you could look at the other kernels on kaggle and filter by R. Also maybe start with some basic tutorials as well datacamp.com/community/tutorials/linear-regression-R – vigos Mar 20 at 0:13
• Maybe? They aren't exactly forthcoming about what the rating is or where it comes from. – The Laconic Mar 20 at 0:21
• @vigos Is there any test I can do to check if I am overfitting? – Farley Knight Mar 20 at 0:31