This document contains the output for a series of models using beta regression to analyze the data from Danvers and Hu’s honesty study.
library(brms)
## Warning: package 'brms' was built under R version 3.4.4
## Loading required package: Rcpp
## Warning: package 'Rcpp' was built under R version 3.4.4
## Loading required package: ggplot2
## Loading 'brms' package (version 2.2.0). Useful instructions
## can be found by typing help('brms'). A more detailed introduction
## to the package is available through vignette('brms_overview').
## Run theme_set(theme_default()) to use the default bayesplot theme.
# load data
hdat.l <- read.csv("~/Dropbox/Honesty_Project/Judging Honesty Studies/honesty_social_issues/hdat_social_long.csv")
# scaling the honesty data to 0-1 interval
hdat.l[,c(3:11)] <- hdat.l[,c(3:11)]/100
# remove 0 & 1 from all outcome variables
hdat.l[,3:11] <- apply(hdat.l[,3:11], 2, function(x) ifelse(x == 1.0, 0.99,ifelse(x == 0, 0.01, x)))
# listwise deletion
hdat.lC <- na.omit(hdat.l)
# estimating the model with specific narrative and order as covariates
bcpriors <- get_prior(belief ~ condPos*nar*order + (1|ResponseId), data=hdat.lC, family="beta")
stmt.fitc <- brm(belief ~ condPos*nar*order + (1|ResponseId), data=hdat.lC, family="beta",
prior = bcpriors)
## Compiling the C++ model
## Start sampling
##
## SAMPLING FOR MODEL 'beta brms-model' NOW (CHAIN 1).
##
## Gradient evaluation took 0.001288 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 12.88 seconds.
## Adjust your expectations accordingly!
##
##
## Iteration: 1 / 2000 [ 0%] (Warmup)
## Iteration: 200 / 2000 [ 10%] (Warmup)
## Iteration: 400 / 2000 [ 20%] (Warmup)
## Iteration: 600 / 2000 [ 30%] (Warmup)
## Iteration: 800 / 2000 [ 40%] (Warmup)
## Iteration: 1000 / 2000 [ 50%] (Warmup)
## Iteration: 1001 / 2000 [ 50%] (Sampling)
## Iteration: 1200 / 2000 [ 60%] (Sampling)
## Iteration: 1400 / 2000 [ 70%] (Sampling)
## Iteration: 1600 / 2000 [ 80%] (Sampling)
## Iteration: 1800 / 2000 [ 90%] (Sampling)
## Iteration: 2000 / 2000 [100%] (Sampling)
##
## Elapsed Time: 84.0125 seconds (Warm-up)
## 91.3264 seconds (Sampling)
## 175.339 seconds (Total)
##
##
## SAMPLING FOR MODEL 'beta brms-model' NOW (CHAIN 2).
##
## Gradient evaluation took 0.001109 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 11.09 seconds.
## Adjust your expectations accordingly!
##
##
## Iteration: 1 / 2000 [ 0%] (Warmup)
## Iteration: 200 / 2000 [ 10%] (Warmup)
## Iteration: 400 / 2000 [ 20%] (Warmup)
## Iteration: 600 / 2000 [ 30%] (Warmup)
## Iteration: 800 / 2000 [ 40%] (Warmup)
## Iteration: 1000 / 2000 [ 50%] (Warmup)
## Iteration: 1001 / 2000 [ 50%] (Sampling)
## Iteration: 1200 / 2000 [ 60%] (Sampling)
## Iteration: 1400 / 2000 [ 70%] (Sampling)
## Iteration: 1600 / 2000 [ 80%] (Sampling)
## Iteration: 1800 / 2000 [ 90%] (Sampling)
## Iteration: 2000 / 2000 [100%] (Sampling)
##
## Elapsed Time: 86.9757 seconds (Warm-up)
## 81.8506 seconds (Sampling)
## 168.826 seconds (Total)
##
##
## SAMPLING FOR MODEL 'beta brms-model' NOW (CHAIN 3).
##
## Gradient evaluation took 0.001775 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 17.75 seconds.
## Adjust your expectations accordingly!
##
##
## Iteration: 1 / 2000 [ 0%] (Warmup)
## Iteration: 200 / 2000 [ 10%] (Warmup)
## Iteration: 400 / 2000 [ 20%] (Warmup)
## Iteration: 600 / 2000 [ 30%] (Warmup)
## Iteration: 800 / 2000 [ 40%] (Warmup)
## Iteration: 1000 / 2000 [ 50%] (Warmup)
## Iteration: 1001 / 2000 [ 50%] (Sampling)
## Iteration: 1200 / 2000 [ 60%] (Sampling)
## Iteration: 1400 / 2000 [ 70%] (Sampling)
## Iteration: 1600 / 2000 [ 80%] (Sampling)
## Iteration: 1800 / 2000 [ 90%] (Sampling)
## Iteration: 2000 / 2000 [100%] (Sampling)
##
## Elapsed Time: 89.2537 seconds (Warm-up)
## 87.2505 seconds (Sampling)
## 176.504 seconds (Total)
##
##
## SAMPLING FOR MODEL 'beta brms-model' NOW (CHAIN 4).
##
## Gradient evaluation took 0.001275 seconds
## 1000 transitions using 10 leapfrog steps per transition would take 12.75 seconds.
## Adjust your expectations accordingly!
##
##
## Iteration: 1 / 2000 [ 0%] (Warmup)
## Iteration: 200 / 2000 [ 10%] (Warmup)
## Iteration: 400 / 2000 [ 20%] (Warmup)
## Iteration: 600 / 2000 [ 30%] (Warmup)
## Iteration: 800 / 2000 [ 40%] (Warmup)
## Iteration: 1000 / 2000 [ 50%] (Warmup)
## Iteration: 1001 / 2000 [ 50%] (Sampling)
## Iteration: 1200 / 2000 [ 60%] (Sampling)
## Iteration: 1400 / 2000 [ 70%] (Sampling)
## Iteration: 1600 / 2000 [ 80%] (Sampling)
## Iteration: 1800 / 2000 [ 90%] (Sampling)
## Iteration: 2000 / 2000 [100%] (Sampling)
##
## Elapsed Time: 89.3075 seconds (Warm-up)
## 86.7083 seconds (Sampling)
## 176.016 seconds (Total)
print(summary(stmt.fitc))
## Family: beta
## Links: mu = logit; phi = identity
## Formula: belief ~ condPos * nar * order + (1 | ResponseId)
## Data: hdat.lC (Number of observations: 2253)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## ICs: LOO = NA; WAIC = NA; R2 = NA
##
## Group-Level Effects:
## ~ResponseId (Number of levels: 757)
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## sd(Intercept) 0.87 0.03 0.80 0.94 1427 1.00
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI
## Intercept 0.28 0.14 0.00 0.56
## condPos 1.34 0.21 0.92 1.75
## narhomosexuality -0.28 0.20 -0.66 0.10
## narrace 0.02 0.21 -0.39 0.42
## order -0.10 0.06 -0.23 0.02
## condPos:narhomosexuality 0.57 0.30 -0.03 1.15
## condPos:narrace -0.09 0.30 -0.68 0.49
## condPos:order 0.07 0.10 -0.12 0.26
## narhomosexuality:order 0.12 0.09 -0.06 0.30
## narrace:order -0.06 0.10 -0.25 0.13
## condPos:narhomosexuality:order -0.18 0.14 -0.46 0.09
## condPos:narrace:order 0.11 0.14 -0.15 0.38
## Eff.Sample Rhat
## Intercept 1975 1.00
## condPos 1792 1.00
## narhomosexuality 2390 1.00
## narrace 2126 1.00
## order 1920 1.00
## condPos:narhomosexuality 2200 1.00
## condPos:narrace 2048 1.00
## condPos:order 1752 1.00
## narhomosexuality:order 2405 1.00
## narrace:order 2100 1.00
## condPos:narhomosexuality:order 2188 1.00
## condPos:narrace:order 1988 1.00
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
## phi 4.39 0.18 4.05 4.74 4000 1.00
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
plot(stmt.fitc)