Announcement

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

  • Problem with margins command after svy:mlogit

    Receiving error message: "factor ['variablename'] not found in list of covariates." Can anyone explain problem or suggest solution?

  • #2
    you don't show us your code but the error message implies that the variable you name after the word "margins" in your command line is neither a factor variable nor an interaction - and those two are what -margins- deals with; if you want more specific help you need to post, within CODE blocks (see the FAQ if you don't know what this means), the command line that preceded the -margins- command as well as the -margins- command; please give us, as the FAQ advises, exactly, what you typed

    Comment


    • #3
      Thanks for responding. Here are the details: I tried two estimation commands, xi: svy:mlogit and svy:mlogit. In both cases the DV represents three levels of safe storage among gun-owning households. All the IVs are categorical; some are binary, e.g. sex, marital status (married/unmarried), veteran (yes/no), and children in home (yes/no; other are multi-level, e.g. education and income levels, age group and race/ethnic group. These were all entered preceded by i. The results were as previously estimated, and I got clear results from another post-estimation command, mlogitgof, table. Here's how I wrote the margins command: margins sex, predict(outcome(1)). Regardless of which variable I specified or how I specified it, the error message was the same: "factor 'sex' not found in list of covariates." Even when I recoded these factors as dummy variables and replaced the originals in the model, the same error message (322) appeared. The Stata Reference Manual says I should be able to use margins with mlogit and survey data, but clearly I am doing something wrong. Thanks again for responding. I hope this additional info will help you suggest what I should do.

      Comment


      • #4
        the only additional suggestion I have at this time is to NOT use the "xi" prefix; see:
        Code:
        help fvvarlist
        and please read the FAQ and follow its suggestions (since you ignored mine)

        Comment


        • #5
          Thanks, again. I will observe protocol in the future. I tried omitting the xi prefix. That made no difference.

          Comment


          • #6
            [svy/mlogit[/margins] Changing syntax for interaction variables to # in fvvarlist from * in xi: documentation worked for all but one binary variable (veteran), which produced return code 322, an "unexpected result" from the estimation command. I'm using Stata 13 (with current updates) on data from BRFSS 2004. Thanks again. I hope I'm now posting correctly.

            Comment

            Working...
            X