Description Usage Arguments Examples
This function allows you to calculate probability from log odds
1 | inv_logit(mod)
|
mod |
A glm object |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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.