Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

simulation

Simulate Rejection Probability and Sample Size for Student's t-Test


Description

This function simulates the probability that a test defined by setupStudent rejects the null hypothesis. Note that here the nuisance parameter nuisance is the variance of the outcome variable sigma^2.

Usage

simulation(
  design,
  n1,
  nuisance,
  recalculation = TRUE,
  delta_true,
  iters = 1000,
  seed = NULL,
  allocation = c("approximate", "exact"),
  ...
)

Arguments

design

Object of class Student created by setupStudent.

n1

Either the sample size of the first stage (if recalculation = TRUE or the toal sample size (if recalculation = FALSE).

nuisance

Value of the nuisance parameter. For the Student's t-test this is the variance.

recalculation

Should the sample size be recalcuated after n1 patients are recruited?

delta_true

effect measure under which the rejection probabilities are computed

iters

Number of simulation iterations.

seed

Random seed for simulation.

allocation

Whether the allocation ratio should be preserved exactly (exact) or approximately (approximate).

...

Further optional arguments.

Details

The implementation follows the algorithm in Lu (2019): Distribution of the two-sample t-test statistic following blinded sample size re-estimation. Pharmaceutical Statistics 15: 208-215. Since Lu (2019) assumes negative non-inferiority margins, the non-inferiority margin of design is multiplied with -1 internally.

Value

Simulated rejection probabilities and sample sizes for each nuisance parameter.

Examples

d <- setupStudent(alpha = .025, beta = .2, r = 1, delta = 3.5, delta_NI = 0,
                  alternative = "greater", n_max = 156)
simulation(d, n1 = 20, nuisance = 5.5, recalculation = TRUE, delta_true = 3.5)

blindrecalc

Blinded Sample Size Recalculation

v0.1.2
MIT + file LICENSE
Authors
Lukas Baumann [aut], Maximilian Pilz [aut, cre], Institute of Medical Biometry and Informatics - University of Heidelberg [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.