samplesize {BetaPASS} | R Documentation |
Find minimum sample size with Beta distribution
Description
Find minimum sample sizes with Beta distribution and given mu0,sd0,mu1 and target powers.
Usage
samplesize(mu0, sd0, mu1.start, mu1.end = NULL, mu1.by = NULL,
power.start, power.end = NULL, power.by = NULL, sig.level = 0.05,
trials = 100, delta = 1, seed = 1, link.type = "logit",
equal.precision = TRUE, sd1 = NULL)
Arguments
mu0 |
mean for the control group |
sd0 |
standard deviation for the control group |
mu1.start |
starting value of mean for the treatment group under the alternative mu1 |
mu1.end |
ending value of mean for the treatment group under the alternative mu1 |
mu1.by |
step length of mean for the treatment group under the alternative mu1 |
power.start |
starting value of target power |
power.end |
ending value of target power |
power.by |
step length of target power |
sig.level |
significant level; default value is 0.05 |
trials |
number of trials; default value is 100 |
delta |
accuracy of the result; must be integer |
seed |
seed used in the simulation |
link.type |
type of link used in the beta regression. Default link is "logit". Other link options include: "logit", "probit", "cloglog", "log", "loglog", "wilcoxon", or you can use "all" for all types of link |
equal.precision |
equal dispersion parameter assumption in simulation |
sd1 |
standard deviation for the treatment group. Only applicable when equal.precision = FALSE |
Details
The samplesize function allows you to control the number of trials in the simulation,
the target power, delta, and the alternative means.
You can fix the alternative and vary power to match a desired sample size;
Use default values for the number of trials for a quick view;
Use a larger number of trials (say 1000) and a smaller delta (say 1) to get better estimates.
The plot function will return a series of plots equal to the number of mu1 used in the procedure.
Type of link used in the beta regression. You can choose one or more of the following: "logit", "probit", "cloglog", "cauchit", "log", "loglog", "all".
Y-axis denotes minimum sample size and X-axis denotes minimum power.
Value
Return a samplesize object including basic settings (mean and standard deviation for the control group, significant level, number of trials and link types), and a matrix of estimated power with given mu1 and target power.
minimum sample size: link type: |
minimum sample size for given given mu0, sd0, mu1, target power and type of link. |
minimum power: link type: |
the minimum power greater than or equal to target power. |
target power: |
target power. |
mu1: |
mean for the treatment group under alternative. |
Examples
SSmat <- samplesize(mu0=0.56, sd0=0.255, mu1.start = 0.75,
power.start = 0.8, power.end = 0.9, power.by = 0.1,
trials = 25, link.type = c("log","wilcoxon"))
## show the results
SSmat
## add plot
plot(SSmat, link.type = c("log","wilcoxon"))