Description Usage Arguments Details Value
setup_glm
is used to setup the data/objects for any function that uses
the main GLM functionality in brainGraph
.
contrast_names
checks the dimensions of contrasts, generates contrast
names, and sets column names for GLM functions. For F-contrasts, if a
matrix
is given, it converts it to a list
to simplify processing
later.
add_nans
adds rows/columns (or higher dimensions) to model fit data
for regions which were skipped (due to having a singular design matrix,
usually).
cxtxfun_3d
returns a function that calculates the “CXtX”
matrix/array, used to calculate the standard error of a contrast. The
function signature will be f(contrast, xtx, rkC, ny)
.
glm_data_table
is used in brainGraph_GLM
and
brainGraph_mediate
to create a data.table
with the
subject IDs and column(s) for the graph- or vertex-level metric of
interest.
matrix2list
makes working with different contrast types (i.e., t or F)
a little simpler.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | setup_glm(g.list, level, covars, X, contrasts, con.type, con.name, measure,
outcome, ...)
contrast_names(contrasts, con.type, con.name, X)
check_if_singular(QR)
add_nans(fits, dimX, namesX, runX = names(fits$qr))
cxtxfun_3d(con.type, transpose = TRUE)
glm_data_table(g.list, level, measure)
matrix2list(mat)
maxfun(alternative)
sortfun(alternative)
|
g.list |
A |
level |
Character string; either |
covars |
A |
X |
Numeric matrix, if you wish to supply your own design matrix.
Ignored if |
contrasts |
Numeric matrix (for T statistics) or list of matrices (for F statistics) specifying the contrast(s) of interest; if only one contrast is desired, you can supply a vector (for T statistics) |
con.type |
Either |
con.name |
Character vector of the contrast name(s); if |
measure |
Character string of the graph measure of interest |
outcome |
Character string specifying the name of the outcome variable,
if it differs from the graph metric ( |
... |
Arguments passed to |
QR |
List of QR decompositions for each design matrix |
fits |
List object output by one of the model fitting functions (e.g.,
|
dimX |
Integer vector containing the dimensions of the original design matrix/array (including singular designs) |
namesX |
List of character vectors containing the dimension names from the original design matrix/array |
runX |
Character vector of regions for which models were fit |
transpose |
Logical indicating whether to transpose the output of the
selected function. Ignored for F-contrasts. Should be |
mat |
Numeric matrix in which each row is a single contrast vector |
alternative |
Character string, whether to do a two- or one-sided test.
Default: |
This function: removes unused levels from covars
and DT.y.m
,
removes subjects with incomplete data, creates a design matrix (if not
supplied), and supplies names to the contrast matrix.
The “CXtX” matrix/array for T-contrasts is the diagonal of
C (X^T X)^{-1} C^T
For F-contrasts, it is the inverse of the matrix:
(C (X^T X)^{-1} C^T)^{-1}
where in both cases, C is the contrast matrix and X is the design matrix/array.
For T-contrasts, the function will return a numeric vector/matrix with dimensions k \times r where k is the number of contrasts (i.e., the number of rows in the contrast matrix) and r is the number of regions. For F-contrasts, the function would return a numeric array with dimensions k \times k \times r, where k is the rank of the contrast matrix and r is the number of regions. If there is a single design for all regions, it will be a k \times k matrix.
contrast_names
– list containing the contrasts (matrix or
list), contrast names, and number of contrasts
add_nans
– the original fits
object with NaN
or
NA
inserted
cxtxfun_3d
– A function with arguments for the contrast
(numeric matrix), the “unscaled covariance” array, the (row) rank of
the contrast, and the number of regions in the analysis (only used for
F-contrasts)
glm_data_table
- A data.table
with one column
containing the subject ID's and 1 or more columns with the graph- or
vertex-level measure of interest.
matrix2list
– A list with length equal to the number of rows
of C
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.