Skip to content

Instantly share code, notes, and snippets.

@arimitramaiti
Created July 28, 2021 03:57
Show Gist options
  • Save arimitramaiti/2dfe790d4a75597adb29493acb1678bb to your computer and use it in GitHub Desktop.
Save arimitramaiti/2dfe790d4a75597adb29493acb1678bb to your computer and use it in GitHub Desktop.
## Show regression outputs
```{r echo=FALSE}
library("sjPlot")
library("sjmisc")
library("sjlabelled")
data = read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv")
data$rank <- factor(data$rank)
m1 <- glm(admit ~ gre, data = data, family = binomial(link = "logit"))
m2 <- glm(admit ~ gre + gpa, data = data, family = binomial(link = "logit"))
m3 <- glm(admit ~ gre + gpa + rank, data = data, family = binomial(link = "logit"))
tab_model(
m1, m2, m3,
pred.labels = c("Intercept", "GRE Score", "GPA Score", "Rank-2 Institution", "Rank-3 Institution", "Rank-4 Institution"),
dv.labels = c("Iteration-1", "Iteration-2", "Iteration-3"),
string.pred = "Coeffcient",
string.ci = "Conf. Int (95%)",
string.p = "P-Value",
show.aic = TRUE,
show.loglik = TRUE,
title = "Logistic Regression of admission on GRE score, GPA score and College ranking"
)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment