ER: Effect + Residual Modelling

View source: R/ER.R

ERR Documentation

Effect + Residual Modelling

Description

Effect + Residual Modelling

Usage

ER(formula, data)

## S3 method for class 'ER'
print(x, ...)

## S3 method for class 'ER'
plot(
  x,
  y = 1,
  what = "raw",
  col = NULL,
  pch = NULL,
  model.line = (what %in% c("raw")),
  ylim = NULL,
  ylab = "",
  xlab = "",
  main = NULL,
  ...
)

tableER(object, variable)

Arguments

formula

a model formula specifying features and effects.

data

a data.frame containing response variables (features) and design factors or other groupings/continuous variables.

x

Object of class ER.

...

Additional arguments to plot

y

Response name or number.

what

What part of ER to plot; raw data (default), fits, residuals or a named model effect (can be combined with 'effect', see Examples).

col

Color of points, defaults to grouping. Usually set to a factor name.

pch

Plot character of points, defaults to 1. Usually set to a factor name.

model.line

Include line indicating estimates, default = TRUE. Can be an effect name.

ylim

Y axis limits (numeric, but defaults to NULL)

ylab

Y label (character)

xlab

X label (character)

main

Main title, defaults to y with description from what.

object

ER object.

variable

Numeric for selecting a variable for extraction.

Value

ER returns an object of class ER containing effects, ER values, fitted values, residuals, features, coefficients, dummy design, symbolic design, dimensions, highest level interaction and feature names.

References

* Mosleth et al. (2021) Cerebrospinal fluid proteome shows disrupted neuronal development in multiple sclerosis. Scientific Report, 11,4087. <doi:10.1038/s41598-021-82388-w>

* E.F. Mosleth et al. (2020). Comprehensive Chemometrics, 2nd edition; Brown, S., Tauler, R., & Walczak, B. (Eds.). Chapter 4.22. Analysis of Megavariate Data in Functional Omics. Elsevier. <doi:10.1016/B978-0-12-409547-2.14882-6>

See Also

Analyses using ER: elastic and pls. Confidence interval plots confints.

Examples

## Multiple Sclerosis
data(MS, package = "ER")
er <- ER(proteins ~ MS * cluster, data = MS)
print(er)
plot(er)                                       # Raw data, first feature
plot(er,2)                                     # Raw data, numbered feature
plot(er,'Q76L83', col='MS', pch='cluster')     # Selected colour and plot character
plot(er,'Q76L83', what='effect MS',
     model.line='effect cluster')              # Comparison of factors (points and lines)

  # Example compound plot
  old.par <- par(c("mfrow", "mar"))
  # on.exit(par(old.par))
  par(mfrow = c(3,3), mar = c(2,4,4,1))
  plot(er,'Q76L83')                                  # Raw data, named feature
  plot(er,'Q76L83', what='fits')                     # Fitted values
  plot(er,'Q76L83', what='residuals')                # Residuals
  plot(er,'Q76L83', what='effect MS')                # Effect levels
  plot(er,'Q76L83', what='effect cluster')           # ----||----
  plot(er,'Q76L83', what='effect MS:cluster')        # ----||----
  plot(er,'Q76L83', what='MS')                       # ER values
  plot(er,'Q76L83', what='cluster')                  # --------||---------
  plot(er,'Q76L83', what='MS:cluster')               # --------||---------
  par(old.par)


# Complete overview of ER
tab <- tableER(er, 1)

# In general there can be more than two, effects, more than two levels, and continuous effects:
# MS$three <- factor(c(rep(1:3,33),1:2))
# er3    <- ER(proteins ~ MS * cluster + three, data = MS)


## Lactobacillus
data(Lactobacillus, package = "ER")
erLac <- ER(proteome ~ strain * growthrate, data = Lactobacillus)
print(erLac)
plot(erLac)                            # Raw data, first feature
plot(erLac,2)                          # Raw data, numbered feature
plot(erLac,'P.LSA0316', col='strain',
    pch='growthrate')                  # Selected colour and plot character
plot(erLac,'P.LSA0316', what='strain',
    model.line='growthrate')           # Selected model.line


## Diabetes
data(Diabetes, package = "ER")
erDia <- ER(transcriptome ~ surgery * T2D, data = Diabetes)
print(erDia)
plot(erDia)                            # Raw data, first feature
plot(erDia,2)                          # Raw data, numbered feature
plot(erDia,'ILMN_1720829', col='surgery',
    pch='T2D')                         # Selected colour and plot character


ER documentation built on Oct. 11, 2022, 1:07 a.m.

Related to ER in ER...