design.MSPRT {MSPRT} | R Documentation |
Designing the MSPRT
Description
Given the maximum available sample size and prespecified Type I & II error probabilities, this function designs/obtains the corresponding MSPRT.
Usage
design.MSPRT(test.type, side = "right", theta0, theta1 = T,
Type1.target = 0.005, Type2.target = 0.2,
N.max, N1.max, N2.max,
sigma = 1, sigma1 = 1, sigma2 = 1,
batch.size, batch1.size, batch2.size,
nReplicate = 1e+06, verbose = T, seed = 1)
Arguments
test.type |
Character. Type of test. Currently, the package only allows
|
side |
Character. Direction of the composite alternative hypothesis. |
theta0 |
Numeric. Hypothesized value of effect size ( Default: 0.5 in one-sample proportion tests, and 0 for others. |
theta1 |
Logical, numeric or list (two components with names
Note: In case of two-sided tests at a given level of significance, there are two effect sizes under |
Type1.target |
Numeric within [0,1]. Prespecified level of Type I error probability. Default: 0.005. The MSPRT exactly maintains its Type I error probability at this value. |
Type2.target |
Numeric within [0,1]. Prespecified level of Type 2 error probability. Default: 0.2. The MSPRT approximately maintains its Type II error probability at this value at the corresponding fixed-design alternative ( |
N.max |
Positive integer. Maximum available sample size in one-sample tests. |
N1.max |
Positive integer. Maximum available sample size from Group-1 in two-sample tests. |
N2.max |
Positive integer. Maximum available sample size from Group-2 in two-sample tests. |
sigma |
Positive numeric. Known standard deviation in one-sample z tests. Default: 1. |
sigma1 |
Positive numeric. Known standard deviation for Group-1 in two-sample z tests. Default: 1. |
sigma2 |
Positive numeric. Known standard deviation for Group-2 in two-sample z tests. Default: 1. |
batch.size |
Integer vector. A vector denoting the number of observations that are planned to be observed at each sequential step in one-sample tests. Default:
Default values mean the sequential analysis is performed after observing each observation. This corresponds to a sequential MSPRT. If any batch size is more than 1 (or more than 2 in the 1st step for t test) it corresponds to a group sequential MSPRT. Note: First batch size for t tests needs to be at least 2. The length of batch.size equals to the maximum number of planned sequential analyses. |
batch1.size |
Integer vector. A vector denoting the number of observations that are planned to be observed from Group-1 at each sequential step in two-sample tests. Default:
Default values mean the sequential analysis is performed after observing each observation from Group-1. |
batch2.size |
Integer vector. A vector denoting the number of observations that are planned to be observed from Group-2 at each sequential step in two-sample tests. Default:
Default values mean the sequential analysis is performed after observing each observation from Group-2. |
nReplicate |
Positive integer. Total number of replications to be used in Monte Carlo simulation for calculating the termination threshold and the operating characteristics of the MSPRT. Default: 1,000,000. |
verbose |
Logical. If |
seed |
Integer. Random number generating seed. Default: 1. |
Value
List. The list has the following named components in case of one-sided one-sample tests:
TypeI.attained |
Numeric in [0,1]. Type I error probability attained by the designed MSPRT. |
Type2.attained |
Numeric in [0,1]. Type II error probability attained by the designed MSPRT at the specified alternative effect size |
N |
List.
|
EN |
Numeric vector.
|
UMPBT or theta.UMPBT |
The UMPBT alternative. Note: Not returned in t tests as it depends on the data. |
theta1 |
Returned only if |
Type2.fixed.design |
Numeric in [0,1]. Type II error probability attained by the fixed design test with sample size |
RejectH0.threshold |
Positive numeric. Threshold for rejecting |
RejectH1.threshold |
Positive numeric. Threshold for accepting |
termination.threshold |
Positive numeric. Termination threshold of the MSPRT. |
In case of one-sided two-sample tests the above components are returned with following modifications:
N: |
List.
|
EN |
List.
Each of the named components |
In case of two-sided tests the above components are returned with following modifications:
Type2.attained |
Numeric vector of length 2 with both elements in [0,1]. The first and second component is the Type II error probability of the MSPRT at the specified alternative effect sizes |
N |
This is the same as in one-sided tests if |
EN |
Numeric vector. The same as in one-sided tests if |
Additionally, the output list also contains the provided arguments of design.MSPRT, and
nAnalyses |
Positive integer. This is the maximum number of sequential analyses that is planned. This equals to the |
Author(s)
Sandipan Pramanik, Valen E. Johnson and Anirban Bhattacharya
References
Pramanik S., Johnson V. E. and Bhattacharya A. (2020+). A Modified Sequential Probability Ratio Test. [Arxiv]
Examples
##### one-sample proportion test #####
## right-sided
#design.MSPRT(test.type = 'oneProp', side = 'right',
# N.max = 20)
## left-sided
#design.MSPRT(test.type = 'oneProp', side = 'right',
# N.max = 20)
## two-sided
#design.MSPRT(test.type = 'oneProp', side = 'both',
# N.max = 20)
##### one-sample z test #####
## right-sided
#design.MSPRT(test.type = 'oneZ', side = 'right',
# N.max = 20)
## left-sided
#design.MSPRT(test.type = 'oneZ', side = 'right',
# N.max = 20)
## two-sided
#design.MSPRT(test.type = 'oneZ', side = 'both',
# N.max = 20)
##### one-sample t test #####
## right-sided
#design.MSPRT(test.type = 'oneT', side = 'right',
# N.max = 20)
## left-sided
#design.MSPRT(test.type = 'oneT', side = 'right',
# N.max = 20)
## two-sided
#design.MSPRT(test.type = 'oneT', side = 'both',
# N.max = 20)
##### two-sample z test #####
## right-sided
#design.MSPRT(test.type = 'twoZ', side = 'right',
# N1.max = 20, N2.max = 20)
## left-sided
#design.MSPRT(test.type = 'twoZ', side = 'left',
# N1.max = 20, N2.max = 20)
## two-sided
#design.MSPRT(test.type = 'twoZ', side = 'both',
# N1.max = 20, N2.max = 20)
##### two-sample t test #####
## right-sided
#design.MSPRT(test.type = 'twoT', side = 'right',
# N1.max = 20, N2.max = 20)
## left-sided
#design.MSPRT(test.type = 'twoT', side = 'left',
# N1.max = 20, N2.max = 20)
## two-sided
#design.MSPRT(test.type = 'twoT', side = 'both',
# N1.max = 20, N2.max = 20)