The data is entirely contained within the script via a DATALINES statement. A 'galaxies' table is created with a 'velocity' variable which is then transformed into 'v'.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'galaxies' table. It reads velocity values from the embedded data lines (datalines). The ' @@' operator allows reading multiple observations per data line. A new variable 'v' is calculated by dividing the velocity by 1000 to normalize it.
Explanation : This FMM procedure analyzes the 'v' variable to find the best normal distribution mixture model, testing a number of components from 3 to 7 (kmin=3, kmax=7). The Akaike Information Criterion (AIC) is used to select the best 'k'. Component variances are allowed to be different.
Copied!
title2 "Three to Seven Components, Unequal Variances";
ods graphics on;
proc fmm data=galaxies criterion=AIC;
model v = / kmin=3 kmax=7;
run;
1
title2 "Three to Seven Components, Unequal Variances";
2
ods graphics on;
3
PROC FMMDATA=galaxies criterion=AIC;
4
model v = / kmin=3 kmax=7;
5
RUN;
3 Code Block
PROC FMM
Explanation : A second FMM analysis is performed, similar to the previous one, but by adding the 'equate=scale' option. This option constrains the mixture components to have equal variances, which simplifies the model.
Copied!
title2 "Three to Seven Components, Equal Variances";
proc fmm data=galaxies criterion=AIC gconv=0;
model v = / kmin=3 kmax=7 equate=scale;
run;
1
title2 "Three to Seven Components, Equal Variances";
2
PROC FMMDATA=galaxies criterion=AIC gconv=0;
3
model v = / kmin=3 kmax=7 equate=scale;
4
RUN;
4 Code Block
PROC FMM
Explanation : This block fits a finite mixture model with a fixed number of 5 components (K=5) and equal variances ('equate=scale'). Additionally, a RESTRICT statement is used to fix the variance ('scale') value at 0.9025.
Copied!
title2 "Five Components, Equal Variances = 0.9025";
proc fmm data=galaxies;
model v = / K=5 equate=scale;
restrict int 0 (scale 1) = 0.9025;
run;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.