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.
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.
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.
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.
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
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.