Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # 練習問題
  2. # 1.
  3. Ctable <- xtabs(Freq ~ management + own, data = JobSatisfaction)
  4. # (a)
  5. chisq.test(Ctable)
  6. # (b)
  7. fisher.test(Ctable)
  8.  
  9. # 2.
  10. Ctable <- xtabs(Freq ~ Sex + Survived, data = Titanic[,,"Child",])
  11. chisq.test(Ctable)
  12.  
  13. # 3.
  14. Ctable <- xtabs(Freq ~ Class + Survived, data = Titanic)[-4,]
  15. result <- chisq.test(Ctable)
  16. v <- result$expected * (1 - rowSums(Ctable)/sum(Ctable)) %o%
  17. (1 - colSums(Ctable)/sum(Ctable))
  18. (Ctable - result$expected) / sqrt(v)
  19.  
  20. # 4.
  21. lbl_test(Hospital)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement