glm.nreg {RCAL}R Documentation

Non-regularied M-estimation for fitting generalized linear models

Description

This function implements non-regularizd M-estimation for fitting generalized linear models with continuous or binary responses, including maximum likelihood, calibrated estimation, and covariate-balancing estimation in the latter case of fitting propensity score models.

Usage

glm.nreg(y, x, iw = NULL, loss = "cal", init = NULL)

Arguments

y

An n x 1 response vector.

x

An n x p matix of covariates, excluding a constant.

iw

An n x 1 weight vector.

loss

A loss function used, which can be specified as "gaus" for continuous responses, or "ml", "cal", or "bal" for binary responses.

init

A (p+1) x 1 vector of initial values (the intercept and coefficients).

Details

Least squares estimation is implemented by calling lm for continuous responses (loss="gaus"). For binary responses, maximum likelihood estimation (loss="ml") is implemented by calling glm. Calibrated estimation (loss="cal") is implemented by using a trust-region algorithm in the R package trust to minimize the calibration loss, i.e., (6) in Tan (2020). Covariate-balancing estimation (loss="bal") in Imai and Ratkovic (2014) is implemented by using trust to minimize (36) in Tan (2020a).

Value

coef

The (p+1) x 1 vector of estimated intercept and coefficients.

fit

The n x 1 vector of fitted values.

conv

Logical; 1 if loss="gaus" for continuous responses or convergence is obtained within 1000 iterations by glm with loss="ml" or trust with loss="cal" or "bal" for binary responses.

References

Imai, K. and Ratkovic, M. (2014) Covariate balancing propensity score, Journal of the Royal Statistical Society, Ser. B, 76, 243-263.

Tan, Z. (2020) Regularized calibrated estimation of propensity scores with model misspecification and high-dimensional data, Biometrika, 107, 137–158.

Examples

data(simu.data)
n <- dim(simu.data)[1]
p <- dim(simu.data)[2]-2

y <- simu.data[,1]
tr <- simu.data[,2]
x <- simu.data[,2+1:p]
x <- scale(x)

# include only 10 covariates
x2 <- x[,1:10]

ps.ml <- glm.nreg(y=tr, x=x2, loss="ml")
check.ml <- mn.ipw(x2, tr, ps.ml$fit)
check.ml

ps.cal <- glm.nreg(y=tr, x=x2, loss="cal")
check.cal <- mn.ipw(x2, tr, ps.cal$fit)
check.cal  # should be numerically 0

ps.bal <- glm.nreg(y=tr, x=x2, loss="bal")
check.bal <- mn.ipw(x2, tr, ps.bal$fit)
check.bal


[Package RCAL version 2.0 Index]