# Estimate sensitive item outcome model using Sri Lanka data on male sexual violence
# Load Sri Lanka list experiment data
data(srilanka)
# Model 1: intercept-only outcome model without prior information:
mod1 <- bayeslist(sexaussault ~ 1, data = srilanka, treat = "treatment", J = 3,
type = "outcome", nsim = 200, thin = 1, CIsize = 0.95, nchain = 1,
seeds = 342321, prior = NULL, parallel = TRUE)
summary(mod1) # summary of estimates
predict(mod1) # predicted prevalence for each observation
plot(mod1,"trace") # trace plot
plot(mod1,"coef") # coefficient plot
plot(mod1, only_prev = TRUE) # prevalence plot
# \donttest{
# Model 2: multivariate outcome model without prior information:
mod2 <- bayeslist(sexaussault ~ age + edu, data = srilanka, treat = "treatment", J = 3,
type = "outcome", nsim = 200, thin = 1, CIsize = 0.95, nchain = 1,
seeds = 342321, prior = NULL, parallel = TRUE)
summary(mod2) # summary of estimates
predict(mod2) # predicted prevalence for each observation
plot(mod2,"trace") # trace plot
plot(mod2,"coef") # coefficient plot
plot(mod2) # prevalence + coefficient plot
# Model 3: intercept-only outcome model with prior information from medicolegal reports, i.e.,
# with a prior beta-logistic distribution BL(38, 146).
a <- 38; b <-146
mod3 <- bayeslist(sexaussault ~ 1, data = srilanka, treat = "treatment", J = 3,
type = "outcome", nsim = 200, thin = 1, CIsize = 0.95, nchain = 1,
seeds = 342321, prior = "BL", BL_a = a, BL_b = b,, parallel = TRUE)
summary(mod3)
predict(mod3)
plot(mod3,"trace")
plot(mod3,"coef")
plot(mod3, only_prev = TRUE)
# Model 4: multivariate outcome model with prior information from a direct item.
# Load London list experiment data
data(london)
mod4 <- bayeslist(listCount ~ agegrp + gender + social_grade + qual,data = london, J = 4,
treat = "listTreat", seeds = 4597, nsim = 200, nchain = 1,
prior = "direct_item", direct_item = "baselineTurnout")
summary(mod4)
predict(mod4)
plot(mod4,"trace")
plot(mod4,"coef")
plot(mod4)
# }
Run the code above in your browser using DataLab