massGLAM: Mass-univariate GLM Analysis

View source: R/massGLAM.R

massGLAMR Documentation

Mass-univariate GLM Analysis

Description

Run a mass-univariate analysis with either: a) single outome (y) and multiple predictors (x), one at a time, with an optional common set of covariates in each model - "massx" b) multiple different outcomes (y) with a fixed set of predictors (x) - "massy" Therefore, the term mass-univariate refers to looking at one variable of interest (with potential covariates of no interest) at a time

Usage

massGLAM(
  x,
  y,
  scale.x = FALSE,
  scale.y = FALSE,
  mod = c("glm", "gam"),
  type = NULL,
  xnames = NULL,
  ynames = NULL,
  spline.index = NULL,
  gam.k = 6,
  save.mods = TRUE,
  print.plot = FALSE,
  include_anova_pvals = NA,
  verbose = TRUE,
  trace = 0,
  n.cores = 1
)

Arguments

x

Matrix / data frame of features

y

Matrix / data frame of outcomes

scale.x

Logical: If TRUE, scale and center x

scale.y

Logical: If TRUE, scale and center y

mod

Character: "glm" or "gam".

type

Character: "massx" or "massy". Default = NULL, where if (NCOL(x) > NCOL(y)) "massx" else "massy"

xnames

Character vector: names of x feature(s)

ynames

Character vector: names of y feature(s)

spline.index

Integer vector: indices of features to fit splines for.

gam.k

Integer: The dimension of the spline basis.

save.mods

Logical: If TRUE, save models. Default = TRUE

print.plot

Logical: If TRUE, print plot. Default = FALSE (best to choose which p-values you want to plot directly)

include_anova_pvals

Logical: If TRUE, include ANOVA p-values, generated by glm2table (internal function)

verbose

Logical: If TRUE, print messages during run

trace

Integer: If > 0, print more verbose output to console.

n.cores

Integer: Number of cores to use. (Testing only, do not change from 1)

Author(s)

E.D. Gennatas

Examples

## Not run: 
# Common usage is "reversed":
# x: outcome of interest as first column, optional covariates
# in the other columns
# y: features whose association with x we want to study
set.seed(2022)
features <- rnormmat(500, 40)
outcome <- features[, 3] - features[, 5] + features[, 14] + rnorm(500)
massmod <- massGLAM(outcome, features)
plot(massmod)
plot(massmod, what = "coef")
plot(massmod, what = "volcano")

## End(Not run)


egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.