Title: | Sequential Generalized Likelihood Ratio Decision Boundaries Proposed by Shih, Lai, Heyse and Chen (2010, <doi:10.1002/Sim.4036>) |
---|---|
Description: | We provide functions for computing the decision boundaries for pre-licensure vaccine trials using the Generalized Likelihood Ratio tests proposed by Shih, Lai, Heyse and Chen (2010, <doi:10.1002/sim.4036>). |
Authors: | Balasubramanian Narasimhan (with input from Tze Lai and Mei-Chiung Shih) |
Maintainer: | Balasubramanian Narasimhan <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.8 |
Built: | 2024-11-20 03:49:58 UTC |
Source: | https://github.com/cran/sglr |
This package is an implementation of the methodology of Shih, Lai, Heyse, and Chen (to appear in Statistics in Medicine) for computing Generalized Likelihood Ratio test boundaries for pre-licensure vaccine studies
Package: | sglr |
Type: | Package |
Version: | 0.05 |
Date: | 2010-04-20 |
License: | GPL (version 2 or later) |
LazyLoad: | yes |
The package provides several functions. The function glrSearch
computes boundaries for testing a given versus
(specified as a two-dimensional vector) given a significance level
and a type II error
. The function
computeBoundary
computes the boundary in terms of a more
understandable and usable quantity, such as the number of adverse
events in a pre-licensure vaccine study for example. It takes as input
a set of given boundaries for the GLR statistic. The third function is
plotBoundary
which also takes the same arguments as
and produces a plot. The last two functions can
make use of statistics computed previously for the problem, which can
be specified as an argument; otherwise, the statistics are computed
from scratch.
Balasubramanian Narasimhan with input from Tze Lai and Mei-Chiung Shih. Maintainer: Balasubramanian Narasimhan <[email protected]>
“Sequential Generalized Likelihood Ratio Tests for Vaccine Safety Evaluation” doi:10.1002/sim.4036.
library(sglr) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10) ## print(result) ## large amounts of output possible! result[1:3]
library(sglr) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10) ## print(result) ## large amounts of output possible! result[1:3]
This function computes the boundary of the decision region in a manner that can be employed in the field, as a table, for example. See section 4.2 of the reference below.
computeBoundary(b1, b0, p, glrTables = NULL, tol=1e-7)
computeBoundary(b1, b0, p, glrTables = NULL, tol=1e-7)
b1 |
The acceptance boundary value (corresponds to the boundary |
b0 |
The rejection boundary value (corresponds to the boundary |
p |
The vector of probabilities, |
glrTables |
A previously computed set of likelihood functions, to speed up computation for the same hypothesis testing problem. Otherwise, it is computed ab initio, resulting in a longer running time. |
tol |
A numerical tolerance, defaults to 1e-7 |
This essentially computes the probabilities of hitting the boundaries using a recursion.
upper |
The upper boundary that indicates rejection of the null hypothesis |
lower |
The upper boundary that indicates acceptance of the null hypothesis |
estimate |
The estimated |
Balasubramanian Narasimhan
“Sequential Generalized Likelihood Ratio Tests for Vaccine Safety Evaluation” doi:10.1002/sim.4036.
See Also glrSearch
computeBoundary(b1=2.8, b0=3.3, p=c(.5, .75))
computeBoundary(b1=2.8, b0=3.3, p=c(.5, .75))
The search through the space of (corresponds to
in
paper) and
(corresponds to
in paper) is greedy
initially. Then refinements to the boundary are made by adjusting the
boundaries by the step-size. It is entirely possible that the
step-size is so small that a maximum number of iterations can be
reached. Depending on how close
and
are the memory
usage can grow significantly. The process is computationally intensive
being dominated by a recursion deep in the search.
glrSearch(p, alpha, beta, stepSize = 0.5, tol = 1e-7, startB1 = log(1/beta), startB0 = log(1/alpha), maxIter = 25, gridIt = FALSE, nGrid = 5, verbose = FALSE)
glrSearch(p, alpha, beta, stepSize = 0.5, tol = 1e-7, startB1 = log(1/beta), startB0 = log(1/alpha), maxIter = 25, gridIt = FALSE, nGrid = 5, verbose = FALSE)
p |
The vector of |
alpha |
A value for type I error |
beta |
A value for type II error ( |
stepSize |
A value to use for moving the boundaries during the search, 0.5 default seems to work. |
tol |
A value that is used for deciding when to terminate the search. A euclidean metric is used. Default 1e-7. |
startB1 |
A starting value for the futility boundary, default is log of reciprocal type I error |
startB0 |
A starting value for the rejection boundary, default is log of reciprocal type II error |
maxIter |
A maximum number of iterations to be used for the search. This allows for a bailout if the step size is too small. |
gridIt |
A logical value indicating if a grid of values should be evaluated once the boundaries are bracketed in the search. |
nGrid |
The number of grid points to use, default 5 |
verbose |
A logical flag indicating if you want verbose output during search. Useful for situations where the code gets confused. |
One should not use this code without a basic understanding of the Shih, Lai, Heyse and Chen paper cited below, particularly the section on the pre-licensure vaccine trials.
As the search can be computationally intensive, the program needs to use some variables internally by reference, particularly large tables that stay constant.
In our experiments, starting off with the default step size has usually worked, but in other cases the step size and the maximum number of iterations may need to be adjusted.
b1 |
The explored values of the futility boundary
|
b0 |
The explored values of the rejection boundary
|
estimate |
The estimated |
glrTables |
The constant values of the log likelihoods under
|
alphaTable |
a matrix (nGrid x nGrid) of |
betaTable |
a matrix (nGrid x nGrid) of |
b1Vals |
the vector of |
b0Vals |
the vector of |
iterations |
The number of iterations actually used |
Balasubramanian Narasimhan
“Sequential Generalized Likelihood Ratio Tests for Vaccine Safety Evaluation” doi:10.1002/sim.4036.
library(sglr) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10, verbose=TRUE) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10, gridIt=TRUE) print(result$alphaTable) print(result$betaTable) ## takes a while result <- glrSearch(p=c(.5, 2/3), alpha=0.05, beta=0.10) print(names(result)) ##result <- glrSearch(p=c(.5, 2/3), alpha=0.05, beta=0.10, gridIt=TRUE) ##print(result$alphaTable) ##print(result$betaTable)
library(sglr) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10, verbose=TRUE) result <- glrSearch(p=c(.5, .75), alpha=0.05, beta=0.10, gridIt=TRUE) print(result$alphaTable) print(result$betaTable) ## takes a while result <- glrSearch(p=c(.5, 2/3), alpha=0.05, beta=0.10) print(names(result)) ##result <- glrSearch(p=c(.5, 2/3), alpha=0.05, beta=0.10, gridIt=TRUE) ##print(result$alphaTable) ##print(result$betaTable)
This function attempts to plot the boundary of the decision region, but currently falls flat. Will be rewritten.
plotBoundary(b1, b0, p, glrTables = NULL, tol = 1e-7, legend =FALSE, textXOffset = 2, textYSkip = 2)
plotBoundary(b1, b0, p, glrTables = NULL, tol = 1e-7, legend =FALSE, textXOffset = 2, textYSkip = 2)
b1 |
The acceptance boundary value (corresponds to the boundary |
b0 |
The rejection boundary value (corresponds to the boundary |
p |
The vector of probabilities, |
glrTables |
A previously computed set of likelihood functions, to speed up computation for the same hypothesis testing problem. This can speed up computations. |
tol |
The tolerance, default of 1e-7 |
legend |
A flag indicating if a legend is desired or not, default false |
textXOffset |
Horizontal offset for legend text |
textYSkip |
Vertical skip for legend text |
This essentially computes the recursion and the probabilities of hitting the boundaries and returns a ggplot2 object
A ggplot2 object
Balasubramanian Narasimhan
See Also glrSearch
plotBoundary(b1=2.8, b0=3.3, p=c(.5, .75))
plotBoundary(b1=2.8, b0=3.3, p=c(.5, .75))