MACRO # minitab local macro for versions 11-13 MIX13 X GUESS MOD; PARAM M S P; POSTPROB PP.1-PP.10. #______________________________________________________ # macro uses em algorithm to find maximum likelihood # solution to fitting a mixture of n normals # to a given univariate sample. # macro provides lists of the estimated means, standard deviations, # and proportions in the session window. Also provides a plot of the mixture # model and its component normal densities. The macro optionally # provides output of the estimated parameters and posterior # probabilities if the subcommands are used to specify output columns. # for param specify 3 columns. For postprob specify 10 columns. # last modified: 07/02/06 # author: michael thompson # further information: amc technical brief no 22 #______________________________________________________ #input declarations MCOLUMNS X # input data in a column, not changed by procedure. MCOLUMNS GUESS # starting estimates of component means in a column, # unchanged by procedure. MCONSTANTS MOD # if mod is set to 1, the algorithm will calculate a # pooled standard deviation, otherwise each componment # will have a separate standard deviation. #_____________________________________________________________ #OUTPUT DECLARATIONS MCOLUMNS M S P # estimated component parameters MCOLUMNS PP.1-PP.10 # posterior probabilities of membership #_______________________________________________________________ # workspace MCOLUMNS Y MCOLUMNS SUMPF MCOLUMNS PF.1-PF.10 MCOLUMNS F.1-F.10 MCOLUMNS NIT MCOLUMNS CLOGL MCOLUMNS SUMP MCOLUMNS WSS MCOLUMNS XPOINT MCONSTANTS NDATA MCONSTANTS I INDEX MCONSTANTS LOW HIGH INC TOP MCONSTANTS PREVIOUS MCONSTANTS NCOMP MCONSTANTS LOGL MCONSTANTS POOL MCONSTANTS TEMP TEMPA #____________________________________________________ NOTITLE COPY GUESS M LET NCOMP=N(M) LET NDATA=N(X) ERASE S P # define prior probabilities for group membership SORT X Y LET LOW=Y(1) DO I=1:NCOMP IF I