Announcement

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

  • Marginsplot Says Variable Not in Model? Please Help

    Hi, All:

    I was running a multinominal regression and doing a LR test. Then, I wanted to run a marginsplot, but STATA is saying that numcigs_r is not in my model and it should. Can someone please help me?

    mlogit: Changes in Pr(y) | Number of obs = 420

    Expression: Pr(alcoholconsumer), predict(outcome())

    | low alc~) moderat~) high al~)
    ---------------------------------+---------------------------------
    numcigs r |
    +1 | -0.007 0.004 0.003
    p-value | . . .
    +SD | -0.057 0.034 0.023
    p-value | . . 0.042
    nonwhite |
    non-white vs white | -0.093 0.003 0.090
    p-value | 0.069 0.932 0.024
    sex |
    female vs male | 0.029 -0.016 -0.013
    p-value | 0.391 0.578 0.515
    friends |
    1-2 times vs 0 times | -0.064 0.025 0.039
    p-value | . . 0.073
    3-4 times vs 0 times | -0.174 0.132 0.042
    p-value | . . 0.024
    5 or more times vs 0 times | -0.174 0.128 0.046
    p-value | . . 0.001
    3-4 times vs 1-2 times | -0.110 0.107 0.003
    p-value | . . 0.918
    5 or more times vs 1-2 times | -0.110 0.103 0.007
    p-value | . . 0.790
    5 or more times vs 3-4 times | -0.000 -0.004 0.004
    p-value | . . 0.866
    religion |
    Abrahamic vs I don't have a r~i | -0.001 0.019 -0.018
    p-value | 0.981 0.643 0.560
    non-Abrahamic vs I don't have~ | 0.096 -0.035 -0.061
    p-value | 0.168 0.584 0.037
    non-Abrahamic vs Abrahamic | 0.097 -0.055 -0.043
    p-value | 0.082 0.320 0.000
    unfriendly |
    someone was unfriendly to me ~ | -0.026 -0.023 0.049
    p-value | . 0.433 0.026
    hrstv r |
    +1 | -0.001 0.001 -0.000
    p-value | . . 0.896
    +SD | -0.008 0.009 -0.001
    p-value | 0.640 . .
    exercise |
    1-2 times vs none | -0.041 0.054 -0.013
    p-value | . 0.225 0.668
    3-4 times vs none | 0.006 0.005 -0.011
    p-value | . 0.895 0.724
    5 or more times vs none | 0.031 -0.007 -0.025
    p-value | . 0.870 0.397
    3-4 times vs 1-2 times | 0.047 -0.049 0.002
    p-value | . 0.259 0.954
    5 or more times vs 1-2 times | 0.073 -0.061 -0.012
    p-value | . 0.149 0.616
    5 or more times vs 3-4 times | 0.026 -0.012 -0.014
    p-value | . 0.753 0.611

    Average predictions

    | low alc~) moderat~) high al~)
    -------------+---------------------------------
    Pr(y|base) | 0.852 0.105 0.043


    . mchangeplot, amount(sd) min(-.2) max(.4) gap(.1) mcol(rainbow) ///
    > title(Average discrete change, position(11)) leftmargin(4) sig(.05) ///
    > note("Level of Alcohol Consumption:`0= Low Alcohol Consumer 1= Moderate Al
    > cohol Consumer 2= High Alcohol Consumer")
    numcigs_r is not in model

    .
    end of do-file

  • #2
    To assure the results that you post are readable, please copy them from the Results window or your log file into a code block in the Forum editor, as explained in section 12 of the Statalist FAQ linked to at the top of the page. And when you post command output, post the command as well.

    For example, the following:

    [CODE]
    . sysuse auto, clear
    (1978 Automobile Data)

    . describe make price

    storage display value
    variable name type format label variable label
    -----------------------------------------------------------------
    make str18 %-18s Make and Model
    price int %8.0gc Price
    [/CODE]

    will be presented in the post as the following:
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . describe make price
    
                  storage   display    value
    variable name   type    format     label      variable label
    -----------------------------------------------------------------
    make            str18   %-18s                 Make and Model
    price           int     %8.0gc                Price

    Comment


    • #3
      William gives excellent advice as always. In addition, the title says marginsplot, but you are trying to use mchangeplot after mlogit. That is a quite different community-contributed command, as you are asked to explain. A search goves location

      spost13_ado from http://www.indiana.edu/~jslsoc/stata
      ,
      The spost* suites by Scott Long and Jeremy Freese are quite popular, so someone may have an answer. But you'd raise your chances by

      1. minimally showing the mlogit command you used for multinomial [NB not multinominal] logit

      2. even better, giving a reproducible example.

      Scott gave a direct email address for support in https://www.statalist.org/forums/for...3-for-stata-15 but I think he would certainly want a reproducible example too.
      Last edited by Nick Cox; 13 Aug 2018, 02:34.

      Comment


      • #4
        I realize now that at a minimum, you appear to have run two mlogit commands, a lrtest command comparing the results, an mchange command (from spost13) for which you report the results almost unreadably, and then your mchangeplot command (also from spost13) which fails. This is substantially different than what you describe in post #1.

        In the output of mchange, we see numerous places where p-values are reported as missing. This does not seem appropriate and suggests a problem you have overlooked with mchange. When that output is fed into mchangeplot I expect mchangeplot has problems caused by the missing values.

        At a minimum, you should rerun a much simpler flow: the mlogit command you are interested in plotting, followed immediately by the mchange command, followed by the mchangeplot command. Perhaps the second mlogit and the lrtest affected the returned estimation results in e() that would be used by mchange.

        And again, in the future please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. Note especially sections 9-12 on how to best pose your question.

        Section 12.1 is particularly pertinent

        12.1 What to say about your commands and your problem

        Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
        The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

        Comment

        Working...
        X