simulation: Simulate Rejection Probability and Sample Size for Student's...

View source: R/Student.R

simulationR Documentation

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 recalculated after n1 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 documentation built on Oct. 4, 2023, 5:06 p.m.