Compute the (positive/negative) likelihood ratio with appropriate, bootstrapped confidence intervals

Description

Compute the (positive/negative) likelihood ratio with appropriate, bootstrapped confidence intervals. A standard bootstrapping approach is used for sensitivity and specificity, results are combined, and then 95 For the case where sensitivity or specificity equals zero or one, an appropriate bootstrap sample is generated and then used in subsequent computations.

Usage

1
2
3
4
BayesianLR.test(truePos, totalDzPos, trueNeg, totalDzNeg, R = 10^4,
  nBSave = 50, verbose = FALSE, parameters = list(shrink = 5, tol = 5e-04,
  nEach = 80), maxTries = 20, ci.width = 0.95, consistentQuantile = 0.5,
  ...)

Arguments

truePos

The number of true positive tests.

totalDzPos

The total number of positives ("sick") in the population.

trueNeg

The number of true negatives in the population.

totalDzNeg

The total number of negatives ("well") in the population.

R

The number of replications in each round of the bootstrap (has been tested at 10,000 or greater).

nBSave

The number of times to re-bootstrap the statistic and then average at the end to obtain confidence intervals (has been tested at 50).

verbose

Whether to display internal operations as they happen.

parameters

List of control parameters (shrink, tol, nEach) for sequential search.

maxTries

Each time a run fails, BayesianLR.test will back off on the parameters and try again. maxTries specifies the number of times to try before giving up. If you can't get it to converge, try setting this higher.

ci.width

Changing this parameter results in different properties than have been tested and is not recommended. The width of the confidence interval used by boot.ci (not necessarily the same as the width of the CI produced by the algorithm overall)

consistentQuantile

Changing this parameter results in different properties than have been tested and is not recommended. Defaults to 0.5, i.e. the median. Finds the lowest probability for which the random draws are likely to be consistently one, where consistently is defined by this value (i.e. at .5, a simple majority of the time is enough for consistency).

...

Arguments to pass along to boot.ci for the BCa confidence intervals.

Details

If the denominator is 0, calculations are inverted until the final result.

Value

An object of class lrtest.

Note

You'll either need a fast computer or substantial patience for certain combinations of inputs.

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
29
30
31
32
33
34
35
36
37
38
39
## Not run: 
blrt <- BayesianLR.test( truePos=100, totalDzPos=100, trueNeg=60, totalDzNeg=100 )
blrt
summary(blrt)

BayesianLR.test( truePos=98, totalDzPos=100, trueNeg=60, totalDzNeg=100 )
BayesianLR.test( truePos=60, totalDzPos=100, trueNeg=100, totalDzNeg=100 )
BayesianLR.test( truePos=60, totalDzPos=100, trueNeg=99, totalDzNeg=100 )

# Note the argument names are not necessary if you specify them in the proper order:
BayesianLR.test( 60, 100, 50, 50 )

# You can specify R= to increase/decrease the number of bootstrap replications
BayesianLR.test( 60, 100, 50, 50, R=10000 )

# You can change the number of digits that are printed
print.lrtest( BayesianLR.test( 500, 500, 300, 500 ), digits = 4 )

# Or extract the results yourself
model.blrt1 <- BayesianLR.test( 500, 500, 300, 500 )
unclass( model.blrt1 )
model.blrt1$statistics
model.blrt1$posLR.ci

# If the model doesn't converge, you can alter the search parameters
BayesianLR.test( 500, 500, 300, 500, parameters=list(shrink=4,tol=.001,nEach=150), maxTries = 50 )

### Statistician-only options
# These change the way the model works.
# It is not recommended to alter these, as this will alter the statistical properties of the test
# in ways that have not been validated.
# Change number of bootstrap replications
BayesianLR.test( 500, 500, 300, 500, R = 5*10^4 )
# Change number of times to average the confidence interval limits at the end
BayesianLR.test( 500, 500, 300, 500, nBSave = 100 )
# Change the criteria from median being consistent 0 or 1 to some other quantile
BayesianLR.test( 500, 500, 300, 500, consistentQuantile = .53 )

## End(Not run)