library(tidyverse)
library(tidymodels)
library(scatterplot3d)
To begin, we’ll work with a new set of pokemon data.
pokemon <- read_csv("data/pokemon150.csv")
Previously we looked at building a model to predict a pokemon’s hit points using height.
Last time we noticed both height and weight are correlated with a pokemon’s hit points.
Other variables may be correlated with hp
, e.g. a pokemon’s legendary status.
Do legendary pokemon have higher hp
than non-legendary pokemon? Compare mean hp
between groups to support your answer.
# code here
Write down a model to predict a pokemon’s hitpoints based on their height, weight, legendary status (use \(x\), \(y\), \(\beta\) notation). Define each variable.
Use tidymodel
syntax to build a linear model and estimate each \(\beta\).
# code here
Interpret the meaning of your estimates and write a brief description below. Use/discuss the the phrase “all else held constant” with your neighbor.
Do the coefficients match your expectations for the previous exercise? Why or why not? Write code to explore any oddities further.
# code here
Some think that certain pokemon types have higher hp
than others.
pokemon %>%
group_by(type_1) %>%
summarize(mean_hp = mean(hp), n = n())
R
to determine the effect of pokemon type on hp
.# code here