Fit the multiclass regression estimator

multiclass_reg(
  Y,
  X,
  weighting = FALSE,
  weights = NULL,
  wtype = "size",
  initestim = NULL,
  normalize = TRUE,
  x_names = NULL,
  lambdas = NULL
)

Arguments

Y

list of size K. Its kth entry is a vector of size n_k

X

list of size K. Its kth entry is a matrix of size n_kxp

weighting

logical. If TRUE: use weighted regularization parameter

weights

provide vector of weights

wtype

either "size" (default, weighting based on group samle sizes), "init" (weighting based on initial estimator), "combi" (weighting based on group sample sizes and initial estimator)

initestim

pK-dimensional vector with estimated coefficients of initial estimator

normalize

logical. Whether or not to normalize the weights (currently divides by maximum).

Value

A list with the following components

fit

fitted genlasso object

coef

matrix of estimated coefficients

lambda

vector of regularization parameters along knots of regularization path

K

number of classes

p

number of predictors per class

n

vector of sample sizes for each class

Y

composite Y vector (stacked over the classes)

X

block diagonal X matrix (each block coresponds to a class)

var_indicator

matrix of variable indicators

Examples

p = 7
k = 2
n = 20
beta = c(1,2)
set.seed(1)
X = list(matrix(rnorm(p*n), ncol = p), matrix(rnorm(p*n), ncol = p))
Y = list(rnorm(n), rnorm(n))
# no missing data
res = multiclass_reg(Y, X)