mAIC.LA.ridgeGLM {squeezy} | R Documentation |
Marginal AIC of a multi-group, ridge penalised GLM
Description
Compute the marginal AIC for the marginal likelihood (ML) of multi-group, ridge penalised generalised linear models. Note: currently only implemented for linear and logistic regression.
Usage
mAIC.LA.ridgeGLM(loglambdas, XXblocks, Y, sigmasq = 1,
Xunpen = NULL, intrcpt = TRUE, model, minlam = 0)
Arguments
loglambdas |
Logarithm of the ridge penalties as returned by ecpc or squeezy; Gx1 vector. |
XXblocks |
List of sample covariance matrices X_g %*% t(X_g) for groups g = 1,..., G. |
Y |
Response data; n-dimensional vector (n: number of samples) for linear and logistic outcomes. |
sigmasq |
(linear model only) Noise level (Y~N(X*beta,sd=sqrt(sigmasq))). |
Xunpen |
Unpenalised variables; nxp_1-dimensional matrix for p_1 unpenalised variables. |
intrcpt |
Should an intercept be included? Set to TRUE by default. |
model |
Type of model for the response; linear or logistic. |
minlam |
Minimum value of lambda that is added to exp(loglambdas); set to 0 as default. |
Value
mAIC |
mAIC of the model |
Examples
#Simulate toy data
n<-100
p<-300
X <- matrix(rnorm(n*p),n,p)
Y <- rnorm(n)
groupset <- list(1:(p/2),(p/2+1):p)
sigmahat <- 2
alpha <- 0.5
tauMR <- c(0.01,0.005)
XXblocks <- lapply(groupset, function(x)X[,x]%*%t(X[,x]))
#compute the mAIC of a co-data model with multiple groups
mAIC.LA.ridgeGLM(loglambdas=log(sigmahat/tauMR), XXblocks=XXblocks,
Y = Y, sigmasq = sigmahat, model="linear")
#compute the mAIC of a co-data agnostic model, i.e. only one group of covariates
mAIC.LA.ridgeGLM(loglambdas=log(sigmahat/median(tauMR)),
XXblocks=list(X%*%t(X)),
Y = Y, sigmasq = sigmahat, model="linear")