ucpm
.stepclass(x, ...)
## S3 method for class 'default':
stepclass(x, grouping, method, improvement = 0.05, maxvar = Inf,
start.vars = NULL, direction = c("both", "forward", "backward"),
criterion = "CR", fold = 10, cv.groups = NULL, output = TRUE,
min1var = TRUE, ...)
## S3 method for class 'formula':
stepclass(formula, data, method, ...)
formula
is not given).groups ~ x1 + x2 + ...
.
That is, the response is the grouping factor and the right hand side
specifies the (non-factor) discriminators.
Interaction terms are not supported.lda
direction
forward
both
directi
forward
backward
both
ucpm
.cv.groups
method
stepclass
lda
ucpm
response ~ list + of + selected + variables
lda
predict
predict.lda
lda
posterior
method(x, grouping, ...)
Then a stepwise variable selection is performed.
The initial model is defined by the provided starting variables;
in every step new models are generated by including every single
variable that is not in the model, and by excluding every single
variable that is in the model. The resulting performance measure for these
models are estimated (by cross-validation), and if the maximum value of the chosen
criterion is better than improvement
direction
forward
direction
backward
step
, stepAIC
,
and greedy.wilks
for stepwise variable selection according to Wilk's lambdadata(iris)
library(MASS)
iris.d <- iris[,1:4] # the data
iris.c <- iris[,5] # the classes
sc_obj <- stepclass(iris.d, iris.c, "lda", start.vars = "Sepal.Width")
sc_obj
plot(sc_obj)
## or using formulas:
sc_obj <- stepclass(Species ~ ., data = iris, method = "qda",
start.vars = "Sepal.Width", criterion = "AS") # same as above
sc_obj
## now you can say stuff like
## qda(sc_obj$formula, data = B3)
Run the code above in your browser using DataLab