#rm(list = ls())
library(dplyr, quietly = TRUE)
library(BayesFactor, quietly = TRUE)
set.seed(123)
setwd(dir = "/Users/ivanropovik/OneDrive/MANUSCRIPTS/2017 penguin project_sexual orientation/Datasets")
full.data <- read.csv(file = "penguin_full.csv", header = TRUE, sep = ";")
#View(full.data)
data.na <- full.data %>% select(DEQ, csi, cbt, seconds, urald, sinod, sex, romrec, sexpref, Zmonog)
data <- data.na[complete.cases(data.na),]
data$sexpref10[data$sexpref == 1] <- 1
data$sexpref10[data$sexpref == 2] <- 2
data$sexpref10[data$sexpref == 3] <- 2
data$sexpref10[data$sexpref == 4] <- 2
data <- data %>% mutate(
int_rom_alpha = DEQ * romrec,
int_rom_beta = csi * romrec,
int_sexpref_alpha = DEQ * sexpref10,
int_sexpref_beta = csi * sexpref10,
int_monog_alpha = DEQ * Zmonog,
int_monog_beta = csi * Zmonog,
int_sex_alpha = DEQ * sex,
int_sex_beta = csi * sex,
int_sex_rom_alphaXW = DEQ * romrec,
int_sex_rom_alphaXZ = DEQ * sex,
int_sex_rom_alphaWZ = romrec * sex,
int_sex_rom_alphaXWZ = DEQ * romrec * sex
)
r.scale <- sqrt(2)/4
n.iter <- 100000
bfmodel1 <- regressionBF(csi ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
alpha.path <- bfmodel1[31]/bfmodel1[30]
BF for the alpha path
paste(ifelse(extractBF(alpha.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.path)$bf > 1, extractBF(alpha.path)$bf, 1/extractBF(alpha.path)$bf), 2), sep = "")
## [1] "BF10 = 2485152275.58"
Bayesian posterior estimate of the alpha path
round(summary(posterior(alpha.path, iterations = n.iter))$statistics[1], 3)
## [1] 0.015
Posterior probability of the alpha path
post.odds.alpha <- newPriorOdds(alpha.path) * alpha.path
round(extractProbabilities(as.BFprobability(post.odds.alpha)[1])$probs, 3)
## [1] 1
bfmodel2 <- regressionBF(cbt ~ csi + DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
beta.path <- bfmodel2[63]/bfmodel2[62]
BF for the beta path
paste(ifelse(extractBF(beta.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.path)$bf > 1, extractBF(beta.path)$bf, 1/extractBF(beta.path)$bf), 2), sep = "")
## [1] "BF10 = 1077.4"
Bayesian posterior estimate of the beta path
round(summary(posterior(beta.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.042
Posterior probability of the beta path
post.odds.beta <- newPriorOdds(beta.path) * beta.path
round(extractProbabilities(as.BFprobability(post.odds.beta)[1])$probs, 3)
## [1] 0.999
tau.path <- bfmodel2[63]/bfmodel2[61]
BF for the tau path
paste(ifelse(extractBF(tau.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(tau.path)$bf > 1, extractBF(tau.path)$bf, 1/extractBF(tau.path)$bf), 2), sep = "")
## [1] "BF10 = 524197.11"
Bayesian posterior estimate of the tau path
round(summary(posterior(tau.path, iterations = n.iter))$statistic[2], 3)
## [1] -0.004
Posterior probability of the tau path
post.odds.tau <- newPriorOdds(tau.path) * tau.path
round(extractProbabilities(as.BFprobability(post.odds.tau)[1])$probs, 3)
## [1] 1
post.prob.med <- extractBF(alpha.path)$bf/(extractBF(alpha.path)$bf + 1) * extractBF(beta.path)$bf/(extractBF(beta.path)$bf + 1)
bf.med <- post.prob.med/(1 - post.prob.med)
paste(ifelse(bf.med > 1, "BF10 = ", "BF01 = "), round(ifelse(bf.med > 1, bf.med, 1/bf.med), 2), sep = "")
## [1] "BF10 = 1077.4"
bfmodel1rom <- regressionBF(csi ~ DEQ + romrec + int_rom_alpha + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
alpha.rom <- bfmodel1rom[127]/bfmodel1rom[124]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.rom)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.rom)$bf > 1, extractBF(alpha.rom)$bf, 1/extractBF(alpha.rom)$bf), 2), sep = "")
## [1] "BF10 = 18197.74"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.rom, iterations = n.iter))$statistics[1], 3)
## [1] 0.012
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.rom <- newPriorOdds(alpha.rom) * alpha.rom
round(extractProbabilities(as.BFprobability(post.odds.alpha.rom)[1])$probs, 3)
## [1] 1
bfmodel2rom <- regressionBF(cbt ~ csi + DEQ + romrec + int_rom_beta + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
beta.rom <- bfmodel2rom[255]/bfmodel2rom[251]
BF for the moderation of the beta path
paste(ifelse(extractBF(beta.rom)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.rom)$bf > 1, extractBF(beta.rom)$bf, 1/extractBF(beta.rom)$bf), 2), sep = "")
## [1] "BF10 = 1.92"
Bayesian posterior estimate of the moderation effect of the beta path
round(summary(posterior(beta.rom, iterations = n.iter))$statistic[1], 3)
## [1] 0.039
Posterior probability for the moderation effect of the beta path
post.odds.beta.rom <- newPriorOdds(beta.rom) * beta.rom
round(extractProbabilities(as.BFprobability(post.odds.beta.rom)[1])$probs, 3)
## [1] 0.658
bfmodel1sexpref <- regressionBF(csi ~ DEQ + sexpref10 + int_sexpref_alpha + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
alpha.sexpref <- bfmodel1sexpref[127]/bfmodel1sexpref[124]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.sexpref)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.sexpref)$bf > 1, extractBF(alpha.sexpref)$bf, 1/extractBF(alpha.sexpref)$bf), 2), sep = "")
## [1] "BF01 = 4.13"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.sexpref, iterations = n.iter))$statistics[1], 3)
## [1] 0.026
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.sexpref <- newPriorOdds(alpha.sexpref) * alpha.sexpref
round(extractProbabilities(as.BFprobability(post.odds.alpha.sexpref)[1])$probs, 3)
## [1] 0.195
bfmodel2sexpref <- regressionBF(cbt ~ csi + DEQ + sexpref10 + int_sexpref_beta + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
beta.sexpref <- bfmodel2sexpref[255]/bfmodel2sexpref[251]
BF for the moderation of the beta path
paste(ifelse(extractBF(beta.sexpref)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.sexpref)$bf > 1, extractBF(beta.sexpref)$bf, 1/extractBF(beta.sexpref)$bf), 2), sep = "")
## [1] "BF01 = 6.41"
Bayesian posterior estimate of the moderation effect of the beta path
round(summary(posterior(beta.sexpref, iterations = n.iter))$statistic[1], 3)
## [1] 0.021
Posterior probability for the moderation effect of the beta path
post.odds.beta.sexpref <- newPriorOdds(beta.sexpref) * beta.sexpref
round(extractProbabilities(as.BFprobability(post.odds.beta.sexpref)[1])$probs, 3)
## [1] 0.135
bfmodel1monog <- regressionBF(csi ~ DEQ + Zmonog + int_monog_alpha + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
alpha.monog <- bfmodel1monog[127]/bfmodel1monog[124]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.monog)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.monog)$bf > 1, extractBF(alpha.monog)$bf, 1/extractBF(alpha.monog)$bf), 2), sep = "")
## [1] "BF10 = 2.26"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.monog, iterations = n.iter))$statistics[1], 3)
## [1] 0.015
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.monog <- newPriorOdds(alpha.monog) * alpha.monog
round(extractProbabilities(as.BFprobability(post.odds.alpha.monog)[1])$probs, 3)
## [1] 0.693
bfmodel2monog <- regressionBF(cbt ~ csi + DEQ + Zmonog + int_monog_beta + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
beta.monog <- bfmodel2monog[255]/bfmodel2monog[251]
BF for the moderation of the beta path
paste(ifelse(extractBF(beta.monog)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.monog)$bf > 1, extractBF(beta.monog)$bf, 1/extractBF(beta.monog)$bf), 2), sep = "")
## [1] "BF01 = 7.49"
Bayesian posterior estimate of the moderation effect of the beta path
round(summary(posterior(beta.monog, iterations = n.iter))$statistic[1], 3)
## [1] 0.042
Posterior probability for the moderation effect of the beta path
post.odds.beta.monog <- newPriorOdds(beta.monog) * beta.monog
round(extractProbabilities(as.BFprobability(post.odds.beta.monog)[1])$probs, 3)
## [1] 0.118
bfmodel1 <- regressionBF(Zmonog ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
alpha.path <- bfmodel1[31]/bfmodel1[30]
BF for the alpha path
paste(ifelse(extractBF(alpha.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.path)$bf > 1, extractBF(alpha.path)$bf, 1/extractBF(alpha.path)$bf), 2), sep = "")
## [1] "BF10 = 3.88"
Bayesian posterior estimate of the alpha path
round(summary(posterior(alpha.path, iterations = n.iter))$statistics[1], 3)
## [1] 0.005
Posterior probability of the alpha path
post.odds.alpha <- newPriorOdds(alpha.path) * alpha.path
round(extractProbabilities(as.BFprobability(post.odds.alpha)[1])$probs, 3)
## [1] 0.795
bfmodel2 <- regressionBF(cbt ~ Zmonog + DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
beta.path <- bfmodel2[63]/bfmodel2[62]
BF for the beta path
paste(ifelse(extractBF(beta.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.path)$bf > 1, extractBF(beta.path)$bf, 1/extractBF(beta.path)$bf), 2), sep = "")
## [1] "BF01 = 7.35"
Bayesian posterior estimate of the beta path
round(summary(posterior(beta.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.007
Posterior probability of the beta path
post.odds.beta <- newPriorOdds(beta.path) * beta.path
round(extractProbabilities(as.BFprobability(post.odds.beta)[1])$probs, 3)
## [1] 0.12
tau.path <- bfmodel2[63]/bfmodel2[61]
BF for the tau path
paste(ifelse(extractBF(tau.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(tau.path)$bf > 1, extractBF(tau.path)$bf, 1/extractBF(tau.path)$bf), 2), sep = "")
## [1] "BF10 = 13375"
Bayesian posterior estimate of the tau path
round(summary(posterior(tau.path, iterations = n.iter))$statistic[2], 3)
## [1] -0.004
Posterior probability of the tau path
post.odds.tau <- newPriorOdds(tau.path) * tau.path
round(extractProbabilities(as.BFprobability(post.odds.tau)[1])$probs, 3)
## [1] 1
post.prob.med <- extractBF(alpha.path)$bf/(extractBF(alpha.path)$bf + 1) * extractBF(beta.path)$bf/(extractBF(beta.path)$bf + 1)
bf.med <- post.prob.med/(1 - post.prob.med)
paste(ifelse(bf.med > 1, "BF10 = ", "BF01 = "), round(ifelse(bf.med > 1, bf.med, 1/bf.med), 2), sep = "")
## [1] "BF01 = 9.51"
bfmodel1 <- regressionBF(cbt ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_CBT.path <- bfmodel1[31]/bfmodel1[30]
BF for the DEQ_CBT path
paste(ifelse(extractBF(DEQ_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_CBT.path)$bf > 1, extractBF(DEQ_CBT.path)$bf, 1/extractBF(DEQ_CBT.path)$bf), 2), sep = "")
## [1] "BF10 = 10842.56"
Bayesian posterior estimate of the DEQ_CBT path
round(summary(posterior(DEQ_CBT.path, iterations = n.iter))$statistics[1], 3)
## [1] -0.004
Posterior probability of the DEQ_CBT path
post.odds.DEQ_CBT <- newPriorOdds(DEQ_CBT.path) * DEQ_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_CBT)[1])$probs, 3)
## [1] 1
bfmodel2 <- regressionBF(Zmonog ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_MON.path <- bfmodel2[31]/bfmodel2[30]
BF for the DEQ_MON path
paste(ifelse(extractBF(DEQ_MON.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_MON.path)$bf > 1, extractBF(DEQ_MON.path)$bf, 1/extractBF(DEQ_MON.path)$bf), 2), sep = "")
## [1] "BF10 = 3.88"
Bayesian posterior estimate of the DEQ_MON path
round(summary(posterior(DEQ_MON.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.005
Posterior probability of the DEQ_MON path
post.odds.DEQ_MON <- newPriorOdds(DEQ_MON.path) * DEQ_MON.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_MON)[1])$probs, 3)
## [1] 0.795
bfmodel3 <- regressionBF(csi ~ DEQ + Zmonog + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_CSI.path <- bfmodel3[63]/bfmodel3[62]
BF for the DEQ_CSI path
paste(ifelse(extractBF(DEQ_CSI.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_CSI.path)$bf > 1, extractBF(DEQ_CSI.path)$bf, 1/extractBF(DEQ_CSI.path)$bf), 2), sep = "")
## [1] "BF10 = 515653225.09"
Bayesian posterior estimate of the DEQ_CSI path
round(summary(posterior(DEQ_CSI.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.014
Posterior probability of the DEQ_CSI path
post.odds.DEQ_CSI <- newPriorOdds(DEQ_CSI.path) * DEQ_CSI.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_CSI)[1])$probs, 3)
## [1] 1
bfmodel4 <- regressionBF(csi ~ Zmonog + DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
MON_CSI.path <- bfmodel4[63]/bfmodel4[62]
BF for the MON_CSI path
paste(ifelse(extractBF(MON_CSI.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(MON_CSI.path)$bf > 1, extractBF(MON_CSI.path)$bf, 1/extractBF(MON_CSI.path)$bf), 2), sep = "")
## [1] "BF10 = 81.41"
Bayesian posterior estimate of the MON_CSI path
round(summary(posterior(MON_CSI.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.114
Posterior probability of the MON_CSI path
post.odds.MON_CSI <- newPriorOdds(MON_CSI.path) * MON_CSI.path
round(extractProbabilities(as.BFprobability(post.odds.MON_CSI)[1])$probs, 3)
## [1] 0.988
bfmodel5 <- regressionBF(cbt ~ Zmonog + DEQ + csi + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
MON_CBT.path <- bfmodel5[127]/bfmodel5[126]
BF for the MON_CBT path
paste(ifelse(extractBF(MON_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(MON_CBT.path)$bf > 1, extractBF(MON_CBT.path)$bf, 1/extractBF(MON_CBT.path)$bf), 2), sep = "")
## [1] "BF01 = 8.16"
Bayesian posterior estimate of the MON_CBT path
round(summary(posterior(MON_CBT.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.002
Posterior probability of the MON_CBT path
post.odds.MON_CBT <- newPriorOdds(MON_CBT.path) * MON_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.MON_CBT)[1])$probs, 3)
## [1] 0.109
bfmodel6 <- regressionBF(cbt ~ csi + DEQ + Zmonog + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
CSI_CBT.path <- bfmodel6[127]/bfmodel6[126]
BF for the CSI_CBT path
paste(ifelse(extractBF(CSI_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(CSI_CBT.path)$bf > 1, extractBF(CSI_CBT.path)$bf, 1/extractBF(CSI_CBT.path)$bf), 2), sep = "")
## [1] "BF10 = 970.66"
Bayesian posterior estimate of the CSI_CBT path
round(summary(posterior(CSI_CBT.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.042
Posterior probability of the CSI_CBT path
post.odds.CSI_CBT <- newPriorOdds(CSI_CBT.path) * CSI_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.CSI_CBT)[1])$probs, 3)
## [1] 0.999
bfmodel1 <- regressionBF(cbt ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_CBT.path <- bfmodel1[31]/bfmodel1[30]
BF for the DEQ_CBT path
paste(ifelse(extractBF(DEQ_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_CBT.path)$bf > 1, extractBF(DEQ_CBT.path)$bf, 1/extractBF(DEQ_CBT.path)$bf), 2), sep = "")
## [1] "BF10 = 10842.56"
Bayesian posterior estimate of the DEQ_CBT path
round(summary(posterior(DEQ_CBT.path, iterations = n.iter))$statistics[1], 3)
## [1] -0.004
Posterior probability of the DEQ_CBT path
post.odds.DEQ_CBT <- newPriorOdds(DEQ_CBT.path) * DEQ_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_CBT)[1])$probs, 3)
## [1] 1
bfmodel2 <- regressionBF(csi ~ DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_CSI.path <- bfmodel2[31]/bfmodel2[30]
BF for the DEQ_CSI path
paste(ifelse(extractBF(DEQ_CSI.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_CSI.path)$bf > 1, extractBF(DEQ_CSI.path)$bf, 1/extractBF(DEQ_CSI.path)$bf), 2), sep = "")
## [1] "BF10 = 2485152275.58"
Bayesian posterior estimate of the DEQ_CSI path
round(summary(posterior(DEQ_CSI.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.015
Posterior probability of the DEQ_CSI path
post.odds.DEQ_CSI <- newPriorOdds(DEQ_CSI.path) * DEQ_CSI.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_CSI)[1])$probs, 3)
## [1] 1
bfmodel3 <- regressionBF(Zmonog ~ DEQ + csi + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
DEQ_MON.path <- bfmodel3[63]/bfmodel3[62]
BF for the DEQ_MON path
paste(ifelse(extractBF(DEQ_MON.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(DEQ_MON.path)$bf > 1, extractBF(DEQ_MON.path)$bf, 1/extractBF(DEQ_MON.path)$bf), 2), sep = "")
## [1] "BF01 = 1.19"
Bayesian posterior estimate of the DEQ_MON path
round(summary(posterior(DEQ_MON.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.003
Posterior probability of the DEQ_MON path
post.odds.DEQ_MON <- newPriorOdds(DEQ_MON.path) * DEQ_MON.path
round(extractProbabilities(as.BFprobability(post.odds.DEQ_MON)[1])$probs, 3)
## [1] 0.456
bfmodel4 <- regressionBF(Zmonog ~ csi + DEQ + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
CSI_MON.path <- bfmodel4[63]/bfmodel4[62]
BF for the CSI_MON path
paste(ifelse(extractBF(CSI_MON.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(CSI_MON.path)$bf > 1, extractBF(CSI_MON.path)$bf, 1/extractBF(CSI_MON.path)$bf), 2), sep = "")
## [1] "BF10 = 119.7"
Bayesian posterior estimate of the CSI_MON path
round(summary(posterior(CSI_MON.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.085
Posterior probability of the CSI_MON path
post.odds.CSI_MON <- newPriorOdds(CSI_MON.path) * CSI_MON.path
round(extractProbabilities(as.BFprobability(post.odds.CSI_MON)[1])$probs, 3)
## [1] 0.992
bfmodel5 <- regressionBF(cbt ~ csi + DEQ + Zmonog + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
CSI_CBT.path <- bfmodel5[127]/bfmodel5[126]
BF for the CSI_CBT path
paste(ifelse(extractBF(CSI_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(CSI_CBT.path)$bf > 1, extractBF(CSI_CBT.path)$bf, 1/extractBF(CSI_CBT.path)$bf), 2), sep = "")
## [1] "BF10 = 970.66"
Bayesian posterior estimate of the CSI_CBT path
round(summary(posterior(CSI_CBT.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.042
Posterior probability of the CSI_CBT path
post.odds.CSI_CBT <- newPriorOdds(CSI_CBT.path) * CSI_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.CSI_CBT)[1])$probs, 3)
## [1] 0.999
bfmodel6 <- regressionBF(cbt ~ Zmonog + DEQ + csi + seconds + urald + sinod + sex, data, rscaleCont = r.scale)
MON_CBT.path <- bfmodel6[127]/bfmodel6[126]
BF for the MON_CBT path
paste(ifelse(extractBF(MON_CBT.path)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(MON_CBT.path)$bf > 1, extractBF(MON_CBT.path)$bf, 1/extractBF(MON_CBT.path)$bf), 2), sep = "")
## [1] "BF01 = 8.16"
Bayesian posterior estimate of the MON_CBT path
round(summary(posterior(MON_CBT.path, iterations = n.iter))$statistic[1], 3)
## [1] 0.002
Posterior probability of the MON_CBT path
post.odds.MON_CBT <- newPriorOdds(MON_CBT.path) * MON_CBT.path
round(extractProbabilities(as.BFprobability(post.odds.MON_CBT)[1])$probs, 3)
## [1] 0.109
bfmodel1sex <- regressionBF(csi ~ DEQ + sex + int_sex_alpha + seconds + urald + sinod, data, rscaleCont = r.scale)
alpha.sex <- bfmodel1sex[63]/bfmodel1sex[60]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.sex)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.sex)$bf > 1, extractBF(alpha.sex)$bf, 1/extractBF(alpha.sex)$bf), 2), sep = "")
## [1] "BF10 = 259.37"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.sex, iterations = n.iter))$statistics[1], 3)
## [1] -0.013
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.sex <- newPriorOdds(alpha.sex) * alpha.sex
round(extractProbabilities(as.BFprobability(post.odds.alpha.sex)[1])$probs, 3)
## [1] 0.996
bfmodel2sex <- regressionBF(cbt ~ csi + DEQ + sex + int_sex_beta + seconds + urald + sinod, data, rscaleCont = r.scale)
beta.sex <- bfmodel2sex[127]/bfmodel2sex[123]
BF for the moderation of the beta path
paste(ifelse(extractBF(beta.sex)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.sex)$bf > 1, extractBF(beta.sex)$bf, 1/extractBF(beta.sex)$bf), 2), sep = "")
## [1] "BF01 = 4.34"
Bayesian posterior estimate of the moderation effect of the beta path
round(summary(posterior(beta.sex, iterations = n.iter))$statistic[1], 3)
## [1] 0.078
Posterior probability for the moderation effect of the beta path
post.odds.beta.sex <- newPriorOdds(beta.sex) * beta.sex
round(extractProbabilities(as.BFprobability(post.odds.beta.sex)[1])$probs, 3)
## [1] 0.187
bfmodel1sex_rom <- regressionBF(csi ~ DEQ + romrec + sex + int_sex_rom_alphaXW + int_sex_rom_alphaXZ + int_sex_rom_alphaWZ + int_sex_rom_alphaXWZ + seconds + urald + sinod, data, rscaleCont = r.scale)
alpha.3way <- bfmodel1sex_rom[1023]/bfmodel1sex_rom[1016]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.3way)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.3way)$bf > 1, extractBF(alpha.3way)$bf, 1/extractBF(alpha.3way)$bf), 2), sep = "")
## [1] "BF01 = 7.14"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.3way, iterations = n.iter))$statistics[1], 3)
## [1] -0.013
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.3way <- newPriorOdds(alpha.3way) * alpha.3way
round(extractProbabilities(as.BFprobability(post.odds.alpha.3way)[1])$probs, 3)
## [1] 0.123
bfmodel1sex_rom <- regressionBF(csi ~ DEQ + sex + int_sex_alpha + romrec + seconds + urald + sinod, data, rscaleCont = r.scale)
alpha.sex <- bfmodel1sex_rom[127]/bfmodel1sex_rom[124]
BF for the moderation of the alpha path
paste(ifelse(extractBF(alpha.sex)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(alpha.sex)$bf > 1, extractBF(alpha.sex)$bf, 1/extractBF(alpha.sex)$bf), 2), sep = "")
## [1] "BF10 = 78.38"
Bayesian posterior estimate of the moderation effect of the alpha path
round(summary(posterior(alpha.sex, iterations = n.iter))$statistics[1], 3)
## [1] -0.012
Posterior probability for the moderation effect of the alpha path
post.odds.alpha.sex <- newPriorOdds(alpha.sex) * alpha.sex
round(extractProbabilities(as.BFprobability(post.odds.alpha.sex)[1])$probs, 3)
## [1] 0.987
bfmodel2sex_rom <- regressionBF(cbt ~ csi + DEQ + sex + int_sex_beta + romrec + seconds + urald + sinod, data, rscaleCont = r.scale)
beta.sex <- bfmodel2sex_rom[255]/bfmodel2sex_rom[251]
BF for the moderation of the beta path
paste(ifelse(extractBF(beta.sex)$bf > 1, "BF10 = ", "BF01 = "),
round(ifelse(extractBF(beta.sex)$bf > 1, extractBF(beta.sex)$bf, 1/extractBF(beta.sex)$bf), 2), sep = "")
## [1] "BF01 = 4.01"
Bayesian posterior estimate of the moderation effect of the beta path
round(summary(posterior(beta.sex, iterations = n.iter))$statistic[1], 3)
## [1] 0.08
Posterior probability for the moderation effect of the beta path
post.odds.beta.sex <- newPriorOdds(beta.sex) * beta.sex
round(extractProbabilities(as.BFprobability(post.odds.beta.sex)[1])$probs, 3)
## [1] 0.199
sessionInfo()
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: macOS Sierra 10.12.6
##
## locale:
## [1] sk_SK.UTF-8/sk_SK.UTF-8/sk_SK.UTF-8/C/sk_SK.UTF-8/sk_SK.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] BayesFactor_0.9.12-2 Matrix_1.2-8 coda_0.19-1
## [4] dplyr_0.5.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.10 knitr_1.15.1 magrittr_1.5
## [4] lattice_0.20-34 R6_2.2.0 pbapply_1.3-2
## [7] stringr_1.2.0 tools_3.3.2 parallel_3.3.2
## [10] grid_3.3.2 DBI_0.6 htmltools_0.3.5
## [13] MatrixModels_0.4-1 gtools_3.5.0 yaml_2.1.14
## [16] lazyeval_0.2.0 assertthat_0.1 rprojroot_1.2
## [19] digest_0.6.12 tibble_1.2 evaluate_0.10
## [22] rmarkdown_1.3 stringi_1.1.2 backports_1.0.5
## [25] mvtnorm_1.0-6