Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. count <- c(18, 28, 14, 20, 51, 28, 12, 25, 9)
  2. w <- rep(c("T", "M", "S"), 3)
  3. h <- c(rep("T", 3), rep("M", 3), rep("S", 3))
  4. wife <- factor(w)
  5. husband <- factor(h)
  6. height <- data.frame(count, husband, wife)
  7.  
  8. > height
  9. count husband wife
  10. 1 18 T T
  11. 2 28 T M
  12. 3 14 T S
  13. 4 20 M T
  14. 5 51 M M
  15. 6 28 M S
  16. 7 12 S T
  17. 8 25 S M
  18. 9 9 S S
  19.  
  20. height.glm <- glm(count ~ husband + wife, family = poisson)
  21. summary(height.glm)
  22.  
  23. all:
  24. glm(formula = count ~ husband + wife, family = poisson)
  25.  
  26. Deviance Residuals:
  27. 1 2 3 4 5 6 7 8 9
  28. 0.849 -0.448 -0.242 -0.870 0.109 0.664 0.230 0.340 -0.751
  29.  
  30. Coefficients:
  31. Estimate Std. Error z value Pr(>|z|)
  32. (Intercept) 3.917 0.122 32.15 < 2e-16 ***
  33. husbandS -0.766 0.178 -4.30 1.7e-05 ***
  34. husbandT -0.501 0.164 -3.06 0.0022 **
  35. wifeS -0.713 0.171 -4.17 3.1e-05 ***
  36. wifeT -0.732 0.172 -4.26 2.1e-05 ***
  37. ---
  38. Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  39.  
  40. (Dispersion parameter for poisson family taken to be 1)
  41.  
  42. Null deviance: 50.5890 on 8 degrees of freedom
  43. Residual deviance: 2.9232 on 4 degrees of freedom
  44. AIC: 56.57
  45.  
  46. Number of Fisher Scoring iterations: 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement