Performing logistic regression in R
As we did in the section on linear regression, in this section, we will also perform logistic regression in base R and with the tidymodels
framework. We are going to only perform a simple binary classification regression problem using the Titanic
dataset, where we will be deciding if someone is going to survive or not. Let’s dive right into it.
Logistic regression with base R
In order to get going, we are going to start with a base R implementation of logistic regression on the Titanic
dataset where we will be modeling the response of Survived
. So, let’s get straight into it.
The following is the code that will perform the data modeling along with explanations of what is happening:
library(tidyverse) df <- Titanic |> as.data.frame() |> uncount(Freq)
This block of code starts by loading a library called tidyverse
, which contains...