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.
BTD_power(
case,
mean = 0,
sd = 1,
sample_size,
alternative = c("less", "greater", "two.sided"),
alpha = 0.05,
nsim = 1000,
iter = 1000
)
Returns a single value approximating the power of the test for the given parameters.
A single value from the expected case observation.
The expected mean of the control sample.
The expected standard deviation of the control sample.
The size of the control sample, vary this parameter to see how the sample size affects power.
The alternative hypothesis. A string of either "less" (default), "greater" or "two.sided".
The specified Type I error rate. This can also be varied, with effects on power.
The number of simulations for the power calculation. Defaults to 1000 due to BTD already being computationally intense.
The number of simulations used by the BTD. Defaults to 1000.
BTD_power(case = -2, mean = 0, sd = 1, sample_size = 20)
Run the code above in your browser using DataLab