Skip to content

Instantly share code, notes, and snippets.

@nozma
Created July 26, 2016 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nozma/d87f2bdffff79bd2ecb5903e13f5946b to your computer and use it in GitHub Desktop.
Save nozma/d87f2bdffff79bd2ecb5903e13f5946b to your computer and use it in GitHub Desktop.
カテゴリカルデータ解析第5章練習問題解答
# 練習問題
# 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