permFL: Compute TFCE derived p-values using Freedman-Lane procedure.

View source: R/permFL.R

permFLR Documentation

Compute TFCE derived p-values using Freedman-Lane procedure.

Description

Given a NxV imaging matrix Y (N = number of subjects, V = number of vertices in the ventricular mesh), a NxC model matrix X (N = number of subjects, C = number of variables + intercept term) and the numbers of the column variables to extract, this function computes for each variable specified in extract a couple of arrays: in the first array the TFCE derived p-values map on the mesh and in the second array a binary variable expressing whether that vertex has reached significance using a whole-image threshold as specified in the TFCE original paper. The output is a matrix with a number of columns equal to twice the lenght of extract and a number of rows equal to the number of vertices.

Usage

permFL(X, Y, extract, A, NNmatrix, nPermutations = 1000, HC4m = FALSE,
  parallel = FALSE, nCores = 1, verbOutput = 0, E = 0.5, H = 2)

Arguments

X

is the design matrix. Number of rows = number of subjects in the study, number of columns = number of vertices in the atlas. Numerical varable must be normalized to 0-mean and unit-standard deviation. Categorical variables must be coded using dummy coding. The first column should contain the intercept (all 1s).

Y

is the imaging matrix. Number of rows = N. Number of columns = V.

extract

is an array expressing which covariates in X you want to extract.

A

A V-dimensional vector containing the area associated with a vertex, usually its Voronoi area.

NNmatrix

Nx2 matrix containing the mesh edges. Important: to speed up the execution please avoid repetitions like (A,B) and (B,A).

nPermutations

number of permutations in the permutation test, default is 1000.

HC4m

flag for triggering HC4m correction, default is FALSE.

parallel

flag for triggering parallel computing, default is FALSE.

nCores

flag for defining the number of cores to use, default is 1.

verbOutput

flag for activating verbose output, default is 0 (off).

Value

If verbOutput = 0 the output is a matrix composed by a number of columns twice the number of variables specified in extract. For each variable, a first array will contain the TFCE derived p-values for each mesh vertex and a second array will contain a binary variable expressing whether that vertex has reached significance using a whole-image threshold for multiple testing correction as specified in the TFCE original paper. This array will fill the output matrix column-wise. If verbOutput = 1 the output is a list where the pval field contains the the pvalues computed at each vertex, TFCEmatrix field contains a V x nPermutations matrix containing the TFCE scores computed for each permutation and the tfceScores field is a V-dimensional vector containing the TFCE scores of the non-permuted data.

Examples

TFCEresults = permFL(X, Y, extract, A, NNmatrix, nPermutations = 1000, HC4m = FALSE)

UK-Digital-Heart-Project/mutools3D documentation built on April 7, 2024, 8:04 a.m.