df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29, 14, 15,
10, 54, 14), .Dim = c(4L, 4L), .Dimnames = list(c("Black", "Blond",
"Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))
df
Blue Brown Green Hazel
Black 20 68 5 15
Blond 94 7 16 10
Brunette 84 119 29 54
Red 17 26 14 14
df <- structure(c(20, 94, 84, 17, 68, 7, 119, 26, 5, 16, 29,
14, 15, 10, 54, 14), .Dim = c(4L, 4L),
.Dimnames = list(c("Black", "Blond",
"Brunette", "Red"), c("Blue", "Brown", "Green", "Hazel")))
df
Blue Brown Green Hazel
Black 20 68 5 15
Blond 94 7 16 10
Brunette 84 119 29 54
Red 17 26 14 14
vcd::assocstats(df)
X^2 df P(> X^2)
Likelihood Ratio 146.44 9 0
Pearson 138.29 9 0
Phi-Coefficient : 0.483
Contingency Coeff.: 0.435
Cramer's V : 0.279
vcd::assocstats(df)
X^2 df P(> X^2)
Likelihood Ratio 146.44 9 0
Pearson 138.29 9 0
Phi-Coefficient : 0.483
Contingency Coeff.: 0.435
Cramer's V : 0.279
# prepare to get Krushkes' R codes from his web site
Krushkes_codes <- c(
"http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R",
"http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")
# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))
# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))
# prepare to get Krushkes' R codes from his web site
Krushkes_codes <- c(
"http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/openGraphSaveGraph.R",
"http://www.indiana.edu/~kruschke/DoingBayesianDataAnalysis/Programs/PoissonExponentialJagsSTZ.R")
# download Krushkes' scripts to working directory
lapply(Krushkes_codes, function(i) download.file(i, destfile = basename(i)))
# run the code to analyse the data and generate output
lapply(Krushkes_codes, function(i) source(basename(i)))