design.MSPRT: Designing the MSPRT

Description Usage Arguments Value Author(s) References Examples

View source: R/MSPRT.R

Description

Given the maximum available sample size and prespecified Type I & II error probabilities, this function designs/obtains the corresponding MSPRT.

Usage

1
2
3
4
5
6
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

  • oneProp for one-sample proportion tests

  • oneZ for one-sample z tests

  • oneT for one-sample t tests

  • twoZ for two-sample z tests

  • twoT for two-sample t tests.

side

Character. Direction of the composite alternative hypothesis. right for H_1 : θ > θ_0 (default), and left for H_1 : θ < θ_0.

theta0

Numeric. Hypothesized value of effect size (θ_0) under H_0.

Default: 0.5 in one-sample proportion tests, and 0 for others.

theta1

Logical, numeric or list (two components with names 'right' and 'left').

  • If FALSE, no comparison is done under the alternative hypothesis.

  • If TRUE (Default), comparison is done at the fixed-design alternative effect size (θ_a).

  • If numeric, this can only be in case of one-sided tests (that is, side = "right" or "left"). The comparison is done at the specified numeric value of the alternative effect size.

  • If list, this can only be in case of two-sided tests (that is, side = "both"). The list has to be of the form list("right" = θ_1, "left" = θ_2). Then the comparison is done at alternative effect sizes θ_1 and θ_2.

Note: In case of two-sided tests at a given level of significance, there are two effect sizes under H_1 (one on the right of H_0 and one on the left) that corresponds to the same Type II error probability (or power). This list provides users with the ability where he/she can replace θ_1 and θ_2 by any effect sizes from each side in the form of a list as mentioned above, and can get the designed MSPRT together with its operating characteristics at those effect sizes.

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 (θ_a).

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:

  • Proportion and z tests: rep(1, N.max).

  • t tests: c(2, rep(1, N.max-1)).

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:

  • z tests: rep(1, N1.max).

  • t tests: c(2, rep(1, N1.max-1)).

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:

  • z tests: rep(1, N2.max).

  • t tests: c(2, rep(1, N2.max-1)).

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 TRUE (default), returns messages of the current proceedings. Otherwise it doesn't.

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 theta1. Returned only if theta1 is TRUE or numeric.

N

List.

  • If theta1 = FALSE, the list has one component named H0. It stores an integer vector of length nReplicate. This is the vector of sample size required by the MSPRT for each of nReplicate Monte Carlo simulations under H_0.

  • If theta1 is TRUE or numeric, the list has two components named H0 and H1. Each of these stores an integer vector of length nReplicate. The stored vector under H0 is the same as in theta1 = FALSE. The H1 component stored the vector of sample size required by the MSPRT for each of nReplicate Monte Carlo simulations under the specified alternative effect size.

EN

Numeric vector.

  • If theta1 = FALSE, the vector is of length 1. It is the number of samples required on average by the MSPRT under H_0.

  • If theta1 is TRUE or numeric, the vector is of length 2. They are the number of samples required on average by the MSPRT under H_0 (first component) and the specified alternative effect size (second component), respectively.

UMPBT or theta.UMPBT

The UMPBT alternative. UMPBT in case of one-sample proportion test and theta.UMPBT in case of all the other tests. Their types are the same as their output from UMPBT.alt function.

Note: Not returned in t tests as it depends on the data.

theta1

Returned only if theta1 is anything but FALSE. Stores the effect size under H_1 where the operating characteristic of the MSPRT is obtained. Of the same type as the argument theta1.

Type2.fixed.design

Numeric in [0,1]. Type II error probability attained by the fixed design test with sample size N.max and Type I error probability Type1.target at the alternative effect size theta1.

RejectH0.threshold

Positive numeric. Threshold for rejecting H_0 in the MSPRT.

RejectH1.threshold

Positive numeric. Threshold for accepting H_1 in the MSPRT.

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.

  • If theta1 = FALSE the list has one component named H0.

  • theta1 is TRUE or numeric, the list has two components named H0 and H1.

    Each of the named components H0 and H1 contains a list with two components named Group1 and Group2. Each of these contains the same vector corresponding to Group-1 and Group-2. In each of these, it contains the sample size required by the MSPRT in each of nReplicate Monte Carlo simulations under the respective effect size for the respective group.

EN

List.

  • If theta1 = FALSE the list has one component named H0.

  • If theta1 is TRUE or numeric, the list has two components named H0 and H1.

Each of the named components H0 or H1 contains a list with two components named Group1 and Group2. In each of these, it contains the sample size required on average by the MSPRT under the respective effect size for the respective group.

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 theta1$right and theta1$left, respectively.

N

This is the same as in one-sided tests if theta1 is FALSE. If theta1 is TRUE or a two-component list with names right and left, this is a list with three components with names H0, right and left instead of a two-component list with names H0 and H1. Quantities stored under these components are the same as in one-sided tests except the quantities under right and left are the same performance of the designed MSPRT at the specified alternative effect sizes theta1$right and theta1$left, respectively.

EN

Numeric vector. The same as in one-sided tests if theta1 is FALSE. If theta1 is TRUE or a two-component list with names right and left, this is a numeric vector of length 3, where the first, second and third components are the average required sample size under H_0, and at the specified alternative effect sizes theta1$right and theta1$left, respectively.

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 length(batch.size) in one-sample tests, and to the length(batch1.size) and length(batch2.size) in two-sample tests.

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

 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
##### 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)

MSPRT documentation built on Nov. 13, 2020, 5:07 p.m.