Learn R Programming

GroupSeq (version 1.0)

searchForBound: calculate boundaries

Description

here its original description in the Fortran-Implementation from http://www.biostat.wisc.edu/landemets/ : "A naive searching algorithm. This starts at the previous boundary, moves in the direction of the current boundary, changes direction and reduces step size when target is overstepped. Stops when probability of estimate is within tolerance of target probability. Users may want to substitute a better routine: some unused variables are included to make this easier." I did substitute a better one - see Details.

Usage

searchForBound(lastGrid, numberOfIntegrationIntervalls, i, gridSize, probDifference, standardDeviation, lowerIntegrationLimit, upperIntegrationLimit, numberOfInterimAnalysis)

Arguments

lastGrid
is joint density from the previous analysis.
numberOfIntegrationIntervalls
is the number of intervals for numerical integration.
i
is the number of the current analysis.
gridSize
is the grid size (not used by current code).
probDifference
is the target probability.
standardDeviation
is the standard deviation of the process increment.
lowerIntegrationLimit
is the vector of lower integration limits.
upperIntegrationLimit
is the vector of upper integration limits.
numberOfInterimAnalysis
is the number of interim analyses.

Value

  • lowerIntegrationLimitis the vector of lower integration limits.
  • upperIntegrationLimitis the vector of upper integration limits.

Details

The Fortran Implementation used a naive search algorithm to calculate boundaries which did not noticeably matter to performance because of the great speed of Fortran. But in R it did matter, so i replaced it by an algorithm which is called in German "Sekanten-Verfahren". This one is based on the Newton Iteration but uses secants here considering we cannot derive our function The calculation obeys following pattern whereby $x_{k+1}$ converges against the value we are searching for. $x_{k+1} = x_{k}-x_{k-1}{f(x_{k})-f(x_{k-1})}*f(x_{k})$ If my method fails in converging which usually should not happen the function tries to calculate one more time with that more conservative and carefully method of the Fortran Implementation.

References

http://www.biostat.wisc.edu/landemets/

See Also

groupseq, tailProbability

Examples

Run this code
## function depends heavily on calculations before (e.g. 'lastGrid'), 
## so you don�t want to use it by manual and therefore an example is not useful

Run the code above in your browser using DataLab