This question already has an answer here:
- Logistic regression: class probabilities 3 answers
Suppose we have a data set with a binary outcome variable $y$. The predictor variables are $x,w$ and $z$. This is the training data set. We obtain a logistic regression model from this training data set. Now suppose we have a test data set and want to predict $y$. In R, we use the
predict function to do this. But we end up with predicted probabilities instead of $1$ or $0$. How would we convert the probabilities to either a $1$ or $0$?