Linear models for large scale data {Rfast}R Documentation

Linear models for large scale data

Description

Linear models for large scale data.

Usage

lmfit(x, y, w = NULL)

Arguments

x

The design matrix with the data, where each column refers to a different sample of subjects. You must supply the design matrix, with the column of 1s. This function is the analogue of lm.fit and .lm.fit.

y

A numerical vector or a numerical matrix.

w

An optional numerical vector with weights. Note that if you supply this, the function does not make them sum to 1. So, you should do it.

Details

We have simply exploitted R's powerful function and managed to do better than .lm.fit which is a really powerful function as well. This is a bare bones function as it returns only two things, the coefficients and the residuals. .lm.fit returns more and lm.fit even more and finally lm returns too much. The motivatrion came form this site https://m-clark.github.io/docs/fastr.html . We changed the function a bit.

Value

A list including:

be

The beta coefficients.

residuals

The residuals of the linear model(s).

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.

References

Draper, N.R. and Smith H. (1988). Applied regression analysis. New York, Wiley, 3rd edition.

See Also

regression, allbetas, correls, mvbetas, cor.fsreg

Examples

n <- 200  ;  p <- 5
X <- matrnorm(n, p)
y <- rnorm(n)
a1 <- .lm.fit(X, y) 
a2 <- lmfit(X, y) 
x <- NULL

[Package Rfast version 2.1.0 Index]