OCandASN.MSPRT: Operating characteristics (OC) and Average Sample Number...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/MSPRT.R

Description

This function obtains the operating characteristics, that is the probability of accepting H_0 and the sample size required on average for reaching a decision, for a designed MSPRT at the specified effect size(s).

Usage

1
2
3
4
5
6
7
8
OCandASN.MSPRT(theta, design.MSPRT.object, 
               termination.threshold, test.type, side = "right", 
               theta0, 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, nCore = max(1, detectCores() - 1),
               verbose = T, seed = 1)

Arguments

theta

Numeric vector. Vector of effect size(s) where the operating characteristics of the MSPRT is desired.

design.MSPRT.object

List. The output returned from design.MSPRT corresponding to the MSPRT for which the operating characteristics are desired.

termination.threshold

Positive numeric. Termination threshold of the designed MSPRT.

test.type

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

side

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

theta0

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

Type1.target

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

Type2.target

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

N.max

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

N1.max

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

N2.max

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

sigma

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

sigma1

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

sigma2

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

batch.size

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

batch1.size

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

batch2.size

Same as in design.MSPRT. Not required if design.MSPRT.object is provided.

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.

nCore

Positive integer. Total number of cores available for computation. Can be anything ≥ 1.

Default: detectCores() - 1. That is, 1 less than the total number of available cores.

seed

Integer. Random number generating seed.

Default: 1.

Details

If design.MSPRT.object is provided, one can only additionally provide nReplicate, nCore, verbose and seed (Easier option). Otherwise, just like in design.MSPRT, all the other arguments together with termination.threshold (obtained from design.MSPRT) needs to be provided adequately.

Value

Data frame.

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
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#################### one-sample proportion test ####################

#### right sided ####
### design
#design.oneprop.right <- design.MSPRT(test.type = 'oneProp', side = 'right',
#                                     N.max = 20)

### OC and ASN
#OC.oneprop.right <- OCandASN.MSPRT(theta = seq(design.oneprop.right$theta0, 1,
#                                               length.out = 3),
#                                   design.MSPRT.object = design.oneprop.right)

#### left sided ####
### design
#design.oneprop.left = design.MSPRT(test.type = 'oneProp', side = 'left',
#                                   N.max = 20)

### OC and ASN
#OC.oneprop.left = OCandASN.MSPRT(theta = seq(0, design.oneprop.right$theta0,
#                                             length.out = 3),
#                                 design.MSPRT.object = design.oneprop.left)

#### both sided ####
### design
#design.oneprop.both = design.MSPRT(test.type = 'oneProp', side = 'both',
#                                   N.max = 20)

### OC and ASN
#OC.oneprop.both = OCandASN.MSPRT(theta = seq(0, 1, length.out = 3),
#                                 design.MSPRT.object = design.oneprop.both)


#################### one-sample z test ####################

#### right sided ####
### design
#design.onez.right = design.MSPRT(test.type = 'oneZ', side = 'right',
#                                 N.max = 20)

### OC and ASN
#OC.onez.right = OCandASN.MSPRT(theta = seq(design.onez.right$theta0,
#                                           design.onez.right$theta0 + 3*design.onez.right$sigma,
#                                           length.out = 3),
#                               design.MSPRT.object = design.onez.right)

#### left sided ####
### design
#design.onez.left = design.MSPRT(test.type = 'oneZ', side = 'left',
#                                N.max = 20)

### OC and ASN
#OC.onez.left = OCandASN.MSPRT(theta = seq(design.onez.left$theta0 - 3*design.onez.left$sigma,
#                                          design.onez.left$theta0,
#                                          length.out = 3),
#                              design.MSPRT.object = design.onez.left)

#### both sided ####
### design
#design.onez.both = design.MSPRT(test.type = 'oneZ', side = 'both',
#                                N.max = 20)

### OC and ASN
#OC.onez.both = OCandASN.MSPRT(theta = seq(design.onez.both$theta0 - 3*design.onez.both$sigma,
#                                          design.onez.both$theta0 + 3*design.onez.both$sigma,
#                                          length.out = 3),
#                              design.MSPRT.object = design.onez.both)


#################### one-sample t test ####################

#### right sided ####
### design
#design.onet.right = design.MSPRT(test.type = 'oneT', side = 'right',
#                                 N.max = 20)

### OC and ASN
#OC.onet.right = OCandASN.MSPRT(theta = seq(design.onet.right$theta0, 1,
#                                           length.out = 3),
#                               design.MSPRT.object = design.onet.right)

#### left sided ####
### design
#design.onet.left = design.MSPRT(test.type = 'oneT', side = 'left',
#                                N.max = 20)

### OC and ASN
#OC.onet.left = OCandASN.MSPRT(theta = seq(-1, design.onet.left$theta0,
#                                          length.out = 3),
#                              design.MSPRT.object = design.onet.left)

#### both sided ####
### design
#design.onet.both = design.MSPRT(test.type = 'oneT', side = 'both',
#                                N.max = 20)

### OC and ASN
#OC.onet.both = OCandASN.MSPRT(theta = seq(-1, 1, length.out = 3),
#                              design.MSPRT.object = design.onet.both)


#################### two-sample z test ####################

#### right sided ####
### design
#design.twoz.right = design.MSPRT(test.type = 'twoZ', side = 'right',
#                                 N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twoz.right = OCandASN.MSPRT(theta = seq(design.twoz.right$theta0, 
#                                           design.twoz.right$theta0 + 2,
#                                           length.out = 3),
#                               design.MSPRT.object = design.twoz.right)

#### left sided ####
### design
#design.twoz.left = design.MSPRT(test.type = 'twoZ', side = 'left',
#                                N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twoz.left = OCandASN.MSPRT(theta = seq(design.twoz.left$theta0 - 2,
#                                          design.twoz.left$theta0,
#                                          length.out = 3),
#                              design.MSPRT.object = design.twoz.left)

#### both sided ####
### design
#design.twoz.both = design.MSPRT(test.type = 'twoZ', side = 'both',
#                                N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twoz.both = OCandASN.MSPRT(theta = seq(design.twoz.both$theta0 - 2,
#                                          design.twoz.both$theta0 + 2,
#                                          length.out = 3),
#                             design.MSPRT.object = design.twoz.both)


#################### two-sample t test ####################

#### right sided ####
### design
#design.twot.right = design.MSPRT(test.type = 'twoT', side = 'right',
#                                 N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twot.right = OCandASN.MSPRT(theta = seq(design.twot.right$theta0, 
#                                           design.twot.right$theta0 + 2,
#                                           length.out = 3),
#                               design.MSPRT.object = design.twot.right)

#### left sided ####
### design
#design.twot.left = design.MSPRT(test.type = 'twoT', side = 'left',
#                                N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twot.left = OCandASN.MSPRT(theta = seq(design.twot.left$theta0 - 2,
#                                          design.twot.left$theta0,
#                                          length.out = 3),
#                              design.MSPRT.object = design.twot.left)

#### both sided ####
### design
#design.twot.both = design.MSPRT(test.type = 'twoT', side = 'both',
#                                N1.max = 20, N2.max = 20)

### OC and ASN
#OC.twot.both = OCandASN.MSPRT(theta = seq(design.twot.both$theta0 - 2,
#                                          design.twot.both$theta0 + 2,
#                                          length.out = 3),
#                              design.MSPRT.object = design.twot.both)

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