//
//Prediction of segment by maharanobis distance with learning data. 
//
//(Caution) 
//It is necessary to make the segment variable a number except 0 for learning.
//The record with a segment variable of 0 value is predicted.

//Syntax 
maha [variables] by [segment variable]

//Example 1
//handin segment and 3D data.
//last 3 record is predicated by command.
hand kbn,x,y,z/
1,  7,  8,71
1, 30, 28,33
1, 60, 29,26
1, 28, 55,19
1, 57, 60,19
1, 77, 62,25
1, 69, 77,91
1, 55, 94,43
1, 96, 93,48
1,111,134,54
2,107, 58,71
2,130, 78,36
2,160, 79,73
2,128,105, 7
2,157,110, 2
2,177,112,98
2,169,127,72
2,155,144,75
2,196,143, 6
2,211,184,96
3,207,184,54
3,230,108,96
3,260,128,30
3,228,129,40
3,257,155,95
3,277,160, 5
3,269,162,86
3,255,177,93
3,296,194,57
3,311,193,69
0,111,134,54
0,211,184,96
0,296,194,57
;

//inspection for graph
plot scat x y z by kbn/
kbn:code
;

View 3D data by segment

mark nodes are predicated segment.

//execute mahanobis segmentation. maha x y z by kbn;

Output shows belonging segment by minimum distance

dis_0 is distance from center of segment 1. dis_1 is distance from center of segment 2. dis_2 is distance from center of segment 3.