train.lda | R Documentation |
Provides a wrapping function for the lda
.
train.lda(formula, data, ..., subset, na.action)
formula |
A formula of the form groups ~ x1 + x2 + ... That is, the response is the grouping factor and the right hand side specifies the (non-factor) discriminators. |
data |
An optional data frame, list or environment from which variables specified in formula are preferentially to be taken. |
... |
Arguments passed to or from other methods. |
subset |
An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.) |
na.action |
Function to specify the action to be taken if NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values on any required variable. (NOTE: If given, this argument must be named.) |
A object lda.prmdt with additional information to the model that allows to homogenize the results.
The parameter information was taken from the original function lda
.
The internal function is from package lda
.
len <- nrow(iris)
sampl <- sample(x = 1:len,size = len*0.20,replace = FALSE)
ttesting <- iris[sampl,]
ttraining <- iris[-sampl,]
model.lda <- train.lda(Species~.,ttraining)
model.lda
prediction <- predict(model.lda,ttesting)
prediction
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.