Announcement

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

  • Incorrect median given upon collapse command

    I have collapsed the median household income (income_hh_USD) per month of interview, however the median per month is not correct. For several months I get a median of 0, which cannot be correct: When I look at the individual data points for set months there are no negative values in the income data, but several positive incomes. This problem does not occur when using the mean, but because the data is skewed I need to use the median. Why I am I given the wrong median and how can I fix the issue?

    Code:
    collapse (p50) income_hh_USD (count) number_obervations, by(intv_date_monthly)

    (Using stata 17 and updated today to make sure the software isn't the problem)

  • #2
    Anja:
    welcome to this forum.
    As per FAQ, please share an example/excerpt of your dataset, so that interested listers can take a look at the problem, if any.
    Please also note that "correctness" is often the nickname of "expected results given our codes".
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Anja Wi View Post
      . . . I get a median of 0, which cannot be correct: When I look at the individual data points . . . there are no negative values in the income data, but several positive incomes.
      So, what's the median of 0, 0, 0, 0, 0, 1, 2, 3?

      As Carlo mentions, you'll probably want to list income data for a month or two where your unexpected result is happening.

      Comment


      • #4
        if you have zeros, then the geometric mean is ruled out too.

        If the median is not much use, as it will be zero if zero is a majority value, then something like the midmean could be an alternative. That is a 25% trimmed mean.

        Comment

        Working...
        X