I am running a simple linear regression with a numerical response (wellbeing) and a categorical explanatory (education) variable. I know that there are ideas about dealing with the categorical variable as continuous, but in this case I want to keep treating it as a factor.
Now...
When I want to assess the quantity of this model with R-squared, the glance functionality of the broom package doesn't provide me with the metric.
In my understanding, the null model here, is the mean of the response variable and the linear model that I've created here is the response variable mapped onto the explanatory variable. There must be some kind of effect size to gauge here.
What do you think? Why can't I get R-squared and would there be another kind of effect size that would tell me something about the improvement of the model by including this categorical predictor.
df <- tibble(education = c("Low", "Medium", "High", "Low", "Medium", "High", "High"),
wellbeing = c(7, 6, 7, 4, 5, 4, 5))
df$education <- as.factor(df$education)
mdl <- glm(
wellbeing ~ education + 0,
data = df,
family = gaussian
)
library(dplyr)
library(broom)
mdl_scgeluk_min_havovwombo %>%
glance() %>%
pull(r.squared)