Type: Package
Title: Generalised Linear Models via Iteratively Reweighted Least Squares
Version: 1.0
Author: Michail Tsagris [aut, cre], Nikolaos Kontemeniotis [aut], Christos Adam [aut]
Maintainer: Michail Tsagris <mtsagris@uoc.gr>
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.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Depends: R (≥ 4.2)
Imports: Rcpp (≥ 1.0.13)
LinkingTo: Rcpp (≥ 1.0.13), RcppEigen
Suggests: Rfast, Rfast2
RoxygenNote: 7.3.3
Encoding: UTF-8
NeedsCompilation: yes
Packaged: 2025-12-06 13:43:54 UTC; Administrator
Repository: CRAN
Date/Publication: 2025-12-11 13:40:07 UTC

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 mtsagris@uoc.gr.

Author(s)

Michail Tsagris mtsagris@uoc.gr, Nikolaos Kontemeniotis kontemeniotisn@gmail.com and Christos Adam pada4m4@gmail.com.

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 mtsagris@uoc.gr.

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 phi 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 mtsagris@uoc.gr.

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)