searchForBound {GroupSeq} | R Documentation |
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.
searchForBound(lastGrid, numberOfIntegrationIntervalls, i, gridSize, probDifference, standardDeviation, lowerIntegrationLimit, upperIntegrationLimit, numberOfInterimAnalysis)
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. |
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} = frac{ 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.
lowerIntegrationLimit |
is the vector of lower integration limits. |
upperIntegrationLimit |
is the vector of upper integration limits. |
This function is meant to be called in context of using groupseq
Roman Pahl
http://www.biostat.wisc.edu/landemets/
## 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