Usage
MRSP(formula, data, class.names = NULL, model = multinomlogit(), constr = NULL, offset = NULL, weights = NULL, penweights = NULL, standardize = TRUE, nrlambda = 50, lambdamin = 0.01, lambdamax = NULL, control = NULL, penalty = TRUE, group.classes = TRUE, group.dummies = TRUE, sparse.groups = FALSE, adaptive = FALSE, threshold = FALSE, refit = FALSE, lambda, lambdaR = 0, lambdaF = 0, gamma = 1, psi = 1, fusion = FALSE, nonneg = FALSE, y = NULL, X = NULL, Z = NULL, penindex = NULL, grpindex = NULL, mlfit = NULL, perform.fit = TRUE, ...)
Arguments
formula
A symbolic description of the model to be fitted. The left-hand
side specifies the response, which must be a categorical variable with K
categories. The right-hand-side specifies the covariate structure. See details below.
data
A data frame containing the variables in formula
. It must
be in long format. This means that K
rows are required for each
individual observation. For details and a possibility to convert to this
format, see mlogit.data
from the mlogit package.
The response variable must be either a 0-1-vector or a logical
vector, with 1 or TRUE indicating the observed class/category/alternative. class.names
An optional character vector of length K
specifying
the names of the response classes/categories.
model
An object of class MRSP.model
that specifies the model to
be used. Currently, model = multinomlogit()
and
model = sequentiallogit()
are available, yielding a multinomial or
sequential logit model, respectively. Cumulative logit models will be included
in future versions of MRSP
.
constr
The identifiability constraint to be used. The coefficients of
predictors which do not vary over categories (i.e. global/individual-specific
predictors) are not identifiable in (unpenalized) multinomial logit models.
Either an integer in [1,K]
or "symmetric"
or "none"
. See
details below.
offset
An optional vector of offsets. Must be of appropriate length.
weights
An optional vector of observations weights. Must be of
appropriate length.
penweights
An object containing weights that modify the penalty terms
on different parameters. See MRSP.fit
for details.
standardize
If TRUE
, predictors are mean-centered and standardized to
unit variance. The reported coefficients, by default, correspond to the
original covariates.
nrlambda, lambdamin, lambdamax
If a sequence of lambda
values is
not specified explicitly via argument lambda
, MRSP
computes a
suitable grid of length nrlambda
, ranging from lambdamin
to
lambdamax
. If lambdamax
is missing, MRSP
tries to find
a suitable value for it.
control
An object of class MRSP.control
that stores control
information. It's slots max.iter
and rel.tol
specify the max
number of iterations and the relative change in penalized log-likelihood
values that indicates convergence. The other slots should not be changed
unless by experienced users.
penalty
Specifies the general type of penalty to be applied. FALSE
means no penalty is used. TRUE
means that a lasso-type penalty is applied.
"Ridge"
applies a ridge penalty. Arguments group.classes
,
group.dummies
and sparse.groups
have no effect unless
penalty = TRUE
.
group.classes
If TRUE
, lasso-type penalties will be grouped across all
coefficients belonging to the same covariate. This corresponds to the
CATS Lasso penalty proposed in Tutz, Poessnecker and Uhlmann (2015).
group.dummies
If entries on the rhs of formula
refer to factor
variables with more than 2 levels, several dummy variables will enter the
model that are related to the same actual covariate. Setting this argument to
TRUE
will yield penalty terms that treat all corresponding coefficients as
one parameter group. This corresponds to the original Group Lasso
of Yuan and Lin (2006).
sparse.groups, gamma
If TRUE
, parameter groups will also be penalized
by an L1 penalty on top of the unsquared L2 penalty. If the L2 penalty uses a
tuning parameter of value lambda, the L1 penalty will use tuning parameter
lambda*gamma.
adaptive
Should adaptive weights be used? Use adaptive="ML"
to
obtain the traditional adaptive weights proposed in the literature. Using
adaptive = TRUE
computes the penalized estimator with whatever penalty is
specified and no adaptive weights and computes adaptive weights from the output
of this penalized model. The final output is the computed with those
adaptive weights. It is strongly recommended to prefer adaptive="ML"
over adaptive=TRUE
.
threshold
If TRUE
, the coefficients will be thresholded with an
appropriate threshold value. You can also specify an explicit nonnegative
value to be used as the threshold.
refit
Should refitting be performed? If TRUE
, the model is first fit
traditionally, and then refitted on the active set found by this first fit.
This can improve variable selection, but tends to be rather slow and memory-consuming.
lambda
Tuning parameter(s) to be used. Can be a nonnegative scalar or
vector. If missing, MRSP
computes a suitable grid of lambda values,
see also nrlambda
.
lambdaR
Lambda value(s) for ridge penalties. Same structure as
lambda
.
lambdaF
Lambda values(s) for fusion penalties. Same structure as
lambda
. Not yet supported for end-users of MRSP
, but included
for compatibility with future releases of MRSP
.
psi
A numeric that balances the weighting of penalties on global and
class-/category-/alternative-specific predictors (if present) in multinomial
logit models. Penalties on global predictors are weighted with psi
,
penalties on class-specific predictors are weighted with (2-psi)
.
fusion
If fusion penalties are used, this specifies the type of fusion.
Not yet supported for end-users of MRSP
, but included
for compatibility with future releases of MRSP
.
nonneg
If TRUE
, all coefficients are restricted to be nonnegative.
y, X, Z, penindex, grpindex, mlfit
These optional arguments allow to
supply the corresponding objects directly to MRSP.fit
. It is highly
recommended not to use those arguments and to use formula
instead for
the model specification.
perform.fit
If TRUE, the model is fitted. If FALSE, function MRSP
prepares the call to MRSP.fit
and returns a list from which this call
can be accessed.
...
Further arguments to be passed.