Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n <- 54
- set.seed(123)
- x <- rbinom(n, 1, .4)
- y <- rbinom(n, 1, .6)
- tbl <- table(x=x,y=y)
- mod <- glm(y ~ x, family=binomial())
- # all the same at 0.5757576
- binomial()$linkinv( mod$coef[1])
- mean(y[x == 0])
- tbl[1,2] / sum(tbl[1,])
- # all the same at 0.5714286
- binomial()$linkinv( mod$coef[1] + mod$coef[2])
- mean(y[x == 1])
- tbl[2,2] / sum(tbl[2,])
Add Comment
Please, Sign In to add comment