Programming the statistical procedures from SAS

How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

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.




Accepted Solutions
Solution
‎05-17-2016 12:13 PM
SAS Super FREQ
Posts: 3,317

Re: How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

 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


All Replies
Solution
‎05-17-2016 12:13 PM
SAS Super FREQ
Posts: 3,317

Re: How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

 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.

Contributor
Posts: 29

Re: How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

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.

Community Manager
Posts: 2,642

Re: How can I get the predicted components in the Iris data set using proc fmm in SAS 9.3?

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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