antivax-attitudes

Reanalyses of data from Horne, Powell, Hummel & Holyoak (2015)
git clone https://git.eamoncaddigan.net/antivax-attitudes.git
Log | Files | Refs | README | LICENSE

commit e84bc5e9a5170ef97a6bf40ce5b1ef0853228cd6
parent 767d459a679a4a43395be267f2b55d21833cbc5e
Author: eamoncaddigan <eamon.caddigan@gmail.com>
Date:   Sat, 29 Aug 2015 15:25:11 -0400

Verified that I got my betas right!

Diffstat:
MJags-Yord-Xnom1grp-Mnormal.R | 2+-
AcheckBetas.R | 26++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/Jags-Yord-Xnom1grp-Mnormal.R b/Jags-Yord-Xnom1grp-Mnormal.R @@ -181,7 +181,7 @@ genMCMC = function( datFrm, yName , x1Name, x2Name, x3Name, #----------------------------------------------------------------------------- # RUN THE CHAINS parameters = c("b0", "b1", "b2", "b3", "b1b2", "b1b3", "b2b3", "b1b2b3", - "sigma", "thresh", "m") # Returning m will make mcmcCoda *HUGE* + "sigma", "thresh") adaptSteps = 500 # Number of steps to "tune" the samplers burnInSteps = 1000 runJagsOut <- run.jags( method=runjagsMethod , diff --git a/checkBetas.R b/checkBetas.R @@ -0,0 +1,26 @@ +# Just a hack script to check that I got the sum-to-zero stuff right. + +betaLevels <- c(5, 3, 2) + +# Hey, how do you initialize an empty n-dimentional matrix in R? +mFromBeta <- rep(NA, prod(betaLevels)) +dim(mFromBeta) <- betaLevels +mFromMCMC <- rep(NA, prod(betaLevels)) +dim(mFromMCMC) <- betaLevels + +for (j1 in 1:betaLevels[1]) { + for (j2 in 1:betaLevels[2]) { + for (j3 in 1:betaLevels[3]) { + # Oh God. + mFromBeta[j1,j2,j3] <- mean(mcmcMat[,"b0"] + + mcmcMat[,paste0("b1[",j1,"]")] + + mcmcMat[,paste0("b2[",j2,"]")] + + mcmcMat[,paste0("b3[",j3,"]")] + + mcmcMat[,paste0("b1b2[",j1,",",j2,"]")] + + mcmcMat[,paste0("b1b3[",j1,",",j3,"]")] + + mcmcMat[,paste0("b2b3[",j2,",",j3,"]")] + + mcmcMat[,paste0("b1b2b3[",j1,",",j2,",",j3,"]")]) + mFromMCMC[j1,j2,j3] <- mean(mcmcMat[,paste0("m[",j1,",",j2,",",j3,"]")]) + } + } +}