View install_flexjags.R
## First install the devtools package if necessary
devtools::install_github("richarddmorey/EssexSummerSchoolBayes", subdir = "shiny_demo/flexjags/flexjags/")
flexjags::run_flexjags()
View power.R
M = 1000
N = round(sort(rpois(M, 10)^1.5, decreasing = TRUE)) + 20
pows = c(.5,.8,.95)
setup = expand.grid(N=N, pow = pows)
es = mapply(FUN = function(n, power, alpha) power.t.test(n = n, sig.level = alpha, power = power)$delta,
n = setup$N, power = setup$pow, MoreArgs = list(alpha = .05))
dim(es) = c(setup$es,length(N), length(pows))
View showtext.Rmd
output
html_document
dev fig_width fig_height
svg
5
4
View analysis.R
## Paper is here: http://www.ejwagenmakers.com/2011/WetzelsEtAl2011_855.pdf
## Load the three data files
one_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_onesample.txt")
two_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_twosample.txt")
paired_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_pairedsample.txt")
# Define N1 and N2 for one sample tests
# for convenience
colnames(one_sample)[1] = "N1"
View file52f07dae14c2.md
data(attitude)
o = lm(rating ~ complaints, data = attitude)
par(mfrow=c(1,2), bg="white")
plot(rating ~ complaints, data = attitude)
abline(o, col = "red")
plot(o, ask = FALSE)
View file4eae56528d28.md
x = rnorm(1000)
y = rnorm(1000)
plot(x,y,pch=19,col=rgb(0,0,1,.2))

plot of chunk unnamed-chunk-2

View index.Rmd
runtime
shiny
require(shinyjs)
useShinyjs(rmd=TRUE)

observe({
  updateTextInput(session, 'ID', value = "Updated.")
View why_leave.R
## Richard D. Morey
## 3 Nov 2017
# Redirect plots to temp directory
# We just want the variables
wd = getwd()
setwd(tempdir())
source('https://osf.io/x73zq/download?version=1')
setwd(wd)
View bf_inv.R
## Given a (scaled Cauchy) Bayes factor for the null against the
## alternative (Rouder et al 2009), yields the t statistic
## that would yield it. The ... arguments are passed to
## the ttest.tstat function.
bf.inv = Vectorize(function(b10, ...){
fn = Vectorize(function(t,...){
BayesFactor::ttest.tstat(t,...)[["bf"]]
}, "t")
t0 = optimize(function(t0, ...){
View for_lakens.R
find.ncp = Vectorize(function(a=.05, b=.2, df=1){
cr = qchisq(1-a,df)
q = optimize(function(q){
(pchisq(cr,df,ncp=q/(1 - q)) - b)^2
},interval = c(0,1))$minimum
q / (1 - q)
},"b")
find.eb = Vectorize(function(a = 0.05, b = .2, df = 1){