permutation.test: Perform permutation test for the real data (1 outcome)

View source: R/extras.R

permutation.testR Documentation

Perform permutation test for the real data (1 outcome)

Description

For each permutation run, a test statistic for the interaction effect between the treatment and the predicted sensitivity status is computed. A permutation p-value is computed as the proportion of simulations where the test statistic is larger than the test statistic for the original data.

Usage

permutation.test(realdata, res, method, reps)

Arguments

realdata

Input data (see realdata object).

res

An object of class "rapids" containing the results for the design for the original data.

method

An input method ("cvasd" or "cvrs").

reps

Number of permutations.

Details

Perform permutation test for the real data.

Value

A list of 5:

stat0.group: Statistic for the interaction effect between the treatment and the sensitivity status, for the original data.

treat: A matrix of treatment allocations, one column per permutation run.

sens.pred: A matrix of sesnsitivy statuses, one column per permutation run.

stat.group: A matrix of permutation statistics, one column per permutation run.

ppval.group: P-value from the permutation test.

Author(s)

Svetlana Cherlin, James Wason

See Also

analyse.realdata function.

Examples

#Analyse data with "cvrs" method and perform permutation test
data(realdata)
sig = 0.05
group.prop.sig = 0.2
method = "cvrs"
seed = 123
plotrs = T
eta = NULL
R = NULL
G = NULL
realres.cvrs = analyse.realdata(realdata, sig, group.prop.sig, method, eta, R, G, seed, plotrs)
#Permutation test
reps = 10
res.perm = permutation.test(realdata, realres.cvrs, method, reps)

svetlanache/rapids documentation built on Sept. 15, 2023, 7 a.m.