Description Usage Arguments Details Value Author(s) See Also Examples
The regularization path is computed along a grid of values for the regularization parameter lambda. No standardization is applied to any of the inputs prior to estimation. Unless the model is fit without regularization (lambda = 0), we recommend that the user performs some kind of standardization.
1 2 | logitchoice(X, Y, grouping, lambda=NULL, nLambda=50, lambdaMinRatio=0.01,
tol=1e-3, alpha=0.8, maxIter=5000, verbose=FALSE, numCores=1)
|
X |
Matrix of features or predictors with dimension nobs x nvars;
each row is an observation vector for a particular alternative. Thus if
there are k alternatives for an observation, this observation consists of
k rows in |
Y |
Target variable of length nobs. Must contain a single 1 for each choice situation, so that sum(Y) = number of observations |
grouping |
Grouping information that identifies the choice situations, i.e. if an observation consists of k alternatives, all those k rows in X are assigned to the same group. |
lambda |
A user supplied |
nLambda |
The number of |
lambdaMinRatio |
Smallest value for |
tol |
Convergence tolerance in the adaptive FISTA algorithm. |
alpha |
Backtracking parameter in majorization-minimization scheme. |
maxIter |
Maximum number of iterations in adaptive FISTA. Default 5000. |
verbose |
Prints progress. False by default. |
numCores |
Number of threads to run. For this to work, the package must be installed with OpenMP enabled. Default is 1 thread. |
The sequence of models implied by lambda
is fit by FISTA (fast
iterative soft thresholding) with adaptive step size and adaptive
momentum restart.
An object of class logitchoice
with the components
call |
The user function call. |
betahat |
The fitted coefficients, with dimension nVars x
|
yhat |
The fitted values, with dimension nobs x
|
residual |
Residuals for each |
lambda |
The actual |
objValues |
Objective values for each lambda. |
numIters |
Number of algorithm iterations taken for each fitted |
Michael Lim
Maintainer: Michael Lim michael626@gmail.com
predict.logitchoice
,
coef.logitchoice
1 2 3 4 5 6 7 8 9 10 11 | groupSizes = sample(6:18, 100, replace=TRUE)
numGroups = length(groupSizes)
n = sum(groupSizes)
p = 20
X = matrix(rnorm(n*p), nrow=n)
X = scale(X)
Y = rep(0, n)
Y[cumsum(groupSizes)] = 1
grouping = rep(1:numGroups, groupSizes)
fit = logitchoice(X, Y, grouping)
max(abs(fit$yhat - predict(fit, X, grouping)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.