The aim of this R
Markdown document is to give a brief description on **how easy
it is to supplement and enhance plots** generated in rpact by use of the
ggplot2 package and
associated language.

We will illustrate the generation of the plots by assessing the simulated Type I error rate of a group sequential and adaptive inverse normal design in a sample size recalculation setting. It is well known that the adaptive inverse normal designs in contrast to group sequential designs controls the overall Type I error rate even in a setting of sample size recalculation. The goal of this exercise is to present this fact in a single comprehensive output.

With rpact it is very convenient to calculate the necessary components: We will analyze both design choices by rpact, retrieve the results and arrange them by the means of ggplot2.

**Loading the packages**

We start by loading the required two packages.

```
library(ggplot2)
library(rpact)
packageVersion("rpact")
```

`## [1] '3.3.2'`

After the two packages were loaded, the group sequential (dGS) and adaptive inverse normal (dIN) design can be generated. Throughout this document, we will use the default parameter settings from rpact.

```
<- getDesignGroupSequential()
dGS <- getDesignInverseNormal() dIN
```

We can now take a look into both designs and inspect their default values. These are identical outputs although the way of calculating the test statistics over the stages differ.

`kable(dGS)`

**Design parameters and output of group sequential
design**

**Default parameters**

*Type of design*: O’Brien & Fleming*Maximum number of stages*: 3*Stages*: 1, 2, 3*Information rates*: 0.333, 0.667, 1.000*Significance level*: 0.0250*Type II error rate*: 0.2000*Two-sided power*: FALSE*Test*: one-sided*Tolerance*: 0.00000001

**Output**

*Cumulative alpha spending*: 0.0002592, 0.0071601, 0.0250000*Critical values*: 3.471, 2.454, 2.004*Stage levels (one-sided)*: 0.0002592, 0.0070554, 0.0225331

`kable(dIN)`

**Design parameters and output of inverse normal combination
test design**

**Default parameters**

*Type of design*: O’Brien & Fleming*Maximum number of stages*: 3*Stages*: 1, 2, 3*Information rates*: 0.333, 0.667, 1.000*Significance level*: 0.0250*Type II error rate*: 0.2000*Two-sided power*: FALSE*Test*: one-sided*Tolerance*: 0.00000001

**Output**

*Cumulative alpha spending*: 0.0002592, 0.0071601, 0.0250000*Critical values*: 3.471, 2.454, 2.004*Stage levels (one-sided)*: 0.0002592, 0.0070554, 0.0225331

In the output we see some important characteristics like the type of design (OF = O’Brien and Fleming), the maximum number of stages (3), the information rates (0.333, 0.667, 1.000), the significance level (0.025) and the stage level information (0.0002592, 0.0070554, 0.0225331).

We can also easily plot the stage level information by means of rpact.

`plot(dGS, type = 3)`