0
$\begingroup$

there are 13 variables which have been regressed using the logit. All the variables are categorical variables. Now my aim is to see the interaction between two variables. When I run my logit, it runs out of degrees of freedom and hence the STATA does not deliver any reslut.

Example

Q= i.A i.S i.Ec i.Pr i.xx i.dd#i.ii

Can I treat my 11 variables as continuous and add the interaction term. If yes, how do I support my doing

Example Q = A S Ec Pr xx i.dd#i.ii

$\endgroup$
10
  • 1
    $\begingroup$ "Q= i.A i.S i.Ec i.Pr i.xx i.dd#i.ii" -- what is this? Did a cat walk on the keyboard? Is it a sequence of keystrokes for something? I don't understand. $\endgroup$
    – Glen_b
    Commented Aug 24, 2014 at 2:14
  • $\begingroup$ Sorry this is the stata command i.e Q being the dependent variable and A S EC Pr XX dd ii the independent. i.dd#i.ii is the interaction variables. # menas interaction in stata @Glen_b $\endgroup$
    – user40767
    Commented Aug 24, 2014 at 2:17
  • 1
    $\begingroup$ Your question is probably better phrased initially as a general one about models, using a more typical notation to represent them, and then at the end making some reference to doing it in Stata. You should probably clarify how many levels you have in each variable, how many observations you have and which of your variables are at least ordinal. [Or is it more a pure "what Stata commands do I use?" kind of question?] $\endgroup$
    – Glen_b
    Commented Aug 24, 2014 at 2:22
  • $\begingroup$ That was just a way to show an example, hence looks bit unclear. My issue is :- When I run my logit regression, do I treat my categorical variables as continuous as when I try to do logit using all the categorical variables and the interaction term, STATA does not deliver a result. It starts the iteration process. Therefore, should I treat my other 11 variables as continuous variables and then do the interactions. I have around min 4 levels for each variable and all of them are categorical. @Glen_b $\endgroup$
    – user40767
    Commented Aug 24, 2014 at 2:29
  • $\begingroup$ Unless I misunderstand things here (which is possible), you just can't estimate that many parameters with your data. And no, it really isn't right to treat those categorical variables as continuous. My suggestion is to add each two-way interaction individually to the model. Maybe (if you're lucky) you'll pick up just a couple that make a difference. This is a bit like forward model selection in regression. $\endgroup$
    – Russ Lenth
    Commented Aug 24, 2014 at 2:43

1 Answer 1

2
$\begingroup$

I don't use Stata, so I'm not quite sure what's going on here, but I think it's getting ugly fast. Assuming you have 13 categorical variables with 4 levels each, the basic logistic has to fit an intercept and 3*13 parameters (since each category becomes 3 dummy variables). An interaction term involving 2 categories requires 9 degrees of freedom, and you have 78 possible pairs, for 702 degrees of freedom. If Stata is trying to calculate interactions for everything, I can see why you are running out of degrees of freedom. So you don't want to go there.

If the categories are ordinal and in some sense equally spaced, you could replace them with continuous variables ... holding you nose. Perhaps a better approach would be a decision tree model, which would deal more gracefully with relationships between the categories.

$\endgroup$
1
  • $\begingroup$ I agree, and wonder if @user40767's expression for Q generates a 13-way interaction, or just the 2-ways. If the latter, I'd think Stata could handle it, given the abundance of memory and speed in today's PCs. $\endgroup$
    – Russ Lenth
    Commented Aug 24, 2014 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.