r = rownames(lost3) alter = factor(substring(r, 1, 1)) gesch = factor(substring(r, 3, 3)) prop = lost3[,1]/apply(lost3, 1, sum) interaction.plot(alter, gesch, prop) gx = glm(lost3 ~ alter * gesch, binomial) anova(gx, test="Chisq") correct.m = diag(ver.m) correct.f = diag(ver.w) total.m = apply(ver.m, 1, sum) total.f = apply(ver.w, 1, sum) prop.m = correct.m/total.m prop.f = correct.f/total.f p = c(prop.m, prop.f) plabs = names(p) glabs = c(rep("m", 3), rep("f", 3)) col = c(rep(2, 3), rep(3, 3)) barplot(p, beside=T, col=col) incorrect.m = total.m - correct.m incorrect.f = total.f - correct.f dat.m = cbind(correct.m, incorrect.m) dat.f = cbind(correct.f, incorrect.f) dat = rbind(dat.m, dat.f) clabs = factor(rownames(dat)) glabs = factor(c(rep("m", 3), rep("f", 3))) o = glm(dat ~ clabs * glabs, binomial) o2 = glm(dat ~ glabs * clabs, binomial) #### other Chi-squared answers anova(gmf, test="Chisq") ## dasselbe m = apply(lost2[1:6,], 2, sum) f = apply(lost2[7:12,], 2, sum) mf = rbind(m, f) rownames(mf) = c(0, 1) colnames(mf) = c("high", "low") mf l.mf = c(0,1) gmf2 = glm(mf ~ l.mf, "binomial") anova(gmf2, test="Chisq") ################# und ein aehnliches Ergebnis ## mit einem direkten chi-quadrat chisq.test(mf) #################################### ### Drei Gruppen, jeweils 2 Ebenen A = c(0, 0, 1, 1) G = c(0, 1, 0, 1) prop = lost3[,1]/apply(lost3, 1, sum) interaction.plot(A, G, prop) g = glm(lost3 ~ A * G, binomial) anova(g, test="Chisq")