fast.lm: no frills linear regression

Description Usage Arguments Value Author(s) See Also Examples

Description

a no frills version of lm. designed to return only the coefficients and nothing else. (and potentially some basic stats in a future version)

Usage

1
fast.lm(A, x)

Arguments

A

design matrix of dimension n * p.

x

vector of observations of length n, or a matrix with n rows.

Value

the length p coefficient vector.

Author(s)

Whit Armstrong

See Also

lm the standard lm method.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
NC <- 10
NR <- 1e5
A <- matrix(rnorm(NR*NC),nrow=NR,ncol=NC)
b <- rnorm(NR)
flm.time <- system.time(ans <- fast.lm(A,b))
lm.fit.time <- system.time(lm.ans <- as.vector(lm.fit(A,b)$coefficients))
cat("all.equal:", all.equal(ans,lm.ans),"\n")

bmark.times <- rbind(flm.time,
                     lm.fit.time,
                     lm.fit.time/flm.time)
print(bmark.times)
ans.compare <- cbind(ans,lm.ans)

armstrtw/fast.lm documentation built on May 10, 2019, 1:42 p.m.