Skip to content

Instantly share code, notes, and snippets.

@eliardocosta
Created September 10, 2021 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliardocosta/d73b2b82a0ac19d38af3c6d29b2c99b5 to your computer and use it in GitHub Desktop.
Save eliardocosta/d73b2b82a0ac19d38af3c6d29b2c99b5 to your computer and use it in GitHub Desktop.
library(aplore3)
data(chdage)
head(chdage)
# ajuste 1
mod1 <- glm(chd ~ age, family = binomial(), data = chdage)
summary(mod1)
#
exp(-5.309 + 0.111*50)/(1 + exp(-5.309 + 0.111*50))
#
pix <- function(x) {
exp(-5.309 + 0.111*x)/(1 + exp(-5.309 + 0.111*x))
}
plot(function(x) pix(x), 0, 80, ylim = c(0, 1),
ylab = expression(paste(pi, "(AGE)")), xlab = "AGE")
abline(h = 1, lty = 2)
# com variavel categorica
mod2 <- glm(chd ~ agegrp, family = binomial(),
data = chdage)
summary(mod2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment