visualize_prior: Visualize a prior on Cohen's d for a Bayesian t-test

View source: R/Visualizations.R

visualize_priorR Documentation

Visualize a prior on Cohen's d for a Bayesian t-test

Description

Visualize a prior on Cohen's d for a Bayesian t-test

Usage

visualize_prior(alternative = function(x) dcauchy(x, scale = sqrt(2)/2),
  null = TRUE, from = -4, to = 4, xlab = "Cohen's d",
  frame.plot = FALSE, col = "red", lwd = 3, ...)

Arguments

alternative

A function object. The default is a Cauchy prior with scaling parameter 'sqrt(2) / 2' as is the default in package 'BayesFactor' (Morey & Rouder, 2015). This argument can also be a scalar number, in which case it is assumed that the alternative is a point hypothesis on Cohen's d (with Cohen's d = 'prior').

null

Boolean. Plot a line on x = 0 representing the null hypothesis?

from

the left margin of the x-axis

to

the right margin of the x-axis

xlab

the label of the x-axis

frame.plot

Should a frame be drawn?

col

The color of the curve of the alternative hypothesis.

lwd

The line width

...

additional parameters passed to function 'curve'

References

Morey, R. D., & Rouder, J. N. (2015). BayesFactor: Computation of bayes factors for common designs. Retrieved from https://CRAN.R-project.org/package=BayesFactor

Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D., & Iverson, G. (2009). Bayesian t tests for accepting and rejecting the null hypothesis. Psychonomic Bulletin & Review, 16(2), 225–237.

Examples

## Standard cauchy prior:
visualize_prior()
## Wide cauchy prior:
visualize_prior(function(x) dcauchy(x, scale = 1))
## Normal prior with M = 0 and SD = 0.4
visualize_prior(function(x) dnorm(x, 0, 0.4))
## Point prior on Cohen's d = 0.4
visualize_prior(0.4)


m-Py/bayesEd documentation built on Feb. 25, 2023, 5:35 p.m.