Description Usage Arguments Details Value Author(s) References Examples
Performs logisitc regressions for bionomial data.
1 |
y |
response vector of observed proportions. |
X |
model matrix of |
n |
the vector of binomial denominators. When NULL n is equal to a 1s vector. |
intercept |
a logic value to indicate whether the intercept will be added directly by the function to the model matrix or not. The default value is FALSE i.e. add a vector of 1s to X. |
tol |
the convergence tolerance criterion. |
max.iter |
Maximum of iteration to be the limit if convergence is not attained. The default valueis 1000 iterations. |
The function performs the IWLS algorithm applied to binomial logistic regression (Fox, 2002)
Returns a list including the following:
estimates |
the maximum likelihood estimates of the coefficients. |
var |
the covariance matrix of coeeficients. |
n.iter |
the number of iterations at convergence. |
Sewanou Honfo <honfosewanou@gmail.com> and Romain Glèlè Kakaï <glele.romain@gmail.com>/ LABEF_07_2019
Fox John (2002). An R and S-Plus companion to applied regression. Sage Publications.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Example on Mroz data from the package car
## Load packages and data
library(car)
data(Mroz)
str(Mroz)
## Convert non numeric variables to numeric
Mroz$lfp <- recode(Mroz$lfp, "'yes' = 1; 'no'= 0", as.factor = F)
Mroz$wc <- recode(Mroz$wc, "'yes' = 1; 'no'= 0", as.factor = F)
Mroz$hc <- recode(Mroz$hc, "'yes' = 1; 'no'= 0", as.factor = F)
## Run the binary logistic regression using the iterative weighted least squares estimation methods
attach(Mroz)
m.log <- iwls.bnreg(y = lfp, X = cbind(k5, k618, age, wc, hc, lwg, inc), n = NULL, intercept = FALSE, tol = 1e-07, max.iter = 1000)
## View the result
m.log$estimates
m.log$var
m.log$n.iter
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.