Find minimum sample sizes with Beta distribution and given mu0,sd0,mu1 and target powers.
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)
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 for given given mu0, sd0, mu1, target power and type of link.
the minimum power greater than or equal to target power.
target power.
mean for the treatment group under alternative.
mean for the control group
standard deviation for the control group
starting value of mean for the treatment group under the alternative mu1
ending value of mean for the treatment group under the alternative mu1
step length of mean for the treatment group under the alternative mu1
starting value of target power
ending value of target power
step length of target power
significant level; default value is 0.05
number of trials; default value is 100
accuracy of the result; must be integer
seed used in the simulation
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 dispersion parameter assumption in simulation
standard deviation for the treatment group. Only applicable when equal.precision = FALSE
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.
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"))
Run the code above in your browser using DataLab