predict.ldaPlus {multiUS} | R Documentation |
Predict the values of a categorical variable based on a linear discriminant function
Description
The function predicts the values of a categorical variable based on a linear discriminat function.
Usage
## S3 method for class 'ldaPlus'
predict(
object,
newdata,
prior = object$prior,
dimen,
method = c("plug-in", "predictive", "debiased"),
betweenGroupsWeights = object$betweenGroupsWeights,
...
)
Arguments
object |
Object obtained by the |
newdata |
New dataset (without categorical variable). |
prior |
Prior probabilities of class membership to be used to predict values. |
dimen |
The number of dimensions/linear discriminant functions to use. Defaults to all. |
method |
Possible values are |
betweenGroupsWeights |
The proportions/weights used when computing the grand/total mean from group means. |
... |
other arguments passed to function |
Value
A list with the following elements:
-
class
- Predicted values of categorical variable. -
posterior
- Posterior probabilities (the values of the Fisher's calsification linear discrimination function). -
x
- Estimated values of discriminat function(s) for each unit.
Author(s)
Aleš Žiberna
See Also
MASS::predict
Examples
# Use the first 20 cars to estimate the model and the rest of cars to predict
# (for each car) wheter it has a V-shape engine or a straight engine.
ldaCars <- ldaPlus(x = mtcars[1:20,c(1, 2, 4, 5, 6)], grouping = mtcars[1:20,8])
predict.ldaPlus(object = ldaCars, newdata = mtcars[20:32,c(1, 2, 4, 5, 6)])