# How to classify new cases in discriminant analysis exactly as SPSS does?

What I have:

There is one base with already classified cases. There are 23 independent variables that were used in this classification and 10 groups.

Another base has new unclassified cases. There are also these 23 independent variables.

I do discriminant analysis in SPSS on the first base (I choose 'Within-Groups covariance' in Discriminant Analysis: Statistics > Matrices) and then I can save the model as an XML file and apply it on the second base. But I need to accomplish classification by myself without using SPSS but just like SPSS does (what a pity!)

How I do it now:

In the first base I calculate means of all 23 variables in each group i.e. I have 23*10 different means.

Then for each case in the second base I calculate 10 Mahalanobis distances:

D[k]= sum [j=1..23] (x[j]-x[jk])^2

k=1..10 is a number of the group

x[j] is the value of the independent variable

x[jk] is the mean of the independent variable in group k

After all of this is done, I look up in the SPSS output the 10 values of prior probabilities (pp). Then for each case I calculate 10 variables:

pp[k] * e ^ (-D[k]/2)

k=1..10

Then each of this variables I divide by the sum of all of them. So I get the posterior probabilities. I classify the case in that group for which the posterior probability is maximum.

But my classification is not exactly like SPSS does. The sizes of the groups are somehow similar though. I admit that I could have made something really wrong and/or stupid :)

The theory I used:

http://publib.boulder.ibm.com/infocenter/spssstat/v20r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.help%2Falg_discriminant.htm

J.-O. Kim, C. U. Mueller, and C. Klecka, Factor, Discriminant and Cluster Analysis

• By the link you provide I conclude that you speak Russian. Once I gave a concise answer exactly to the question - how does SPSS classifies cases in DA - elsewhere. Maybe you find it worth reading. – ttnphns Apr 3 '12 at 15:34
• Thank you so much for answering, I have sent you a message via LJ. – Oxana Apr 3 '12 at 18:14