//
//EM(Expection Maximum) Algorithm analysis command
//
//Quation
//This command is like kmeans command. but can use initial segment.
//

//Syntax
em variables by segment;


//
//Example 1
// 
get irisR.csv@;
em SepalL SepalW PetalL PetalW by 3;

//
//Example 2
//
//EM can be use initial segment by target variable for good convergency.
//Iris data is segmented by 3 type by k-means method.
//EM algorithm uses k-means segment as inital.
get irisR.csv@;
kmeas SepalL SepalW PetalL PetalW by 3;
get freq@ana;
em SepalL SepalW PetalL PetalW by seg; 

//view output 
get freq@ana;
plot scat SepalL SepalW PetalL by prob_2;