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 ldaPlus function or by the MASS::lda.

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 plug-in, predictive and debiased.

betweenGroupsWeights

The proportions/weights used when computing the grand/total mean from group means.

...

other arguments passed to function MASS::predict.

Value

A list with the following elements:

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)])

[Package multiUS version 1.2.3 Index]