Extracting actual elements from objects of class powPar {sse}R Documentation

Extracting an actual n, theta, and xi

Description

Extracting the actual n, theta, or xi from an object of class powPar. This method is needed within the function (referred to as power-function) needed for evaluating the power.

Usage

n(x)
theta(x)
xi(x)

Arguments

x

An object of class powPar.

Details

During the evaluation process with powCalc every combination of n, theta, and xi is evaluated. The described functions extracts the actual n, theta, or xi during the evaluation process. The evaluation process with powCalc changes the actual element to ensure that all combinations are evaluated.

When a powPar-object is created, the first element of n, theta, or xi is also set to be the actual element. This allows to use this method also outside the evaluation with powCalc for testing the power function.

Value

An integer value for n. A numeric value for theta and xi.

Note

Do not use the method pp inside the power-function e.g. like pp(x, "n"), because this would extract the whole sequence of n and not just the actual element.

See Also

pp, for extracting all other elements provided by the user (exept n, theta, and xi.

Examples

## 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.1),
              muA = 0,
              muB = 1)

## extracting all elements of psi individually, starting with the first
n(psi)
theta(psi)
xi(psi)

## extracting all elements, not just the actual:
pp(psi, name = "n")
pp(psi, name = "theta")
pp(psi, name = "xi")

## an example of usage
powFun <- function(psi){
  power.t.test(n = n(psi),
               delta = pp(psi, "muA") - pp(psi, "muB"),
               sd = theta(psi)
               )$power
}

## testing the power-function
powFun(psi)


[Package sse version 0.7-11 Index]