Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/predict.logitchoice.r
Similar to other predict methods, this function returns fitted values on the response scale.
1 2 |
object |
Fitted |
X |
Matrix of new values for which to make predictions. Must have the same number of variables as during training the model. |
grouping |
Grouping information for choice situations as in logitchoice. |
lambda |
User input lambda sequence. Must be subset of the lambdas used in fitting. If NULL (the default), predict at all the lambdas used during fitting. |
... |
Not used. Other arguments to predict. |
If lambda is not specified, makes predictions at all the fitted lambda values. Users may provide their own lambda sequence, but this must be a subset of the values used to fit the models.
A matrix of predicted values, with columns corresponding to each fitted model.
Michael Lim
Maintainer: Michael Lim michael626@gmail.com
logitchoice
, predict.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 = 10
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.