Skip to content

Instantly share code, notes, and snippets.

@richarddmorey
Last active November 27, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richarddmorey/ea7a06f006b201042021 to your computer and use it in GitHub Desktop.
Save richarddmorey/ea7a06f006b201042021 to your computer and use it in GitHub Desktop.
log scale demo
t = 2
N = 25
# Create vector of r values from one-fifth the default to five times
# the default; a *huge* range
r = exp(seq(-log(5),log(5),len=100)+log(sqrt(2)/2))
# Compute BF
bf = sapply(r, function(r) BayesFactor::ttest.tstat(t,N,rscale = r,simple=TRUE))
# Plots
par(mfrow=c(1,2),las=1)
# Not log scaled
plot(r,bf,ty='l')
abline(v=sqrt(2)/2,col="gray")
# Log scaled
plot(r,bf,ty='l',log="xy")
abline(v=sqrt(2)/2,col="gray")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment