inv_logit | R Documentation |
This function allows you to calculate probability from log odds
inv_logit(mod)
mod |
A glm object |
# Generate data
set.seed(1)
vot <- rnorm(20, 15, 5)
vot <- sort(vot)
fac <- rnorm(20, 100, 100)
phon <- c(0,1,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1)
df <- data.frame(vot = vot, fac = fac, phon = phon)
# Fit models
glm0 <- glm(phon ~ vot, data = df, family = "binomial")
glm1 <- glm(phon ~ vot + fac, data = df, family = "binomial")
glm2 <- glm(phon ~ vot * fac, data = df, family = "binomial")
testLM <- lm(speed ~ dist, data = cars)
# Get beta weights as probabilities
library(dplyr)
inv_logit(glm0)
inv_logit(glm1)
inv_logit(glm2)
#inv_logit(testLM) # Gives an error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.