This compares a sequence of values with two sequences of thresholds, namely upper and lower thresholds. At any step, it rejects if the value gets larger than the upper threshold, accepts if it becomes smaller than the lower threshold, and remains inconclusive if it stays in between until the end. If it stays inconclusive at the last step, this function compares the last value with the termination threshold. If the value is larger than the termination threshold, it rejects; otherwise, it accepts.
As a particular case, this function sequentially checks the likelihood ratios with the upper, lower and termination thresholds according to the MSPRT algorithm (Algorithm 1 in the supplemental file).
This function can be readily adapted to Group sequential designs by specifying batch.seq
(in one-sample tests), and batch1.seq
& batch2.seq
(in two-sample tests) accordingly.
check(test.type, statistic, upper, lower,
batch.seq, batch1.seq, batch2.seq, threshold)
a character; denotes the type of test;
``oneProp
'' for a one-sample proportion test
``oneZ
'' for a one-sample Z-test
``oneT
'' for a one-sample T-test
``twoZ
'' for a two-sample Z-test
``twoT
'' for a two-sample T-test
a numeric vector; contains a sequence of values which we want to compare.
In particular for the MSPRT, this is a vector of sequentially calculated likelihood ratios (\(L_n\)).
It's length should not exceed the length of batch.seq
in one-sample tests, and length of batch1.seq
(or batch2.seq
) in two-sample tests.
a numeric vector; the sequence of upper threshold.
It's length should be equal to the length of batch.seq
in one-sample tests, and length of batch1.seq
(or batch2.seq
) in two-sample tests.
a numeric vector; the sequence of lower threshold.
It's length should be equal to the length of batch.seq
in one-sample tests, and length of batch1.seq
(or batch2.seq
) in two-sample tests.
a numeric vector; required only in one-sample tests.
an increasing sequence of sample size values where data are supposed to be observed sequentially
a numeric vector; required only in two-sample tests.
an increasing sequence of sample size values where data from Group-1 are supposed to be observed sequentially
a numeric vector; required only in two-sample tests.
an increasing sequence of sample size values where data from Group-2 are supposed to be observed sequentially
a positive numeric; the termination threshold in a MSPRT.
In one-sample tests, this returns a list containing the following elements:
a character; the final decision that is made.
Either "accept"
, "reject"
or "continue"
.
a numeric (positive integer); number of samples needed for reaching the decision
a numeric (positive integer); the step where the decision was reached at
In two-sample tests this returns a similar list as above, except now n is replaced by n1 & n2 having the following descriptions:
a numeric (positive integer); number of samples needed from Group-1 for reaching the decision
a numeric (positive integer); number of samples needed from Group-2 for reaching the decision
Suppose in a one-sample test, we can affrod at most 100 samples and observe the data after every sample. In this case, the batch.seq
will be 1:100
.
In another scenario, suppose we observe the data in groups at every 10th sample. In this case, the batch.seq
will be seq( from=10, to=100, by=10)
. So there are at most 10 batches/steps where we can observe the data and compare.
Once the \(L_n\)'s, the upper and lower thresholds, and the termination threshold are provided, this function implements the Algorithm 1 in the supplemental file.