Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • gllamm and interactions

    Hi All,

    I would like to include an interaction term in my -gllamm- model but I just got an error message saying interactions are not allowed:

    xi: gllamm out i.pred##i.time, family(binomial) link(log) i(id)

    My interaction is between 2 categorical variables (coded as 0 and 1) - how can I build it?

    Thank you!

  • #2
    gllamm is from SSC, as you are asked to explain (FAQ Advice #12).

    xi: gllamm out i.pred##i.time, family(binomial) link(log) i(id)
    "##" is factor variable notation and gllamm predates this. You wouldn't be using the -xi- prefix otherwise. Consult the -xi- documentation on how to specify interactions or create the interactions by hand.

    Code:
    help xi

    xi expands terms containing categorical variables into indicator (also called dummy) variable sets by creating new variables and, in the second syntax (xi: any_stata_command), executes the specified command with the expanded terms. The dummy
    variables created are

    i.varname creates dummies for categorical variable varname

    i.varname1*i.varname2 creates dummies for categorical variables varname1 and varname2: all interactions and main effects

    i.varname1*varname3 creates dummies for categorical variable varname1 and continuous variable varname3: all interactions and main effects

    i.varname1|varname3 creates dummies for categorical variable varname1 and continuous variable varname3: all interactions and main effect of varname3, but no main effect of varname1

    Comment


    • #3
      Thanks Andrew Musau - your response is very helpful!

      Comment

      Working...
      X