newtonRaphson: Newton-Raphson for Logistic Regression Estimation

Description Usage Arguments Details Value References Examples

View source: R/logitModel.R

Description

This function calculates the maximum likelihood for binary logistic regression via the Newton Raphson algorithm.

Usage

1
newtonRaphson(y, X, precision = 1e-07, iterMax = 25)

Arguments

y

Matrix/vector containing the response variable.

X

Matrix/vector containing the design matrix (including intercept).

precision

Degree of precision of algorithm.

iterMax

Maximum number of iterations of optimisation algorithm.

Details

This algorithm is used on the logitModel regression estimation function.

Value

A list with maximum likelihood estimation results for further computation.

References

Agresti, A (2013) Categorical Data Analysis, John Wiley & Sons, 2013, Volume 792 of Wiley Series in Probability and Statistics, ISSN 1940-6517

Czepiel, S.A. (2002) Maximum Likelihood Estimation of Logistic Regression Models: Theory and Implementation. Available at czep.net/stat/mlelr.pdf. [visited: 25.03.2018]

Examples

1
2
3
4
5
6
set.seed(42)
X1 <- rnorm(100);    X2 <- rnorm(100);
points <- 2 * X1 - 3 * X2
y <- rbinom(100, 1, exp(points) / (1 + exp(points)))
X <- cbind(b1 = 1, b2 = X1, b3 = X2)
fit <- newtonRaphson(y = y, X = X)

mr-avila/logitModel documentation built on July 13, 2021, 6:48 p.m.