Created
July 26, 2016 13:29
-
-
Save nozma/d87f2bdffff79bd2ecb5903e13f5946b to your computer and use it in GitHub Desktop.
カテゴリカルデータ解析第5章練習問題解答
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 練習問題 | |
# 1. | |
# (a) (b) | |
mantelhaen.test(CoalMiners) | |
# (c) | |
library(epiDisplay) | |
mhor(mhtable = CoalMiners) | |
# 2. | |
# (a) | |
Ctable <- c(311, 162, 30, 13, | |
278, 1493, 582, 99, | |
51, 287, 457, 155, | |
49, 66, 104, 302, | |
353, 256, 25, 6, | |
525, 2117, 485, 67, | |
47, 346, 258, 65, | |
14, 53, 48, 106) | |
Ctable <- as.table(aperm(array(Ctable, dim = c(4, 4, 2)), c(2, 1, 3))) | |
dimnames(Ctable) <- list(History = 1:4, Effect = 1:4, Sex = c("M", "F")) | |
Ctable | |
# (b) | |
mantelhaen.test(Ctable) | |
library(coin) | |
lbl_test(Ctable) | |
mosaicplot(Ctable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment