Package 'irls'

Title: Generalised Linear Models via Iteratively Reweighted Least Squares
Description: Generalised linear models via the iteratively reweighted least squares algorithm. The functions perform logistic, Poisson and Gamma regression (ISBN:9780412317606), either for a single model or many regression models in a column-wise fashion.
Authors: Michail Tsagris [aut, cre], Nikolaos Kontemeniotis [aut], Christos Adam [aut]
Maintainer: Michail Tsagris <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2026-05-11 09:06:25 UTC
Source: https://github.com/cran/irls

Help Index


Generalised Linear Models via Iteratively Reweighted Least Squares

Description

Description: Generalised linear models via the iteratively reweighted least squares algorithm. The functions perform logistic, Poisson and Gamma regression, either for a single model or many regression models in a column-wise fashion.

Details

Package: irls
Type: Package
Version: 1.0
Date: 2025-12-03
License: GPL-2

Maintainers

Michail Tsagris [email protected].

Author(s)

Michail Tsagris [email protected], Nikolaos Kontemeniotis [email protected] and Christos Adam [email protected].

References

McCullagh, Peter, and John A. Nelder. Generalized linear models. CRC press, USA, 2nd edition, 1989.


Column-wise GLMs with IRLS

Description

GLMs with IRLS.

Usage

col.irls(y, x, type = "logistic", maxiter = 100, tol = 1e-6, parallel = FALSE)

Arguments

y

A numberical vector with the response. Binary data for the binomial regression, count data for the Poisson regression and strictly positive continuous numbers for the Gamma regression.

x

A numerical matrix.

type

The type of regression model to perform, "logistic", "poisson" or "gamma".

maxiter

The maximum number of iterations to perform.

tol

The tolerance value to terminate the algorithm.

parallel

Should the models be performed in parallel?

Details

The function does logistic, Poisson and Gamma regression via the IRLS algorithm, for each column of x.

Value

A matrix with 3 or 4 columns with the α\alpha (constant) and β\beta parameters, the deviance and the ϕ\phi (dispersion) parameter in case of Gamma regression.

Author(s)

Michail Tsagris, Nikolaos Kontemeniotis and Christos Adam. R implementation and documentation: Michail Tsagris [email protected].

References

McCullagh, Peter, and John A. Nelder. Generalized linear models. CRC press, USA, 2nd edition, 1989.

See Also

irls

Examples

x <- as.matrix(iris[, 1:4])
y <- rbinom(150, 1, 0.5)
col.irls(y, x)

GLMs with IRLS

Description

GLMs with IRLS.

Usage

irls(y, x, type = "logistic", maxiter = 100, tol = 1e-6)

Arguments

y

A numberical vector with the response. Binary data for the binomial regression, count data for the Poisson regression and strictly positive continuous numbers for the Gamma regression.

x

A numerical matrix or a vector.

type

The type of regression model to perform, "logistic", "poisson" or "gamma".

maxiter

The maximum number of iterations to perform.

tol

The tolerance value to terminate the algorithm.

Details

The function does logistic, Poisson and Gamma regression via the IRLS algorithm.

Value

A list including:

coefficients

The regression coefficients.

vcov

The variance covariance matrix of the coefficients.

se

The standard errors of the coefficients.

phi

The dispersion parameter phiphi of the Gamma regression.

deviance

The deviance of the regression model.

iters

The number of iterations required.

Author(s)

Michail Tsagris, Nikolaos Kontemeniotis and Christos Adam. R implementation and documentation: Michail Tsagris [email protected].

References

McCullagh, Peter, and John A. Nelder. Generalized linear models. CRC press, USA, 2nd edition, 1989.

See Also

col.irls

Examples

x <- as.matrix(iris[, 1:4])
y <- rbinom(150, 1, 0.5)
irls(y, x)