slm_fit_csr: SparseM::slm.fit.csr, made tolerant to faults that recur in...

View source: R/utils.R

slm_fit_csrR Documentation

SparseM::slm.fit.csr, made tolerant to faults that recur in RItools

Description

[SparseM's slm.fit.csr()] expects a full-rank x that's not just a column of 1s. This variant somewhat relaxes these expectations.

Usage

slm_fit_csr(x, y, ...)

Arguments

x

As slm.fit.csr

y

As slm.fit.csr

...

As slm.fit.csr

Details

'slm.fit.csr' has a bug for intercept only models (admittedly, these are generally a little silly to be done as a sparse matrix), but in order to avoid duplicate code, if everything is in a single strata, we use the intercept only model.

This function's expectation of x is that either it has full column rank, or the reduced submatrix of x that excludes all-zero columns has full column rank. (When this expectation is not met, it's likely that [SparseM::chol()] will fail, causing this function to error; the error messages won't necessarily suggest this.) The positions of nonzero x-columns (ie columns with nonzero entries) are returns as the value of 'gramian_reduction_index', while 'chol' is the Cholesky decomposition of that submatrix's Gramian.

Value

A list consisting of:

coefficients

coefficients

chol

Cholesky factor of Gramian matrix x'x

residuals

residuals

fitted

fitted values

df.residual

degrees of freedom

gramian_reduction_index

Column indices identifying reduction of x matrix of which Gramian is taken; see Details


RItools documentation built on June 8, 2025, 10:41 a.m.