The GAM of Furrycat’s data shows a strong relationship between speed and courage.
model <- gam(
formula = speed ~
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:
## speed ~ 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) 2.0764512 0.0008771 2367.492 <2e-16 ***
## armor 0.0051265 0.0026512 1.934 0.0539 .
## ---
## 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 0.688 0.407
## s(fortitude) 1.000 1.000 0.950 0.330
## s(dexterity) 1.000 1.000 0.078 0.780
## s(endurance) 1.008 1.016 0.341 0.569
## s(intellect) 1.000 1.000 0.843 0.359
## s(cleverness) 1.000 1.000 0.015 0.903
## s(courage) 7.109 8.114 1370.592 <2e-16 ***
## s(dependability) 6.530 7.695 1.304 0.226
## s(power) 1.000 1.000 1.300 0.255
## s(fierceness) 1.560 1.944 0.380 0.631
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## R-sq.(adj) = 0.984 Deviance explained = 98.5%
## GCV = 0.00022148 Scale est. = 0.0002084 n = 410
This is easy to see with the graph.
ggplot(normalized_df, aes(x = courage, y = speed)) +
geom_point() +
ggtitle("Courage vs Speed")
And GAM shows a linear relationship.
plot(model, select = 7)
The linear model shows high correlation and low residuals.
model <- lm(speed ~ courage, data = normalized_df)
summary(model)
##
## Call:
## lm(formula = speed ~ courage, data = normalized_df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.176398 -0.002232 0.000720 0.003282 0.198662
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.488e+00 3.350e-03 742.8 <2e-16 ***
## courage -9.840e-04 7.748e-06 -127.0 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01774 on 408 degrees of freedom
## Multiple R-squared: 0.9753, Adjusted R-squared: 0.9753
## F-statistic: 1.613e+04 on 1 and 408 DF, p-value: < 2.2e-16
And looks like this.
Speed is roughly captured by the following formula, \(speed \approx 2.5 - courage / 1000\).