# IWLS: Iterative Weighted Least Squares In idaejin/HRQoL: Health Related Quality of Life Analysis

## Description

`IWLS` gives a method to estimate the coefficients of logistic regressions by maximum likelihood.

## Usage

 `1` ```IWLS(y,X,n) ```

## Arguments

 `y` the dependent variable of the model. `X` the model matrix. `n` the maximum score of the binomial trials.

## Details

The iterative weighted least squares (IWLS) is a general algorithm to find the maximum likelihood estimations (mle) and standard deviations in generalized linear mixed models. There are several ways to derive it, but the one that has been developed in this function is via the Newton-Raphson method. It consists of making a Taylor expansion in the score function, the first derivate of the log-likelihood, around the mle. This especific IWLS, `IWLS`, has been developed to find out the mle and the standard errors in logistic regression by the introduction of a dependent variable, a matrix model of the regression and the the maximum score of the binomial trials.

## Value

 `beta` maximum likelihood estimations of the logistic regression coefficients. `vcov` variance-covariance matrix of the estimated coefficients. `iter` the number of iterations of the algorithm.

Josu Najera

Dae-Jin Lee

## References

Pawitan Y. (2001): In All Likelihood: Statistical Modelling and Inference Using Likelihood, Oxford University Press.

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```#we are going to create a variable and a matrix model k=1000 #number of observations n=10 #the maximum score of the binomial trials y <- rbinom(k,n,0.87) #dependent variable x1 <- rnorm(k,1,50) #covariable 1 x2 <- rnorm(k,30,9) #covariable 2 X <- cbind(1,x1,x2) #model matrix IWLS(y,X,n) ```

idaejin/HRQoL documentation built on May 18, 2019, 2:32 a.m.