Announcement

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

  • How to resolve xtlogit issue with interaction?

    Hi I am new to Stata and the Forum and I also encounter issue with xtlogit. Appreciate any help: I ran the xtlogit on panel data with interaction. Then I tried to run margins and marginsplot command. I got error message saying that, "invalid at() dimension information; using variable IMEA (moderating variable) as a factor variable and a regular variable is not supported". Thanks a lot for help.

  • #2
    You have provided so little information about what you have done in your question, that any attempt to answer it can at best be a wild guess. Whenever you want help troubleshooting code you are running or trying to run, you should always provide the exact code itself, along with an explanation of the different variables in it if it is not obvious from their names, and it is almost always necessary to also show example data. So please read the Forum FAQ for detailed advice on the best ways to ask questions effectively and maximize your chances of getting a timely and helpful response.

    That said, you did quote the exact error message you got, and it's a fairly specific one. So here's my guess as to what has gone wrong. You have a variable named IMEA and you have tried to run an -xtlogit- command that contains both IMEA and IMEA#something_else in it. The problem with that is that Stata's factor variable notation (read -help fvvarlist- for more information) interprets any unprefixed variable as a continuous ("regular") variable by default, except, that unprefixed variables in interaction terms are considered discrete ("factor") variables by default. So your command is self-contradictory. IMEA in isolation is continuous; IMEA#something_else implies that IMEA is discrete.

    The solution is to figure out which it is and then consistently prefix it with i. or c. wherever it occurs. So either i.IMEA i.IMEA#something_else, or c.IMEA c.IMEA#something_else. Better still, to avoid problems like this, make it a habit to always prefix all explanatory variables in estimation commands with i. or c., and, to avoid inconsistencies, use the ## rather than the # interaction operator in estimation commands.

    Comment


    • #3
      Thanks a lot, Clyde for your advice. It's helpful. I am trying to have better understanding of various syntax especially language syntax from manuals and other help sources.

      Comment

      Working...
      X