edge_lm: Edgewise Linear Model

View source: R/edge_lm.R

edge_lmR Documentation

Edgewise Linear Model

Description

This function computes the specified linear model (LM) for each edge in the network, and calculates the multiple testing p-value based on the p.adjust function.

Usage

edge_lm(net, nnodes, idata, mod, diag = FALSE, padj,
       cores = NULL, expList = NULL, verbose = TRUE,
       ...)

Arguments

net

3D volume (2D matrices for each observation) or 2D matrix of edges as columns.

nnodes

Number of network nodes.

idata

Matrix or data.frame including independent variables of interest of the model.

mod

Model, specify as a string, e.g., "~Group + Age".

diag

Logical indicating if matrix diagonal is to be included in the analysis (default: FALSE).

padj

Character string that indicates the p.adjust method.

cores

Number of selected cores for parallel computing (default: NULL).

expList

Character string adding variable names to the varlist of 'clusterExport' (default: NULL).

verbose

Logical indicating if messages should be printed (default: TRUE).

...

Additional arguments to be passed to the low level 'lm' function.

Details

It's VERY IMPORTANT when giving net as a 2D matrix or data.frame, to be completely sure that column distribution fits that of the upper triangle indices of an nnodes * nnodes matrix. This may be verified through the edge indices, e.g., "which(upper.tri(matrix(nrow = nnodes, ncol = nnodes)), arr.ind = T)" (see vignette NBR-LME for more details).

To know more about padj methods, check help for the p.adjust function. It is noticeable that this multiple comparison approach can be much more faster than the permutations run by the Network-Based Statistics framework, however this is a much more conservative approach (see Zalesky et al. (2010) doi: 10.1016/j.neuroimage.2010.06.041 for more detail).

Value

data.frame containing the edge labels, observed statistics, their corresponding p-value, and their adjusted p-values.

Examples

data(frontal2D)

edge_result <- edge_lm(net = frontal2D[,-(1:3)], nnodes = 28,
  idata = frontal2D[,1:3], mod = "~ Group + Sex * Age",
  padj = "fdr")
head(edge_result)
if(any(edge_result[,5]<0.05)){
  show(edge_result[which(edge_result[,5]<0.05),1:5])
}



NBR documentation built on Oct. 3, 2022, 5:05 p.m.