mseRidge: Compute MSE, Bias, and Variance for Ridge Estimator

Description Usage Arguments Details Value Author(s)

View source: R/functions_ridge.R

Description

Computes the analytic mean-squared error (MSE), bias, and variance for ridge regression estimators given different values of the true beta and sigma2 parameters.

Usage

1
2
3
4
5
mseRidge(lambda, XtX, beta, sigma2, penalize, ind = 1, XtXlamIinv = NULL)

biasRidge(lambda, XtX, beta, penalize, ind = 1, XtXlamIinv = NULL)

varRidge(lambda, XtX, sigma2 = 1, penalize, ind = 1, XtXlamIinv = NULL)

Arguments

lambda

penalty parameter value. For biasRidge and varRidge, this should be a single value. For mseRidge, either a single value of a list of values.

XtX

Cross product of design matrix. Not needed if XtXlamIinv is provided.

beta

True parameter values. Either a vector of length p or a p x d matrix.

sigma2

Value of the variance parameter

penalize

Vector of penalty factors. See estRidge for more information.

ind

Numerical or logical vector indicating which elements of the bias vector and variance matrix should be returned. Defaults to the first element.

XtXlamIinv

Optional explicit value of (XtX + diag(lambda*penalize))^(-1).

Details

The computations assume that all covariates are correctly included in the mean model and bias is due only to penalization. The bias is given by:

-(X'X + Λ)^{-1}Λβ

where Λ = diag(λ*penalize). The variance is given by:

σ^2(X'X + Λ)^{-1}X'X(X'X + Λ)^{-1}

If beta is provided as a matrix, this will treat each column of beta as a different true parameter vector and return a matrix of bias values (or a vector, if ind has length 1).

Providing a pre-computed value of XtXlamIinv can reduce the computational cost in simulations. However, the user is responsible for assuring that the value of lambda provided matches the value used to compute XtXlamIinv.

Value

For mseRidge, a list containing the variance, bias, and MSE. For biasRidge and varRidge, a matrix is returned.

Author(s)

Joshua Keller


jpkeller/eshrink documentation built on Sept. 10, 2020, 6:29 a.m.