rm(list=ls()) #dir <- "C:/Users/averhag2/Dropbox/UVA/JosineEJ/ReplicationPrior/Code/Correlation" setwd(dir) # Load and if necessary install the required libraries library("hypergeo") source("ReplicationFunctionsCorrelation.R") # Origineel: r = .934, n = 9 # Replicatie Forstmann: r = .763, n = 12 # replication in Forstmann paper: r.orig <- .934 n.orig <- 9 r.rep <- .763 n.rep <- 11 REPBF10 <- CorrelationReplicationBF(r.orig, n.orig, r.rep, n.rep) REPBF10 #23.84 # To create a plot and compute the Savage Dickey Bayes factor: SDRBF <- repposteriorplot(n.orig, r.orig, n.rep, r.rep) SDRBF # Now for the Boekel non-replication: # Replicatie Boekel: r = .03, n = 31 r.orig <- .934 n.orig <- 9 r.rep <- .03 n.rep <- 31 REPBF10 <- CorrelationReplicationBF(r.orig, n.orig, r.rep, n.rep, M=1000000) REPBF10 # REPBF10 = 0.004 # Evidence FOR the null: 1/REPBF10 #206 SDRBF <- repposteriorplot(n.orig, r.orig, n.rep, r.rep) SDRBF ################### # If you want to compute a Bayes factor for each study separately to # see whether there is an effect versus the null hypothesis that there is no effect, #with an "objective" uniform prior for the effect respresenting that it could be anywhere # between -1 and 1, you can use the following routine: r <- .934 n <- 9 BF <- corBF.beta(r, n) BF SDBF <- PosteriorPlot(n, r) SDBF r <- .03 n <- 31 BF <- corBF.beta(r, n) SDBF <- PosteriorPlot(n, r) BF SDBF