Description Usage Arguments Details Value Examples
A function for constructing an object of class
powPar. Such an object is used for evaluating the user
defined 'power function' for a parameter range. All information that is
needed for calculating the power (e.g. a pilot data set) should be
provided by making use of the ... argument.
1 |
n |
A numeric vector, indicating for which sample sizes to evaluate the power function. |
theta |
A numeric vector that will be used for evaluating the
power function. The method |
xi |
A numeric vector that will be used for evaluating the power
function. Since for every element of |
... |
This arguemt is used to provide additional parameters
needed by the power function for calculating the power. This
parameters can be extracted using the function |
An object of class powPar is used to evaluate the 'power
function' for a range of n and theta and optionally for
several xi values.
The user can write a 'power function' and extract the individual
elements using the functions n, theta,
xi and pp.
It is a good practice to include everything that is needed for the calculation, also data sets etc.
To extract the vector of theta, instead of individual values, you can
use the method pp with the name theta.
For historical reasons: If the argument theta = NA the
argument theta.name (a character) has to be used, to indicate
the name of a numeric vector that was passed to the argument
(...). The same is true for the argument xi.
An object of the class powPar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## defining the range of n and theta to be evaluated
psi <- powPar(n = seq(from = 20, to = 60, by = 2),
theta = seq(from = 0.5, to = 1.5, by = 0.05)
)
## defining a power-function
powFun <- function(psi){
return(power.t.test(n = n(psi)/2, delta = theta(psi), sig.level = 0.05)$power)
}
## evaluating the power-function for all combinations of n and theta
calc <- powCalc(psi, statistic = powFun)
## adding example at theta of 1 and power of 0.9
pow <- powEx(calc, theta = 1)
## drawing the power plot
plot(pow,
xlab = "Difference",
ylab = "Total Sample Size")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.