The script begins by creating a 'galaxies' dataset containing the velocities of several galaxies. Then, it applies the HPFMM procedure in three steps: 1) Search for the optimal number of components (from 3 to 7) with unequal variances, based on the AIC criterion. 2) Same search but forcing equal variances between components. 3) Adjustment of a final 5-component model with a constraint on the common variance value.
Data Analysis
Type : CREATION_INTERNE
The data is created directly in the script via a DATA step and a DATALINES statement. The 'velocity' variable is read and transformed into a new variable 'v' for analysis.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block reads the galaxy velocity data provided via 'datalines'. The '@@' operator (double trailing at) allows reading multiple observations on the same data line. A new variable 'v' is calculated by dividing 'velocity' by 1000 for scaling.
Explanation : First analysis with HPFMM to determine the optimal number of components (between 3 and 7, kmin and kmax options) based on the Akaike Information Criterion (AIC). By default, the variances of the normal components are estimated separately (unequal). ODS graphics are enabled and some output tables (iteration history, optimization information) are hidden.
Copied!
title2 "Three to Seven Components, Unequal Variances";
ods graphics on;
proc hpfmm data=galaxies criterion=AIC;
model v = / kmin=3 kmax=7;
ods exclude IterHistory OptInfo ComponentInfo;
run;
1
title2 "Three to Seven Components, Unequal Variances";
2
ods graphics on;
3
PROC HPFMMDATA=galaxies criterion=AIC;
4
model v = / kmin=3 kmax=7;
5
ods exclude IterHistory OptInfo ComponentInfo;
6
RUN;
3 Code Block
PROC HPFMM
Explanation : Second analysis with HPFMM, similar to the first, but with the constraint that component variances are equal (EQUATE=SCALE option). The gradient convergence criterion is disabled (gconv=0).
Copied!
title2 "Three to Seven Components, Equal Variances";
proc hpfmm 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 HPFMMDATA=galaxies criterion=AIC gconv=0;
3
model v = / kmin=3 kmax=7 equate=scale;
4
RUN;
4 Code Block
PROC HPFMM
Explanation : Third and final analysis fitting a specific 5-component model (K=5), with equal variances (EQUATE=SCALE). The RESTRICT statement adds a constraint to fix the value of this common variance to 0.9025. Finally, ODS graphics are turned off.
Copied!
title2 "Five Components, Equal Variances = 0.9025";
proc hpfmm data=galaxies;
model v = / K=5 equate=scale;
restrict int 0 (scale 1) = 0.9025;
run;
ods graphics off;
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.