update: Updating a powCalc or a power object.

Description Usage Arguments Value Note See Also Examples

Description

A function for updating an existing object of class powCalc or power.

Usage

1
update(object, ...)

Arguments

object

An object of class powCalc or power.

...

The following elements (slots) of the object can be updated:

n.iter

A number indicating the number of iterations used to dertermine the power if the calcualation is based on resampling. The existing iterations will be kept. n.iter indicates the number of iterations after evaluation, therefore n.iter has to be equal or larger than the existing number of iterations.

n

A vector with numbers for evaluating the power. New elements will be evaluated and existing elements reused. If some elements of the original are not part of n they will be ommitted.

theta

see n for details.

xi

see n for details.

statistic

A function of an object of class psi. If a new statistic is provided all elements will be evaluated again.

Value

An object of class powCalc.

Note

Be careful if you use this function to update objects of class power.

See Also

powCalc for geneating new objcets of class powCalc.

Examples

 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
## 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)

## updating by using additional elements for "n"
calc2 <- update(calc, n = seq(from = 20, to = 90, by = 2))

## adding example at theta of 1 and power of 0.9
pow <- powEx(calc2, 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))

sse documentation built on May 19, 2021, 5:08 p.m.

Related to update in sse...