ClassificationDiscriminant - How to exclude a predictor for only one group level?
Show older comments
I am using ClassificationDiscriminant.fit to classify data. I seek to predict classes of Y, a nominal categorical variable, by X, a n-by-5 matrix of continous valued measurements.
Because some groups of Y (e.g. class level "l.b") have zero variance, I get the error:
“Error using ClassificationDiscriminant (line 624) Predictor x1 has zero variance for class l.b. Either exclude this predictor or set 'discrimType' to 'pseudoQuadratic' or 'diagQuadratic'.”
However, I cannot find user-guide, help notes or documentation that indicate how to exclude a predictor during this process. I do not want to use 'pseudoQuadratic' or the other, but would like to exclude the predictor causing the problem. Can someone please explain a simple efficient way to accomplish this?
The solution proposed to exclude an entire column of the matrix of predictors is not acceptable. This not a viable solution because this is a case where the predictor variance is zero for only one class level of the grouping variable. Removing the entire predictor variable will eliminate an important factor. What I figure is needed is: 1 ) to reassign that category of the grouping variable to another category; or 2 ) remove observations belonging to that category. Does anyone agree? What I am seeking is to use ClassificationDiscriminant.fit to proceed by excluding these zero-var cases without throwing an error, i.e. automatically exclude them. Assuming that is not possible, how do I access the variance information by category (group level) during ClassificationDiscriminant.fit, so that I can use its calculations to handle these cases prior to it throwing an error? Must I calculate the intra group level variances myself prior to submitting the data to ClassificationDiscriminant.fit?
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Discriminant Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!