BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DaLack
Calcite | Level 5

I want to get the predicted components using proc fmm in the Iris data set. I used the SAS syntax given in the following post:

http://blogs.sas.com/content/iml/2011/10/21/the-power-of-finite-mixture-models.html#comment-214390

Therefore, my SAS code is:

data iris;
set sashelp.iris;
if ranuni(1)<0.5 then Species=" ";
run;

proc fmm data=iris partial=Species;
class Species;
model PetalWidth = / K=3 parms(3 1, 13 1, 23 1);
output out=iris_pc posterior(max) class=component;
run;


But irrespective of the species group, all the observations were assigned to the same group indicated by the new variable "predicted component".  And I didn't get any error messages in my log file. My SAS version is 9.3.

Where is the mistake?

Thanks for your help.



1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

 When I run your code in SAS 9.4m3, it seems to work as expected.  There is a variable named COMPONENT in the output data set that has values 1, 2, or 3.  The FMM procedure predicts 50 plants in component 1 (Setosa), 46 in component 2 (Versicolor), and 54 in component 3 (Virginica).

 

proc freq data=iris_pc;
tables component Species*component / missing;
run;

 

I don't have SAS 9.3 installed, but from the blog post was written in Oct 2011, which is about three months after SAS 9.3 was launched. The article makes it sound like the author got similar results to what I am seeing in 9.4.

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

 When I run your code in SAS 9.4m3, it seems to work as expected.  There is a variable named COMPONENT in the output data set that has values 1, 2, or 3.  The FMM procedure predicts 50 plants in component 1 (Setosa), 46 in component 2 (Versicolor), and 54 in component 3 (Virginica).

 

proc freq data=iris_pc;
tables component Species*component / missing;
run;

 

I don't have SAS 9.3 installed, but from the blog post was written in Oct 2011, which is about three months after SAS 9.3 was launched. The article makes it sound like the author got similar results to what I am seeing in 9.4.

DaLack
Calcite | Level 5

Okay, thanks. I think the problem is my SAS program. I have run your proc freq and the variable named component has only one value.

I will try it with another version.

ChrisHemedinger
Community Manager

I don't know that this has anything to do with it, but the IRIS data set has some history (and deviations, then corrections) over the years.

 

Read: The unlikely pedigree of sample data in SAS

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1579 views
  • 2 likes
  • 3 in conversation