Learn R Programming

pirate (version 1.0.0)

permute_pvalue: Calculation of permutation p-value

Description

Calculates the permutation p-value for a fitted GEM. See more detail in E Petkova, T Tarpey, Z Su, and RT Ogden. Generated effect modifiers (GEMs) in randomized clinical trials. Biostatistics, (First published online: July 27, 2016). doi: 10.1093/biostatistics/kxw035.

Usage

permute_pvalue(dat, permuteN, method = "F")

Arguments

dat
Data frame with first column as the treatment index, second column as the outcome, and the remaining columns as the covariates design matrix. The elements of the treatment index take $K$ distinct values, where $K$ is the number of treatment groups. The outcome has to be a continuous variable.
permuteN
Number of permutation
method
Choice of the criterion that the generated effect modifier optimizes. This is a string in c("nu","de","F"), which corresponde to the numerator, denominator and F-statistics criteria respectively. The default method is the F-statistics method.

Value

perm_p Permutation p-value for the data and choosen criteriorp A vector of calculated p-value for the original and permuted data set under the choosen criterior

Examples

Run this code
#constructing the covariance matrix
co <- matrix(0.2, 10, 10)
diag(co) <- 1
#simulate a data set
dataEx <- data_generator1(d = 0.3, R2 = 0.5, v2 = 1, n = 300,
                        co = co, beta1 = rep(1,10),inter = c(0,0))
#calculate the permuted p value
dat <- dataEx[[1]]
permute_pvalue(dat, permuteN = 200, method = "nu")

Run the code above in your browser using DataLab