# What are the statistical methods I can use to find popular or common combinations of categorical variables?

I am doing a study on polydrug use. I have a data sets of 400 drug addicts, who each stated the drugs that they abuse. There are more than 10 drugs and hence there large possible combinations. I have recoded most of the drugs that they consume into binary variables (i.e heroin is 1 if a drug addict abused heroin else 0). I would like to find the popular or common combinations of 2 or 3 drugs. Is there statistical methods that I can use?

There are only 1024 possible combinations of the drugs to be used together (if there were only 10 drugs) assuming each user has used at least 1 drug. You could simply convert your 0/1 variables into string and concatenate them and run frequency analyses on the string to see which combinations turn up most frequently. Taking a toy example, say only 3 drugs, A, B, and C, were in your study. If a participant used drug A and C, then the variable alldrugs could be coded 101. A participant who use only drug B would be coded 010. Run frequencies on these to find the one selected most often. Most software should be able process this in seconds.

• Agreed. There are only 400 addicts so those 1024 can't all occur. – Nick Cox Oct 29 '15 at 14:51
• Yep. This should be a piece of cake. – StatsStudent Oct 29 '15 at 16:45

Latent class modeling would be one, supervised learning approach to finding underlying, "hidden" partitions or groupings of drugs and drug users. LC is a very flexible method with two broad approaches: replications based on repeated measures for a single subject vs replications based on cross-classifying a set of categorical variables. Your data would fit the second type.

LCs flexibility is a function of its ability to absorb "mixtures" of variables with differing scalings (e.g., categorical or continuous). Since the approach finds hidden partitions, segments or clusters in data, it can also be considered a dimension reduction technique.

All LC models have 2 stages: in stage 1, a dependent or target variable is identified and a regression model is built. In stage 2, the residual (a single "latent" vector) from the stage 1 model is analyzed and partitions are created capturing the variability (or heterogeneity) -- the "latent classes" -- in that vector.

Freeware is out there for downloading that would probably work pretty well for you. One of these is an R module called polCA available here:

http://www.jstatsoft.org/article/view/v042i10

If you have about \$1,000 to spend on a commercial product, Latent Gold is available from www.statisticalinnovations.com Having used on Latent Gold for years, I'm a big fan of that product for its analytic power and range of solutions. For instance, polCA is only useful for LC models with categorical information whereas LG works across the board...plus, their developers are always adding new modules. The most recent addition builds LC models using hidden Markov chains. But bear in mind that LG is not an "end-to-end" data platform, i.e., it is not good for heavy data manipulation or lifting.

Otherwise, there are tons of other approaches to analyzing categorical information that are widely supported by statistical software such as R, SPSS, SAS, Python, etc. These include contingency table analysis, log-linear models, finite mixture models, Bayesian tensor regression, and so on. The literature in this area is extensive and began with Bishop, et al., Discrete Multivariate Analysis in 1975, extends through Leo Goodman's RC models based on his work done since the 80s, Agresti's Categorical Data Analysis, books by Stephen Fienberg and includes Thomas Wickens' excellent book Multiway Contingency Tables Analysis for the Social Sciences published in 1989. Bayesian Tensor Regression is the title of a paper by David Dunson at Duke and is kind of the "state-of-the-art" in being a very recent method for modeling massively multiway contingency tables.

• love the list of references! – Chris Jan 12 '18 at 17:08

What comes to your mind intuitively? You want to count the combinations, why not just find all the possible combinations and simply count? I suggest you look into Frequent item set mining.

Wikipedia - Apriori

Here are a few implementations of the same:

Frequency Pattern Mining