Learn R Programming

lllcrc (version 1.2)

pirls: Maximum likelihood for log-linear coefficients

Description

A simplified version of glm that does only parameter estimation. This attempts to mimic the IRLS routine invoked by glm, without returning extra ``baggage" such as standard errors.

Usage

pirls(predictors, data, epsilon = 0.00000001, iter.max = 25, normalized = TRUE)

Arguments

predictors
The columns of the standard design matrix to include in the model. For example, "c1", "c2" for main effects, and "c12" for interactions.
data
A design matrix with cell counts included in the column named "c". Must be a matrix (not a data frame)!
epsilon
Convergence tolerance, intended to play the same role as epsilon the control parameters for glm.fit.
iter.max
The maximum number of IRLS iterations. A warning appears if this maximum is ever reached.
normalized
Logical: If TRUE, include a normalization step after coefficient estimation, which resets the value of the intercept so that the sum of predicted values is exactly 1

Value

The vector of estimated log-linear coefficients. The first coefficient is the intercept, and the remaining ones correspond to the predictors argument, in that order

Details

The main purpose of pirls is to obtain speed, for the special circumstance in which one must fit gazillions of Poisson regression models, where the only quantity of interested is the point estimates of the regression coefficients. Matrix inversion is one of the most time consuming steps in the function, and the overall speed can be improved by about 20 percent by modifying the source code to replace the solve() command with .Internal(La_solve()).