Exercise

Regression With a Categorical Response I

So we've seen what happens with a categorical predictor variable, what about a categorical response (response) variable?

Let's say instead of a continuous measure of liking, we have a binary measure - either someone likes us (1), or they don't (0).

We can see whether we can predict whether someone likes us or not using logistic regression.

While previously we have used the lm() function, for logistic regression we will use the glm() function, with the added argument family = binomial. This should look something like this: glm(response variable ~ predictor variable + predictor variable, family = binomial).

Let's try this out!

Instructions

100 XP
  • In your script add a line of code that finds the logistic regression model for liking, predicted by smile and money.
  • Assign the outcome of this mode to object logmod.
  • Use the summary() function to find the regression coefficients for logmod.
  • 'Submit' and look at the output!