Learn R Programming

VisualizeSimon2Stage (version 0.2.2)

r_simon: Random Generator based on Simon's Two-Stage Design

Description

Random generator based on Simon's two-stage design.

Usage

r_simon(R, prob, object, ...)

# S3 method for ph2simon r_simon(R, prob, object, ...)

# S3 method for ph2simon4 r_simon( R, prob, object, ..., r1 = object@r1, n1 = object@n1, r = object@r, n = object@n )

Value

Function r_simon() returns an integer

vector of length \(R\), which are the \(R\) copies of the number of responses in the Simon's two-stage design.

Arguments

R

positive integer scalar, number of trials \(R\)

prob

double scalar, true response rate \(p\)

object

a ph2simon or ph2simon4 object

...

parameters of function ph2simon4(), most importantly type

r1, n1, r, n

(optional) integer scalars, see ph2simon4.

Details

Function r_simon() generates \(R\) copies of the number of responses \(y\) in one Simon's two-stage design. The conclusion of the trials are,

\(y \leq r_1\)

indicates early termination

\(r_1 < y \leq r\)

indicates failure to reject \(H_0\)

\(y > r\)

indicates success to reject \(H_0\)

Here \(r\) is not needed to generate the random number of responses \(y\). Instead, \(r\) is needed to determine if the trial is a failure or a success. Therefore, \(r\) is not a parameter of function r_simon().