View source: R/ridgeGLMandCo.R
ridgeGLM | R Documentation |
Function that evaluates the targeted ridge estimator of the regression parameter of generalized linear models.
ridgeGLM(Y, X, U=matrix(ncol=0, nrow=length(Y)), lambda,
lambdaG=0, Dg=matrix(0, ncol=ncol(X), nrow=ncol(X)),
target=rep(0, ncol(X)), model="linear",
minSuccDiff=10^(-10), maxIter=100)
Y |
A |
X |
The design |
U |
The design |
lambda |
A positive |
lambdaG |
A positive |
Dg |
A non-negative definite |
target |
A |
model |
A |
minSuccDiff |
A |
maxIter |
A |
This function finds the maximizer of the following penalized loglikelihood: \mathcal{L}( \mathbf{Y}, \mathbf{X}, \mathbf{U}; \boldsymbol{\beta}, \boldsymbol{\gamma}) - \frac{1}{2} \lambda \| \boldsymbol{\beta} - \boldsymbol{\beta}_0 \|_2^2 - \frac{1}{2} \lambda_g ( \boldsymbol{\beta} - \boldsymbol{\beta}_0 )^\top \Delta_g ( \boldsymbol{\beta} - \boldsymbol{\beta}_0 )
, with loglikelihood \mathcal{L}( \mathbf{Y}, \mathbf{X}; \boldsymbol{\beta})
, response \mathbf{Y}
, design matrices \mathbf{X}
and \mathbf{U}
, regression parameters \boldsymbol{\beta}
and \boldsymbol{\gamma}
, penalty parameter \lambda
, shrinkage target \boldsymbol{\beta}_0
, and generalized ridge penalty matrix \Delta_g
. For more details, see van Wieringen, Binder (2020) and Lettink et al. (2022).
A numeric
, the generalized ridge estimate of the regression parameter. If a nonempty \mathbf{U}
is supplied, the first few elements are the unpenalized effect estimates of the covariates that comprise this design matrix.
The penalized IRLS (Iterative Reweighted Least Squares) algorithm for the evaluation of the generalized ridge logistic regression estimator may fail to converge for small penalty parameter values in combination with a nonzero shrinkage target.
W.N. van Wieringen.
van Wieringen, W.N. Binder, H. (2022), "Sequential learning of regression models by penalized estimation", submitted.
Lettink, A., Chinapaw, M.J.M., van Wieringen, W.N. (2022), "Two-dimensional fused targeted ridge regression for health indicator prediction from accelerometer data", submitted.
# set the sample size
n <- 50
# set the true parameter
betas <- (c(0:100) - 50) / 20
# generate covariate data
X <- matrix(rnorm(length(betas)*n), nrow=n)
# sample the response
probs <- exp(tcrossprod(betas, X)[1,]) / (1 + exp(tcrossprod(betas, X)[1,]))
Y <- numeric()
for (i in 1:n){
Y <- c(Y, sample(c(0,1), 1, prob=c(1-probs[i], probs[i])))
}
# set the penalty parameter
lambda <- 3
# estimate the logistic regression parameter
bHat <- ridgeGLM(Y, X, lambda=lambda, target=betas/2, model="logistic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.