Compute probability that z-test Bayes factor is smaller than a specified threshold (the power), or determine sample size to obtain a target power.
powerbf01(
n = NULL,
power = NULL,
k = 1/10,
sd = 1,
null = 0,
pm,
psd,
type = c("two.sample", "one.sample", "paired"),
dpm = pm,
dpsd = psd,
nrange = c(1, 10^5)
)Object of class "power.bftest", a list of the arguments
(including the computed one) augmented with method and note
elements
Sample size (per group for two-sample tests). Has to be NULL
if power is specified. Defaults to NULL
Target power. Has to be NULL if n is specified.
Defaults to NULL
Bayes factor threshold. Defaults to 1/10, Jeffreys' threshold
for 'strong evidence' against the null hypothesis
Standard deviation of one observation (for type =
"two.sample" or type = "one.sample") or of one difference within
a pair of observations (type = "paired"). Is assumed to be known.
Defaults to 1
Mean difference under the point null hypothesis. Defaults to
0
Mean of the normal prior assigned to the mean difference under the alternative in the analysis
Standard deviation of the normal prior assigned to the mean
difference under the alternative in the analysis. Set to 0 to
obtain a point prior at the prior mean
The type of test. One of "two.sample",
"one.sample", "paired". Defaults to "two.sample"
Mean of the normal design prior assigned to the mean difference.
Defaults to the same value as the analysis prior pm
Standard deviation of the normal design prior assigned to the
mean difference. Defaults to the same value as the analysis prior
psd
Sample size search range over which numerical search is
performed (only taken into account when n is NULL).
Defaults to c(1, 10^5)
Samuel Pawel
This function provides a similar interface as
stats::power.t.test. It also assumes that the data are continuous
and that the parameter of interest is either a mean or a (standardized)
mean difference. For some users, the low-level functions nbf01 (to
directly compute the sample size for a fixed power) and pbf01 (to
directly compute the power for a fixed sample size) may also be useful
because they can be used for other data and parameter types.
plot.power.bftest, nbf01, pbf01, bf01
## determine power
powerbf01(n = 100, pm = 0, psd = 1, dpm = 0.5, dpsd = 0)
## determine sample size
powerbf01(power = 0.99, pm = 0, psd = 1, dpm = 0.5, dpsd = 0)
Run the code above in your browser using DataLab