powerbf01 {bfpwr} | R Documentation |
Power and sample size calculations for z-test Bayes factor
Description
Compute probability that z-test Bayes factor is smaller than a specified threshold (the power), or determine sample size to obtain a target power.
Usage
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)
)
Arguments
n |
Sample size (per group for two-sample tests). Has to be |
power |
Target power. Has to be |
k |
Bayes factor threshold. Defaults to |
sd |
Standard deviation of one observation (for |
null |
Mean difference under the point null hypothesis. Defaults to
|
pm |
Mean of the normal prior assigned to the mean difference under the alternative in the analysis |
psd |
Standard deviation of the normal prior assigned to the mean
difference under the alternative in the analysis. Set to |
type |
The type of test. One of |
dpm |
Mean of the normal design prior assigned to the mean difference.
Defaults to the same value as the analysis prior |
dpsd |
Standard deviation of the normal design prior assigned to the
mean difference. Defaults to the same value as the analysis prior
|
nrange |
Sample size search range over which numerical search is
performed (only taken into account when |
Details
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.
Value
Object of class "power.bftest"
, a list of the arguments
(including the computed one) augmented with method
and note
elements
Note
A warning message will be displayed in case that the specified target power is not achievable under the specified analysis and design priors.
Author(s)
Samuel Pawel
See Also
plot.power.bftest, nbf01, pbf01, bf01
Examples
## 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)