Announcement

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

  • How to generate p-values for predicted probabilities using a reference category?

    Hello folks,

    I am using the margins family of commands to create predicted probabilities after logit.
    I know how to create difference in predicted probabilities, where I use a reference category for categorical variables. But I do not want difference in PP this time.
    And I know how to create predicted probabilities, and I understand that the default P-values are comparing the obtained predicted probability to a hypothetical probability of zero (hence usually any table is scattered with *** everywhere), but this sort of p-value is insignificant for my work, and most contexts.

    What I need help with is the following: is it possible to calculate predicted probabilities but also obtain p-values for comparisons to a reference category?

    Theoretically the answer should be 'yes' but I can't see any command for this.

    Any help would be much appreciated.

  • #2
    look at
    Code:
    help margins postestimation
    and particularly at the "contrast" and "pwcompare" options; I suggest these based on my interpretation of what you said, but you might just need "test" or "lincom" options

    Comment


    • #3
      I am not sure what you need exactly. Data example will help to understand your problem better. Use
      Code:
      help dataex
      and paste data.

      Have you read about the "test" command
      Code:
      help test
      which is a postestimation command?
      Last edited by Inaamul Haq; 17 Jan 2022, 08:39.

      Comment


      • #4
        Thank you both, much appreciated.
        I think Rich helped me find the correct command. Thank you Rich!

        In response to your question Inaamul, but more importantly for anyone with a similar question searching the forum, a simplified syntax is below:

        ** The following calculates predicted probabilities. But the p-values generated test the deviation from a predicted probability of zero. In most cases this is a pointless p-value to obtain.
        logit ib1.var1 ib1.var2, or
        margins ib1.var1 ib1.var2, atmeans post level(95)

        ** The following gives you difference in predicted probabilities and this uses a reference category obviously.
        You can not simply use these p-values from this syntax for the above results since the scaling change causes minor differences in values, and this particularly affects marginally significant or non-significant coefficients.
        logit ib1.var1 ib1.var2, or
        margins, dydx(*) post level(95)

        ** The solution I will use for now is below. 'pwcompare' creates all possible combinations of comparisons within each categorical variable. The 'eff' option produces the p-values I was looking for along with other things.
        This is still a bit untidy as I was hoping to export a ready table into word using esttab, and the pwcompare command solution requires me to manually enter p-values for desired comparisons into my table of predicted probabilities, but I'll live with this for now.

        logit ib1.var1 ib1.var2, or
        margins ib1.var1 ib1.var2, atmeans post level(95)
        pwcompare ib1.var1 ib1.var2, eff

        Many thanks!

        Comment

        Working...
        X