EndingScoreDifferences.R (1185B)
1 # Worried about failures of random assignment. Let's check differences in FINAL 2 # scores, instead of differences in CHANGES. 3 # 4 # This assumes that all the chunks from antivax-attitudes.Rmd had been run in 5 # the current environment. 6 7 png(file="bayesian_ending_scores.png", width=900, height=300) 8 par(mfrow = c(1, 3), mar=c(2, 1, 1, 1), oma=c(0, 0, 4, 0)) 9 10 # We'll look at all the pairs of levels for x2. Easy for three levels, but this 11 # code is a bit more generic. 12 x2Combn <- combn(length(levels(questionnaireData$intervention)), 2) 13 14 for (combnIdx in seq_len(dim(x2Combn)[2])) { 15 x2Level1 <- x2Combn[2, combnIdx] 16 x2Level2 <- x2Combn[1, combnIdx] 17 plotPost((mcmcMat[, paste0("b2[", x2Level1, "]")] + mcmcMat[, paste0("b2b3[", x2Level1, ",2]")]) - 18 (mcmcMat[, paste0("b2[", x2Level2, "]")] + mcmcMat[, paste0("b2b3[", x2Level2, ",2]")]), 19 main = "", 20 compVal = 0.0, ROPE = c(-0.05, 0.05), 21 xlab = "") 22 mtext(paste0(levels(questionnaireData$intervention)[x2Level1], " vs.\n", 23 levels(questionnaireData$intervention)[x2Level2]), 24 side = 3, line = -2) 25 } 26 title("Ending score differences", outer=TRUE) 27 dev.off()