Plot the coefficient paths.

# S3 method for mcreg
plot(
  obj,
  class_var = "class",
  x_vars = NULL,
  coef_type = c("rescaled", "scaled"),
  plot_type = c("knot", "lambda"),
  log_x = NULL
)

Arguments

obj

an multiclass regression object (object of class mcreg)

class_var

the name of the class variable in the data frame

y_var

the name of the dependent variable in the data frame

...

additional arguments to be passed on to multiclass_reg()

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))
df = lists_to_data(Y, X)
mc1 = mc_reg(df)
plot(mc1)