Announcement

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

  • Question: How to Winsorize using Standard Deviations instead of percentiles?

    Greetings,

    Is there a way of Winsorizing past a certain threshold of standard deviations instead of percentiles?

    In particular I would like to Winsorize + / - 3 sd.

    The dataset I'm working with is constantly being updated so such a code (if it exists) would be most helpful.

    I have installed winsor and winsors2. I have read the help documentation for each of them but to no avail.

    Thanks for your help.

  • #2
    You just need to do it yourself.

    Code:
    su y 
    scalar low = r(mean) - 3 * r(sd) 
    scalar high = r(mean) + 3 * r(sd) 
    gen y2 = cond(y < low, low, cond(y > high & y < ., high, y))
    That seems an especially poor to winsorize, however. (It's not even winsorizing, but a disreputable relation.) Any outliers pull out the mean and SD any way.

    Comment


    • #3
      Thank you, Nick. That answers my question.

      Comment

      Working...
      X