Skip to content

Instantly share code, notes, and snippets.

@lokeshh
Created July 4, 2016 20:26
Show Gist options
  • Select an option

  • Save lokeshh/7fefc05ca013b95a3024e769fc22633c to your computer and use it in GitHub Desktop.

Select an option

Save lokeshh/7fefc05ca013b95a3024e769fc22633c to your computer and use it in GitHub Desktop.
y a b c d e
0 6 62.1 no male A
1 18 74.7 yes female B
1 16 69.7 no female A
0 14 71 no male C
1 5 56.9 no male B
0 11 58.7 no female B
0 8 63.3 no male B
1 11 70.4 no male A
1 15 70.5 no male C
0 11 59.2 no male B
0 19 76.4 yes male A
0 17 71.7 no male B
1 12 57.5 yes male C
1 10 61.1 no female B
> data = read.table('df.txt', header=T)
> model = glm(y ~ c:d, data=data, family='binomial')
> summary(model)
Call:
glm(formula = y ~ c:d, family = "binomial", data = data)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.4823 -0.9695 -0.4847 1.1082 1.4006
Coefficients: (1 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
(Intercept) -9.549e-17 1.414e+00 0.000 1.000
cno:dfemale 6.931e-01 1.871e+00 0.371 0.711
cyes:dfemale 1.757e+01 3.956e+03 0.004 0.996
cno:dmale -5.108e-01 1.592e+00 -0.321 0.748
cyes:dmale NA NA NA NA
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 19.408 on 13 degrees of freedom
Residual deviance: 17.177 on 10 degrees of freedom
AIC: 25.177
Number of Fisher Scoring iterations: 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment