# dependent proportions, siblings solving puzzles
siblings = matrix(c(15,5,7,10),nr=2,
dimnames=list("older"=c("<1 min",">1 min"),"younger"=c("<1 min",">1 min")))
siblings
# usual test for independence comparing younger vs older
chisq.test(siblings, correct=F)
# McNemar test for equal proportions comparing younger vs older
# this is the two-sided alternative,
# need to halve the p-value to get the one-sided
mcnemar.test(siblings, correct=F)
# simple kappa coefficient
# install.packages("vcd")
library(vcd)
kappa = Kappa(siblings); kappa
confint(kappa)
agreementplot(siblings)
# assuming independent data (not matched by siblings)
notsiblings = matrix(c(22,20,15,17),nr=2,
dimnames=list(c("Older","Younger"),c("<1 min",">1 min")))
notsiblings
# the ususal chisq test for independence
chisq.test(notsiblings, correct=F)
prop.test(notsiblings, correct=F)