A GAM of Furrycat’s data shows a strong relationship between health and both hardiness and dexterity.
model <- gam(
formula = health ~
s(hardiness) +
s(fortitude) +
s(dexterity) +
s(endurance) +
s(intellect) +
s(cleverness) +
s(courage) +
s(dependability) +
s(power) +
s(fierceness) +
armor,
family = gaussian(),
data = normalized_df
)
##
## Family: gaussian
## Link function: identity
##
## Formula:
## health ~ s(hardiness) + s(fortitude) + s(dexterity) + s(endurance) +
## s(intellect) + s(cleverness) + s(courage) + s(dependability) +
## s(power) + s(fierceness) + armor
##
## Parametric coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7660.3918 0.3378 22676.340 <2e-16 ***
## armor -0.9996 0.9550 -1.047 0.296
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Approximate significance of smooth terms:
## edf Ref.df F p-value
## s(hardiness) 1.000 1.000 1.133e+07 <2e-16 ***
## s(fortitude) 1.000 1.000 1.095e+00 0.2960
## s(dexterity) 1.000 1.000 3.708e+05 <2e-16 ***
## s(endurance) 1.000 1.000 1.116e+00 0.2914
## s(intellect) 4.157 5.132 9.740e-01 0.4435
## s(cleverness) 1.000 1.000 3.360e-01 0.5627
## s(courage) 1.612 2.012 4.520e-01 0.6482
## s(dependability) 1.000 1.000 6.133e+00 0.0137 *
## s(power) 1.000 1.000 5.452e+00 0.0201 *
## s(fierceness) 1.000 1.000 3.757e+00 0.0534 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 1 Deviance explained = 100%
## GCV = 28.036 Scale est. = 26.841 n = 370
And GAM shows a linear relationships.
plot(model, select = 1)
plot(model, select = 3)
The linear model shows high correlation and low residuals.
model <- lm(health ~ hardiness + dexterity, data = normalized_df)
summary(model)
##
## Call:
## lm(formula = health ~ hardiness + dexterity, data = normalized_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.686 -4.792 0.466 4.588 8.216
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.904833 0.722564 56.61 <2e-16 ***
## hardiness 14.961766 0.002567 5828.13 <2e-16 ***
## dexterity 2.991161 0.002784 1074.51 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.254 on 367 degrees of freedom
## Multiple R-squared: 1, Adjusted R-squared: 1
## F-statistic: 6.629e+07 on 2 and 367 DF, p-value: < 2.2e-16
And looks like this.
The residuals suggest that some of the error may be due to rounding.
Health is roughly captured by the following formula, \(health \approx 42 + 15 * hardiness + 3 * dexterity\). The final health is rounded.