What are some approaches or procs for finding the 'probable causes' behind a bimodal distribution.
In this example there are different modes for different category values.
Data gen
%macro makedata(out,seed); data &out; call streaminit(&seed); do partition = 1 to 3; p = byte(rand('integer',65,69)); q = byte(rand('integer',65,69)); array from p q; modes_from = cat(p,' & ',q); do id = 1 to 1000; cat = byte(rand('integer',65,69)); if rand('uniform') < 0.80 then do; cat = from(rand('integer',1,2)); if cat = p then response = round(rand('norm', 15,2),0.01); else if cat = q then response = round(rand('norm', 35,2),0.01); end; else response = round(rand('uniform',4, 46),0.01); output; end; end; drop _: p q; run; %mend; %makedata(have1, 1234)
Plots
proc sgpanel data=have1; panelby partition modes_from / columns=3; histogram response; run;
proc sgpanel data=have1; panelby partition modes_from / columns=3; histogram response / group=cat; run;
Histogram with grouping highlights cat values associated with the peaks
Several ways. If you just want the centers of the clusters, you can use k-means clustering (PROC FASTCLUS). If you want to perform more sophisticated modeling, you can use PROC FMM to model the data as a finite mixture. From the graphs, you would guess that there are k=2 components and the means of the components are somewhere close to response=16 and 36. You can provide that extra information to PROC FMM to help it converge to a solution:
proc fmm data=have1;
by partition;
model response = / k=2
parms(16 4, 36 4); /* provide hints for (mu, sigma^2) based on graphs */;
run;
For more on using PROC FMM to model mixtures, see "Modeling finite mixtures with the FMM Procedure".
However, be aware that the success of this approach depends on the size of your data and how close the centers of the clust.... Larger samples and greater separation mean that PROC FMM has a better chance of discriminating between the latent groups.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.