BTD_power {singcar} | R Documentation |
Power calculator for BTD
Description
Calculates approximate power, given sample size, using Monte Carlo simulation for the Bayesian test of deficit for a specified case score, mean and standard deviation for the control sample. The mean and standard deviation defaults to 0 and 1, so if no other values are given the case score is interpreted as deviation from the mean in standard deviations.
Usage
BTD_power(
case,
mean = 0,
sd = 1,
sample_size,
alternative = c("less", "greater", "two.sided"),
alpha = 0.05,
nsim = 1000,
iter = 1000
)
Arguments
case |
A single value from the expected case observation. |
mean |
The expected mean of the control sample. |
sd |
The expected standard deviation of the control sample. |
sample_size |
The size of the control sample, vary this parameter to see how the sample size affects power. |
alternative |
The alternative hypothesis. A string of either "less" (default), "greater" or "two.sided". |
alpha |
The specified Type I error rate. This can also be varied, with effects on power. |
nsim |
The number of simulations for the power calculation. Defaults to 1000 due to BTD already being computationally intense. |
iter |
The number of simulations used by the BTD. Defaults to 1000. |
Value
Returns a single value approximating the power of the test for the given parameters.
Examples
BTD_power(case = -2, mean = 0, sd = 1, sample_size = 20)