So why use logistic regression?
Predictor | β | OR | p |
---|---|---|---|
Age | -0.07 | -0.94 | .047 |
Age | Predicted Survival |
---|---|
82 | -0.14 |
86 | -0.07 |
90 | 0 |
94 | 0.07 |
98 | 0.14 |
150 | 1.05 |
What the heck is a survival of -0.14? Or 1.05?
library(ggplot2)
# Calculate mean values for Outcome = 0 and Outcome = 1
mean_outcome_0 <- mean(df$Age[df$Outcome == 0])
mean_outcome_1 <- mean(df$Age[df$Outcome == 1])
# Create the plot
plot <- ggplot(df, aes(x = Age, y = Outcome)) +
geom_point(size = 3, shape = 1, color = "blue", alpha = 0.8) +
scale_x_continuous(name = "Patient Age in Years", breaks = seq(80, 100, by = 5)) +
scale_y_continuous(name = "Outcome of Pneumonia (0 = Died, 1 = Lived)", breaks = seq(-0.2, 1.2, by = 0.2), limits = c(-0.2, 1.2)) +
theme_minimal(base_family = "serif") +
theme(
axis.title = element_text(face = "plain", size = 12), # Set face to "plain" for non-italic
axis.text = element_text(size = 10),
legend.position = "none"
)
ggsave("images/outcome_plot.svg", plot, width = 6, height = 5)
Plot of Simulated Data from Ma et al.
We use odds instead of probabilities because the math is easier
But the odds themselves can be computed from the
probabilities:
\[\text{Odds of Surviving} =
\frac{P_{Surviving}}{1 - P_{Surviving}}\]
We then take the natural log of that odds:
\[\text{ln}({\text{Odds}}) = \text{ln} \left(
\frac{P_{Outcome}}{1 - P_{Outcome}} \right)\]
This natural log of an odds is called a logit
\[\text{ln} \left( \frac{P_{Outcome}}{1 - P_{Outcome}} \right) = \beta_{0} + \beta_{1}X_{1} + \beta_{2}X_{2} \ldots + \epsilon\]
Choi, S. P.-P., Cheung, K., & Pang, S. M.-C. (2013). Attributes of nursing work environment as predictors of registered nurses’ job satisfaction and intention to leave. Journal of Nursing Management, 21(3), 429–439. doi: 10.1111/j.1365-2834.2012.01415.x
Baek, W., Jang, Y., Park, C. G., & Moon, M. (2020). Factors influencing satisfaction with patient-controlled analgesia among postoperative patients using a generalized ordinal logistic regression model. Asian Nursing Research, 14(2), 73–81. doi: 10.1016/j.anr.2020.03.001
Arnetz, J. E., Goetz, C. M., Sudan, S., Arble, E., Janisse, J., & Arnetz, B. B. (2020). Personal protective equipment and mental health symptoms among nurses during the COVID-19 pandemic. Journal of Occupational and Environmental Medicine, 62(11), 892–897. doi: 10.1097/JOM.0000000000001999