Description Usage Arguments Value Examples
fast and memory efficient linear model fitting
1 |
X |
input model matrix. must be a big.matrix object (type = 8 for double) |
y |
numeric response vector of length nobs. |
method |
an integer scalar with value 0 for the LLT Cholesky or 1 for the LDLT Cholesky |
gigs |
double scalar. maximum number of gigs of memory available. Used to figure out how to break up calculations involving the design matrix X |
nslices |
integer scalar, defaults to NULL, which defers to the |
A list with the elements
coefficients |
a vector of coefficients |
se |
a vector of the standard errors of the coefficient estimates |
rank |
a scalar denoting the computed rank of the model matrix |
df.residual |
a scalar denoting the degrees of freedom in the model |
residuals |
the vector of residuals |
s |
a numeric scalar - the root mean square for residuals |
fitted.values |
the vector of fitted values |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(bigmemory)
nrows <- 50000
ncols <- 50
bkFile <- "bigmat2.bk"
descFile <- "bigmatk2.desc"
bigmat <- filebacked.big.matrix(nrow=nrows, ncol=ncols, type="double",
backingfile=bkFile, backingpath=".",
descriptorfile=descFile,
dimnames=c(NULL,NULL))
# Each column value with be the column number multiplied by
# samples from a standard normal distribution.
set.seed(123)
for (i in 1:ncols) bigmat[,i] = rnorm(nrows)*i
y <- rnorm(nrows) + bigmat[,1]
system.time(lmr1 <- bigLmPure(bigmat, y))
system.time(lmr2 <- lm.fit(x = bigmat[,], y = y))
max(abs(coef(lmr1) - coef(lmr2)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.