mlm: Multiple Linear Models

Description Usage Arguments Value See Also Examples

View source: R/mlm.R

Description

Fits multiple linear models.

Usage

1
    mlm(formula, data, vars, save.residuals=FALSE)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the models to be fitted.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

vars

a character vector of variables of interest.

save.residuals

whether model residuals should be stored and returned.

Value

A list with elements:

coefficients

if 'vars' is missing or non-empty, an array (or data frame, if vars contains a single element) of regression coefficient estimates (coef), standard errors (coef.se), and corresponding p-values (pval).

residuals

if save.residuals is TRUE, a matrix of model residuals.

See Also

lm

Examples

1
2
3
4
5
6
    coefs <- matrix(runif(6*10), 6, 10)
    X <- matrix(rnorm(100*5), 100, 5)
    Y <- cbind(1, X) 

    models <- mlm(Y ~ X)
    str(models)

Example output

Warning messages:
1: In summary.lm(model) :
  essentially perfect fit: summary may be unreliable
2: In summary.lm(model) :
  essentially perfect fit: summary may be unreliable
3: In summary.lm(model) :
  essentially perfect fit: summary may be unreliable
4: In summary.lm(model) :
  essentially perfect fit: summary may be unreliable
5: In summary.lm(model) :
  essentially perfect fit: summary may be unreliable
List of 2
 $ nobs        : int [1:6] 100 100 100 100 100 100
 $ coefficients: num [1:6, 1:5, 1:3] -1.56e-16 1.00 1.19e-17 -5.04e-17 -3.79e-18 ...
  ..- attr(*, "dimnames")=List of 3
  .. ..$ : NULL
  .. ..$ : chr [1:5] "X1" "X2" "X3" "X4" ...
  .. ..$ : chr [1:3] "coef" "coef.se" "pval"

omics documentation built on May 29, 2017, 11:36 a.m.

Related to mlm in omics...