Description Usage Arguments Details Value Note Examples
A function for constructing an object of class power used for drawing an example in a sensitivity plot and for estimating the sample size.
1 2 3 |
x |
An object of class powCalc. |
theta |
a numeric value indicating for which |
xi |
a numeric value, as |
endpoint |
Object of class |
power |
Object of class |
method |
Defining the method how the sample size for the is
calculated. |
lm.range |
The range of evaluations that are used for estimating
the sample size if the |
drop |
Object of class |
forceDivisor |
If |
For method equal to "lm" a linear model is fit as
lm(sample.size ~ transformed(power)) with all data where theta, and xi
are equal to the theta and xi of the example and within the
power-range as defined by the argument lm.range. This model is
then used for predicting the sample size. Always inspect the result
using inspect!
The method "step" returns the last element in the sequence of sample sizes - power pairs, sorted with decreasing power, where the power is above the power defined for the example.
An object of class power.
In older verstions of the package: The function merge was
used together with an object of class powEx to form an
object of class power.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## 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)
## adding example at theta of 1 and power of 0.9
pow <- powEx(calc, theta = 1, power = 0.9)
## drawing the power plot with 3 contour lines
plot(pow,
xlab = "Standard Deviation",
ylab = "Total Sample Size",
at = c(0.85, 0.9, 0.95))
## changing the estimation method
pow2 <- powEx(calc, theta = 1, power = 0.9, method = "lm")
## drawing an inspection plot
inspect(pow2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.