# How to analyze large categorical, concurrent variables?

I want to call this "factor" analysis but I don't think that's it.

Say you have a car. It can undergo distinct "treatments" A-Z and you measure "shiny-ness" -- shiny(x). The car can receive 1 treatment or 2 or 3.

So you have a list of data like this.

Treatment -- Result
A            2
B            4
A            3
B            3
D            4
A,B          2
A,D          3
Z,A,B        3


So you see most data (50%) are single factors. Other underwent a combination.

So if you want to see which 'treatments' -- work best ... well you can obviously JUST look at single factor data to see which perform better. But then you're throwing out 50% of the data.

Is there any mathematical way to analyze the 'combinations' in tandem with the single factors? Again, categorical data.

You can look at s.

The idea is that applying treatment A may have an effect, and so may applying B - but applying both treatments may have a different effect than just the sum of the two separate treatments. Interactions can happily model this "interaction effect" to be either positive or negative, so the effect from both treatments can be either more or less than the sum of the separate effects.

Interactions should be covered in any introductory statistical modeling textbook.

There's more than one way, in fact, and the one you want depends on your purpose and theory. Do you want to treat these combinations as if they're entirely separate treatments all their own, as additive combinations of the separate effects of the treatments that make them up, or, thirdly, as both: as additive combinations but with additional effects that are more than the sum of their parts? As Stephan points out, this is a question of interaction effects - those effects, specifically, would be the "more than the sum of their parts" part of their effects, which a model could separate out for you, and test for the presence of.

The most flexible and comprehensive functional form would be to define separate binary variables marking the presence or absence of each treatment letter, and then, additional and separate variables that are the products of those variables, according to the observed combinations. So you'd have one that's A*B and another that's A*D and another that's Z*A*B. You'd treat them all as separate predictors, and the results would give you a comprehensive picture of all these different effects. But if you're comfortable assuming that no such interactions exist, and treating combinations of treatments as if they're just a different treatment of their own, then you can just treat some or all of the combinations as different levels of the single factor variable.

Note though that you have an unordered categorical variable as your predictor, and so it needs to get broken up into binary dummy variables no matter what you do. And effects will be relative to some base category that you should pick for ease of interpretation.

• Fair enough but say there are 100 treatments. Would that mean using a regression equation with 100 categorical variables? At that point, it would seem a bit crazy. Especially since realistically 1-3 are applied. – user45867 Jul 19 '18 at 19:49
• @user45867 You ignore everything you have no observations of, including unobserved combinations, but yes, if you want/need to estimate all these different effects, then that's how complicated the model needs to be. That's a big if, though, since I don't know your purpose and assumptions. If you're not worried about omitted variable bias and just want to know a couple effects, then you can omit everything you don't care about, and otherwise use a simpler model. If you're asking if it's crazy to just treat Z,A,B as if it's just some other letter, then no, it's not crazy, just simplified. – DHW Jul 19 '18 at 19:55
• Hmm. Doesn't seem intuitive but perhaps. Actually the variables aren't even independent of each other which makes it a bigger mess. Some variables "tend to occur" with others 90% of the time, etc. I need something down-and-dirty like A is generally a 90% clean, C is always 90% but in reality it's meaningless (+0%) and always occurs with A generally ..., Z is always 50% clean but moves closer to 80% when with A ... you know, decipher which tend upwards and which downwards. I know I'm probably not explaining enough. Still not certain if a regression would solve this, I've noticed a lot of wonky – user45867 Jul 20 '18 at 15:51
• There's certainly no better tool than regression (or some fancy model still based on regression) for questions that are anything like the ones you're asking. It sounds, though, like you need to figure out how to specify the model that fits your theory and purpose, i.e. the questions you have answers to and the questions you need answers to. As for independence, yes, those are the kinds of correlations between the predictors that make it necessary to estimate some effects that you don't really care about, but which need to get statistically separated out from the effect(s) you do care about. – DHW Jul 21 '18 at 15:05