daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n <- 54
  2. set.seed(123)
  3. x <- rbinom(n, 1, .4)
  4. y <- rbinom(n, 1, .6)
  5.  
  6. tbl <- table(x=x,y=y)
  7.  
  8. mod <- glm(y ~ x, family=binomial())
  9.  
  10. # all the same at 0.5757576
  11. binomial()$linkinv( mod$coef[1])
  12. mean(y[x == 0])
  13. tbl[1,2] / sum(tbl[1,])
  14.  
  15. # all the same at 0.5714286
  16. binomial()$linkinv( mod$coef[1] + mod$coef[2])
  17. mean(y[x == 1])
  18. tbl[2,2] / sum(tbl[2,])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top