Skip to contents

Linear regression

Usage

linearRegression(
  x,
  cls = "class",
  pAdjust = "bonferroni",
  returnModels = FALSE
)

# S4 method for AnalysisData
linearRegression(
  x,
  cls = "class",
  pAdjust = "bonferroni",
  returnModels = FALSE
)

Arguments

x

S4 object of class AnalysisData

cls

vector of sample information column names to regress

pAdjust

p value adjustment method

returnModels

should models be returned

Value

An S4 object of class Univariate.

Examples

library(metaboData)

d <- analysisData(abr1$neg[,200:300],abr1$fact)

## Perform linear regression
lr_analysis <- linearRegression(d,cls = 'injorder')

## Extract significant features
explanatoryFeatures(lr_analysis)
#> # A tibble: 5 × 15
#>   response feature r.squared adj.r.squared sigma statistic  p.value    df logLik
#>   <chr>    <chr>       <dbl>         <dbl> <dbl>     <dbl>    <dbl> <dbl>  <dbl>
#> 1 injorder N283        0.310        0.304   4.27      53.0 4.10e-11     1  -343.
#> 2 injorder N221        0.140        0.133   5.87      19.3 2.50e- 5     1  -382.
#> 3 injorder N255        0.119        0.111  11.1       15.9 1.17e- 4     1  -458.
#> 4 injorder N267        0.118        0.111  26.4       15.8 1.22e- 4     1  -562.
#> 5 injorder N297        0.107        0.0995 44.7       14.1 2.65e- 4     1  -625.
#> # ℹ 6 more variables: AIC <dbl>, BIC <dbl>, deviance <dbl>, df.residual <int>,
#> #   nobs <int>, adjusted.p.value <dbl>