coef.MVS {mvs}R Documentation

Extract coefficients from an "MVS" object.

Description

Extract coefficients at each level from an "MVS" object at the CV-optimal values of the penalty parameters.

Usage

## S3 method for class 'MVS'
coef(object, cvlambda = "lambda.min", ...)

Arguments

object

An object of class "MVS".

cvlambda

By default, the coefficients are extracted at the CV-optimal values of the penalty parameters. Choosing "lambda.1se" will extract them at the largest values within one standard error of the minima.

...

Further arguments to be passed to coef.cv.glmnet.

Value

An object of S3 class "MVScoef".

Author(s)

Wouter van Loon <w.s.van.loon@fsw.leidenuniv.nl>

Examples

 
set.seed(012)
n <- 1000
X <- matrix(rnorm(8500), nrow=n, ncol=85)
top_level <- c(rep(1,45), rep(2,20), rep(3,20))
bottom_level <- c(rep(1:3, each=15), rep(4:5, each=10), rep(6:9, each=5))
views <- cbind(bottom_level, top_level)
beta <- c(rep(10, 55), rep(0, 30)) * ((rbinom(85, 1, 0.5)*2)-1)
eta <- X %*% beta
p <- 1 /(1 + exp(-eta))
y <- rbinom(n, 1, p)

fit <- MVS(x=X, y=y, views=views, type="StaPLR", levels=3, alphas=c(0,1,1), nnc=c(0,1,1))
coefficients <- coef(fit)

new_X <- matrix(rnorm(2*85), nrow=2)
predict(fit, new_X)

[Package mvs version 1.0.2 Index]