permutation_cer: Permutation Conditional Error Rate

Description Usage Arguments Details Value Author(s)

Description

Computes the conditional type I error rate of a pre-planned permutation test in a two-stage adaptive design. For a two-group design we condition on the observed first stage data and treatment assignments as well as the observed second stage data - which we assume are obtained when the experiment reaches its preplanned sample size. In a one-sample design we condition on the absolute values of the outcome variable in both stages and as well as the first stage sign arrangement.

Usage

1
2
3
permutation_cer(x1, x2, g1, nt2 = floor(length(x2)/2), test_statistic,
  permutations, alpha, restricted, cer_type = c("non-randomized",
  "randomized", "uniform"), stratified = FALSE)

Arguments

x1

vector of preplanned first stage observations

x2

vector of preplanned second stage observations

g1

vector of first stage treatment assignments

nt2

preplanned second stage treatment group size (irrelevant for one-sample tests)

test_statistic

function computing the test statistic (see Details)

permutations

number of permutations (rerandomizations) used to compute unconditional and conditional permutation distributions

alpha

pre-fixed significance level

restricted

should stagewise treatment group sizes be considered fixed

cer_type

type of preplanned test for which the CER is computed (see details)

stratified

should permutation be performed stratified by stage

Details

Based on the first stage data and treatment assignments one may perform sample size reassassment - and possibly other trial modifications - as long as the (preplanned) second stage sample size is not reduced.

stat needs to be a function of the form function(x,g) returning a numeric of length one. Possible options are sumdiff, meandiff, zstat

For restricted=TRUE, we assume that observations are randomized using random allocation blocked by stages, (i.e. wewould resample the first stage using sample(g1)). restricted=FALSE does keep the treatment group sizes fixed (i.e. one would resample using sample(c(-1,1),n,replace=T). This is mainly usefull for onesample test that are invariant under sign-flip transformations.

The conditional error rate may be computed for different types of pre-planned permutation tests. "non-randomized" assumes that the pre-planned test is the usual non-randomized permutation test that has size strictly below alpha. "randomized" assumes a randomized pre-planned test which makes a randomized decision if the observed test statistic is equal to the critical value, such that the size is exactly alpha. Uniform adds the difference between alpha and the size of the non-randomized test to the conditional error rate, such that the expectation of the resulting conditional error function over all permutations of the first stage data is exactly alpha.

Value

numeric value of the conditional error rate

Author(s)

Florian Klinglmueller


floatofmath/adaperm documentation built on May 16, 2019, 1:18 p.m.