Announcement

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

  • why estat classification is not allowed after a logistic regression?

    Does any one know why the estat clasification is not alowed when iweight is used in a logistic regression.

    I have performed estat clas for my logistic regression and the result was:

    iweight not allowed

  • #2
    Just curious, why are you using iweights in the first place? It is unusual to do so (which may be related to why estat class refuses to work with them).
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Add on to Richard, I know that the logistic commands involving the classification table and the ROC curve support frequency weights, which have to be integers.

      If you are using a complex survey, it probably has pweights, which are the inverse of the probability that the observation had of being sampled. You can, I guess, round those off to the nearest integer, which should be accurate enough in most cases. Generally, you'd see pweights like 3000.23 or something similar.

      But, like he said, it's worth considering what your objective is.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        why estat class not valid?
        Attached Files

        Comment


        • #5
          This is not an ordinary logistic regression, it's a random-effects logistic regression. So the constructs that -estat class- calculates don't have a clear definition. Are the random effects to be taken into account in the calculation of the predicted outcome probability, or only the fixed part of the model?

          If you use only the fixed part, you are ignoring potentially miportant information from the random effects (although with the output you show, it seems like the random effects aren't actually doing any work in this model, and, in fact, if I were in your shoes, I would go back and re-do the model ignoring them and using just plain -logit-, which would also solve your problem with -estat class-.

          If you want to include the random effect, you buy yourself a couple of problems. First, the random effects are estimated somewhat crudely as means from a complicated posterior distribution that is integrated numerically. Second, there is no real way to generalize the random effects outside the estimation sample given a new observation, so any calculations of sensitivity, specificity, or positive and negative predictive value would have no applicability beyond your actual sample.

          If you want, you can work around this. Suppose you are interested in using only the fixed part of the model. Then you can -predict- xb, and take the inverse logit function value to get a predicted probability. Then you can just do some calculations with summarize. For example:

          Code:
          predict phat, xb
          replace phat = invlogit(phat)
          
          local cutoff = 0.5 // FOR ILLUSTRATION ONLY; PICK A REALISTIC CUTOFF
          gen byte prediction = (phat >= `cutoff') if e(sample)
          tab Banking prediction, row col
          You can do the same thing if you do want to include the random effect. In fact, it's even simpler because you can get phat in a single line with just -predict phat, mu-

          You interpret these at your own risk, however, for the reasons noted above.

          But, again, your random effects are negligible in this particular model and data, so just go back and do it with -logit- followed by -estat class-. You won't be that lucky very often. But enjoy the luck while you have it.

          Comment

          Working...
          X