ridgeGLMdof: Degrees of freedom of the generalized ridge estimator.

View source: R/ridgeGLMandCo.R

ridgeGLMdofR Documentation

Degrees of freedom of the generalized ridge estimator.

Description

Function that evaluates the degrees of freedom of the generalized ridge estimator of the regression parameter of generalized linear models.

Usage

ridgeGLMdof(X, U=matrix(ncol=0, nrow=nrow(X)), lambda, 
         lambdaG, Dg=matrix(0, ncol=ncol(X), nrow=ncol(X)), 
         model="linear", linPred=rep(0,nrow(X)))

Arguments

X

The design matrix of the penalized covariates. The number of rows should match the number of elements of Y.

U

The design matrix of the unpenalized covariates. The number of rows should match the number of elements of Y.

lambda

A positive numeric that is the ridge penalty parameter.

lambdaG

A positive numeric that is the generalized ridge penalty parameter.

Dg

A non-negative definite matrix of the unscaled generalized ridge penalty.

model

A character, either "linear" and "logistic" (a reference to the models currently implemented), indicating for which generalized linear model model instance the degrees of freedom is to be evaluated.

linPred

A numeric, the linear predictor associated with the provided X, U, lambda, lambdaG, and Dg. The number of elements of linPred should match the number of rows of X and U.

Details

The degrees of freedom of the regular ridge regression estimator is usually defined the trace of the ridge hat matrix: \mbox{tr} [ \mathbf{X} (\mathbf{X}^{\top} \mathbf{X} + \lambda \mathbf{I}_{pp})^{-1} \mathbf{X}^{\top}]. That of the regular ridge logistic regression estimator is defined analoguously by Park, Hastie (2008). Lettink et al. (2022) translates these definitions to the generalized ridge (logistic) regression case.

Value

A numeric, the degrees of freedom consumed by the (generalized) ridge (logistic) regression estimator.

Author(s)

W.N. van Wieringen.

References

Park, M. Y., & Hastie, T. (2008). Penalized logistic regression for detecting gene interactions. Biostatistics, 9(1), 30-50.

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.

Examples

# 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)

# set the penalty parameter
lambda <- 3

# estimate the logistic regression parameter
dofs <- ridgeGLMdof(X, lambda=lambda, lambdaG=0, 
                    model="logistic", 
                    linPred=tcrossprod(X, t(betas)))

porridge documentation built on May 29, 2024, 1:37 a.m.