powCalc {sse} | R Documentation |
Power calculation
Description
The user-defined 'power-function' provided as statistic
will be
evaluated for the whole range of n
, theta
, and xi
as specified in the powPar-object.
Usage
powCalc(object, statistic, n.iter = NA, cluster = FALSE)
Arguments
object |
An object of class |
statistic |
A function that takes an object of class
|
n.iter |
A number specifying how often the power-function is evaluated. |
cluster |
Still experimental! This argument can be logical, indicating if the library parallel should be used or not, or numeric. In the latter case the number is passed as integer to the function makeCluster from library parallel. The default is FALSE. |
Details
If the statistic does not return the power (a numeric value
between 0 and 1) but returns a logical (TRUE or FALSE) the argument
n.iter
is expected. The statitic will then be evaluated
n.iter-times and the proportion of successes will be interpreted as
the power.
Value
An object of class powCalc.
Examples
## defining the range of n and theta to be evaluated
psi <- powPar(theta = seq(from = 0.5, to = 1.5, by = 0.1),
n = seq(from = 20, to = 60, by = 2),
muA = 0,
muB = 1)
## defining a power-function
powFun <- function(psi){
power.t.test(n = n(psi)/2,
delta = pp(psi, "muA") - pp(psi, "muB"),
sd = theta(psi)
)$power
}
## evaluating the power-function for all combinations of n and theta
calc <- powCalc(psi, powFun)