regression: regression analysis

View source: R/regression.R

regressionR Documentation

regression analysis

Description

Run regression models with adjusting for covariates. 'regression_each' is used for one outcome. In 'regression', several outcomes can be specified to run together.

Usage

regression(
  object,
  phenoData = NULL,
  model = NULL,
  outcome = NULL,
  covars = NULL,
  factors = NULL,
  feature_name = NULL,
  time = NULL,
  verbose = TRUE,
  ncpus = 1,
  p.adjust.method = "bonferroni",
  ...
)

regression_each(
  object,
  phenoData = NULL,
  model = NULL,
  formula = NULL,
  outcome = NULL,
  covars = NULL,
  factors = NULL,
  feature_name = NULL,
  time = NULL,
  verbose = TRUE,
  ncpus = 1,
  p.adjust.method = "bonferroni",
  ...
)

regression_each_as_outcome(
  object,
  phenoData = NULL,
  exposure = NULL,
  covars = NULL,
  factors = NULL,
  feature_name = NULL,
  verbose = TRUE,
  ncpus = 1,
  p.adjust.method = "bonferroni",
  ...
)

Arguments

object

A Metabolite object.

phenoData

A data.table with outcome and covariates. If 'phenoData' is NULL, '@sampleData' will be used.

model

Specify a regression model. See fit_lm for more details. 'auto' can be used to infer 'lm' or 'logistic' (with only 0, 1, and NA).

outcome

Column name of the outcome variable.

covars

Column names of covariates.

factors

Variables to be treated as factor.

feature_name

A vector of selected metabolites to run. If both feature_name and random_select are NULL, will run regression for all features.

time

Column name of survival time, used in cox regression, see coxph for more details.

verbose

Print log information.

ncpus

Number of CPUS for parallele job.

p.adjust.method

Adjust for P value method, see p.adjust.

...

Further arguments passed to regression model.

formula

A character or formula object to fit model (only used in 'regression_each')

exposure

exposure variables.

Value

term estimate std.error statistic p.value n outcome p.value.adj.

Note

regression_each_as_outcome: Run linear regression models where each feature is outcome.

Examples

data(df_plasma)
fit_lm <- regression(object = df_plasma, phenoData = NULL, model = "lm", 
outcome = "BMI", covars = c("AGE", "GENDER", "ETHNICITY"), factors = "ETHNICITY")


XikunHan/metabolomicsR documentation built on Oct. 14, 2024, 3:18 p.m.