View p-value_misconceptions_figures.R
options(scipen=999) #disable scientific notation for numbers
#Figure 1 & 2 (set to N <- 5000 for Figure 2)
# Set x-axis upper and lower scalepoint (to do: automate)
low_x<--1
high_x<-1
y_max<-2
#Set sample size per group and effect size d (assumes equal sample sizes per group)
N<-50 #sample size per group for indepndent t-test
View blog_hits.csv
NAME COMMENTS HITS DATE
Equivalence testing in jamovi 12 1870 14-3-2017
No the p-values are not to blame: Part 53 1 2675 10-3-2017
How p-values solve 50% of the problems with p-values 4 2273 6-3-2017
ROPE and Equivalence Testing: Practically Equivalent? 9 1991 12-2-2017
Examining Non-Significant Results with Bayes Factors and Equivalence Tests 26 2332 29-1-2017
Why Type 1 errors are more important than Type 2 errors (if you care about evidence) 32 7435 18-12-2016
TOST equivalence testing R package (TOSTER) and spreadsheet 8 3885 9-12-2016
Why Within-Subject Designs Require Fewer Participants than Between-Subject Designs 0 4792 12-11-2016
Improving Your Statistical Inferences Coursera course 7 3154 6-10-2016
View TOSTvsROPE.R
#Make sure JAGS is installed or R will crash: https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/
require(BEST) #To calculate HDI
require(TOSTER) #To calculate Equivalence Tests
set.seed(1)
x<-rnorm(100) #Generate 100 random normally distributed observations
y<-rnorm(100) #Generate 100 random normally distributed observations
#ROPE test
View volunteer_reanalysis.R
# Code from https://osf.io/aqi5j/ made by original authors, adapted by Daniel Lakens
# Download the csv file from https://osf.io/aqi5j/
# Paper: http://www.tandfonline.com/doi/full/10.1080/23743603.2016.1273647
require(car)
# IMPORTANT: change this to match your path/file
fileLocation <- 'C:\\Users\\Daniel\\surfdrive\\Data\\blog volunteer study\\VolunteeringDataFile_05.09.16.csv'
# Dienes functions
View 3dplotLR.R
#Create single plot for graph----
power <- seq(0.01,1,0.01)
alpha <- seq(0.01,1,0.01)
pH0 <- 0.5
tp<-((1-pH0)*power)
fp<-((pH0)*alpha)
likelihood_ratio<-outer(tp, fp, "/")
#Create color shading
nrz<-nrow (likelihood_ratio)
View WithinBetween.R
if(!require(ggplot2)){install.packages('ggplot2')}
library(ggplot2)
if(!require(Rcpp)){install.packages('Rcpp')}
library(Rcpp)
if(!require(MASS)){install.packages('MASS')}
library(MASS)
options(digits=10,scipen=999)
#Set color palette
View DanceBayesFactors.R
if(!require(BayesFactor)){install.packages('BayesFactor')}
library(BayesFactor)
#to get emoticons for each test, set wait to 0.5 and showfaces to 1.
#When running large number of simulations, set wait to 0 and showfaces to 0.
options(scipen=20) #disable scientific notation for numbers
waitx<-0.5 #To see a small wait between individual trials, set a wait time to e.g., 0.5
showfaces<-1 #Set to 0 if you do not want the faces, set to 1 if you want to see the faces
cohensd<-0.3 #set true effect size
n<-75 #sample size in each group
View test.R
if(!require(ggplot2)){install.packages('ggplot2')}
library(ggplot2)
if(!require(pwr)){install.packages('pwr')}
library(pwr)
nSims <- 100000 #number of simulated experiments
M<-106 #Mean IQ score in the sample
n<-26 #set sample size
SD<-15 #SD of the simulated data
View 4study_meta_50%_true_effects.R
if(!require(meta)){install.packages('meta')}
library(meta)
nSims <- 1000000 #number of simulated experiments
numberstudies<-4 # nSim/numberofstudies should be whole number
p <-numeric(nSims) #set up empty container for all simulated p-values
metapran <-numeric(nSims/numberstudies) #set up empty container for all simulated p-values for random effects MA
metapfix <-numeric(nSims/numberstudies) #set up empty container for all simulated p-values for fixed effects MA
heterog.p<-numeric(nSims/numberstudies) #set up empty container for test for heterogeneity
d <-numeric(nSims) #set up empty container for all simulated d's
View Fdist_tdist.R
df1<-1
df2<-100
critF<-qf(.95, df1=df1, df2=df2) #determine critical F-value
critT<-qt(.975, df2) #determine critical F-value
critF #critical F-value
critT^2 #Critical t squared is the same as critical F-value
critT #critical t-value
x=seq(0,10,length=10000)
maxy<-ifelse(max(df(x,df1,df2))==Inf,1, max(df(x,df1,df2))) #set maximum y axis