| Type: | Package | 
| Title: | Visualize Simon's Two-Stage Design | 
| Version: | 0.2.2 | 
| Date: | 2025-04-27 | 
| Description: | To visualize the probabilities of early termination, fail and success of Simon's two-stage design. To evaluate and visualize the operating characteristics of Simon's two-stage design. | 
| License: | GPL-2 | 
| Imports: | methods, flextable, ggplot2, officer, geomtextpath, scales | 
| Encoding: | UTF-8 | 
| Language: | en-US | 
| Depends: | R (≥ 4.4.0) | 
| Suggests: | clinfun, knitr, quarto, rmarkdown | 
| RoxygenNote: | 7.3.2 | 
| VignetteBuilder: | quarto | 
| NeedsCompilation: | no | 
| Packaged: | 2025-04-28 03:16:36 UTC; tingtingzhan | 
| Author: | Tingting Zhan | 
| Maintainer: | Tingting Zhan <tingtingzhan@gmail.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-04-28 03:30:02 UTC | 
VisualizeSimon2Stage: Visualize Simon's Two-Stage Design
Description
To visualize the probabilities of early termination, fail and success of Simon's two-stage design. To evaluate and visualize the operating characteristics of Simon's two-stage design.
Note
Help files of individual functions are intentionally suppressed in the pdf manual.
Users are encouraged to get started with
vignette('intro', package = 'VisualizeSimon2Stage')
Author(s)
Maintainer: Tingting Zhan tingtingzhan@gmail.com (ORCID)
Short Paragraph to Describe a simon_oc Object
Description
To create a short paragraph to describe a simon_oc object.
Usage
Sprintf.simon_oc(model, ...)
Arguments
| model | simon_oc object | 
| ... | additional parameters, currently not in use | 
Value
Function Sprintf.simon_oc() returns a character scalar.
Short Paragraph to Describe a ph2simon Object
Description
To create a short paragraph to describe a ph2simon object.
Usage
Sprintf.ph2simon4(model, ...)
Sprintf.ph2simon(model, ...)
Arguments
| model | |
| ... | parameters of function  | 
Value
Function Sprintf.ph2simon() and Sprintf.ph2simon4() return a character scalar.
Convert ph2simon4 to flextable
Description
Convert ph2simon4 to flextable
Usage
## S3 method for class 'simon_pr'
as_flextable(x, ...)
Arguments
| x | |
| ... | additional parameters, currently not in use | 
Value
Function as_flextable.simon_pr() returns a flextable
Plot Simon's Two-Stage Design
Description
Plot ph2simon object using ggplot2.
Usage
## S3 method for class 'ph2simon'
autoplot(object, ...)
## S3 method for class 'ph2simon4'
autoplot(object, ...)
## S3 method for class 'ph2simon4'
autolayer(
  object,
  r1 = object@r1,
  n1 = object@n1,
  r = object@r,
  n = object@n,
  pu = object@pu,
  pa = object@pa,
  type = object@type,
  ...
)
## S3 method for class 'ph2simon'
autolayer(object, ...)
Arguments
| object | |
| ... | parameters of function  | 
| r1,n1,r,n | |
| pu,pa | |
| type | see slot  | 
Value
Function autoplot.ph2simon() returns a ggplot object.
Function autolayer.ph2simon() returns a list of ggproto and labels.
S4 Object ph2simon4
Description
One or more Simon's two-stage designs.
Usage
ph2simon4(object, type = "minimax", ...)
Arguments
| object | a ph2simon object | 
| type | |
| ... | additional parameters, currently not in use | 
Slots
- r1,r
- n1,n
- pu,pa
- double scalars 
- alpha,beta
- double scalars 
- nmax
- type
- character scalars or vectors, type of Simon's two-stage design, 
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 class 'ph2simon'
r_simon(R, prob, object, ...)
## S3 method for class 'ph2simon4'
r_simon(
  R,
  prob,
  object,
  ...,
  r1 = object@r1,
  n1 = object@n1,
  r = object@r,
  n = object@n
)
Arguments
| R | positive integer scalar, number of trials  | 
| prob | double scalar, true response rate  | 
| object | |
| ... | parameters of function  | 
| r1,n1,r,n | 
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().
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.
Show S4 Objects
Description
Show S4 object.
Usage
## S4 method for signature 'simon_oc'
show(object)
## S4 method for signature 'simon_pr'
show(object)
## S4 method for signature 'ph2simon4'
show(object)
Arguments
| object | 
Value
The show method for S4 objects does not have a returned value.
Operating Characteristics of Simon's Two-Stage Design
Description
Operating characteristics of one Simon's two-stage design.
Usage
simon_oc(prob, R, object, ...)
## S3 method for class 'ph2simon'
simon_oc(prob, R = 10000L, object, ...)
## S3 method for class 'ph2simon4'
simon_oc(
  prob,
  R = 10000L,
  object,
  ...,
  r1 = object@r1,
  n1 = object@n1,
  r = object@r,
  n = object@n
)
Arguments
| prob | named double vector,
true response rate(s)  | 
| R | integer scalar, number of simulations.  Default  | 
| object | |
| ... | parameters of function  | 
| r1,n1,r,n | 
Value
Function simon_oc() returns simon_oc object.
Slots
- maxResp
- integer vector of same length as - p, the frequencies of each regime having maximum response. The summation of- maxRespis the number of simulation copies.
- simon_maxResp
- integer vector of same length as - p, the frequencies of each regime having maximum response and success in Simon's two-stage trial.
Probabilities of one Simon's Two-Stage Design
Description
Probabilities of frail
(i.e., early termination) and success (to reject H_0)
of one Simon's two-stage design, at given true response rate(s).
Usage
simon_pr(prob, object, ...)
## S3 method for class 'ph2simon'
simon_pr(prob, object, ...)
## S3 method for class 'ph2simon4'
simon_pr(
  prob,
  object,
  r1 = object@r1,
  n1 = object@n1,
  r = object@r,
  n = object@n,
  ...
)
Arguments
| prob | |
| object | |
| ... | parameters of function  | 
| r1,n1,r,n | 
Value
Function simon_pr() returns simon_pr object.
Slots
- frail
- numeric scalar or vector, probabilities of frail (i.e., early termination) at given true response rate(s) - p.
- reject
- numeric scalar or vector, probabilities of success (to reject - H_0) at given true response rate(s)- p.
- eN
- numeric scalar or vector, expected sample size(s) - \textrm{E}(n)at given true response rate(s)- p.
- prob
Summarize a Simon's Two-Stage Design
Description
Summarize a Simon's two-stage design
Usage
## S3 method for class 'ph2simon4'
summary(object, ...)
## S3 method for class 'ph2simon'
summary(object, ...)
Arguments
| object | |
| ... | parameters of function  | 
Value
Function summary.ph2simon() returns a list with three (3) elements