3
$\begingroup$

So suppose I want to estimate the fraction of the year a user of some demographics is active, and I have n users (effectively, n samples). So I get the fraction of the year each user is active.

It turns out that the distribution is lognormal for non-active user types, but the log-transformed variable is negatively skewed for very active user types (since there is an upper bound).

In this case, the median is better than the mean as a "typical" value, but how do I represent uncertainties of this estimate? If the distribution were symmetric, then $mean \pm stdev$ will be a good way to do it, but in a skewed distribution, should I represent it as $median \pm something$ something (maybe IQR/2? std?)? What's the best way to represent it?

$\endgroup$
9
  • $\begingroup$ Your title asks about distribution of means but your body text asks about uncertainty of the median. Which is it? $\endgroup$ – Glen_b Jun 27 '18 at 5:28
  • $\begingroup$ Ah I got confused there. I also have one quantity (not the fraction of the year) that is the mean daily usage per user, so if I plot the histogram of this, then what I would be getting is the mean/median of the means. Anyway, updating the title. $\endgroup$ – irene Jun 27 '18 at 5:54
  • $\begingroup$ Also edited to include info that the data is lognormal for non-active user types, but highly skewed (still using log-transformed variables) for very active user types. $\endgroup$ – irene Jun 27 '18 at 5:59
  • $\begingroup$ I don't see any basis for asserting that it's lognormal there. It might be an adequate approximation, but with that large a sample size you can tell it won't be lognormal. $\endgroup$ – Glen_b Jun 27 '18 at 8:56
  • $\begingroup$ @Glen_b the figure I showed earlier is in log-transformed variables. If I use the original scale, it's long-tailed. Whether the red curves are lognormal may be debatable, but I think the blue curves are. Both pass the Pearson-d'Agostino and Anderson-Darling tests. $\endgroup$ – irene Jun 27 '18 at 9:05
2
$\begingroup$

In this case, the median is better than the mean as a "typical" value

This is a misleading oversimplification common to many introductory texts. It depends on what you want to find out (/what typical means for your particular needs). It can be perfectly reasonable to be interested in the behaviour of the mean with a skewed distribution, and where the mean isn't quite what you need, it may easily be that the median is less useful still!

As an example, consider how long I wait for the lights at a particular intersection while travelling to work. This waiting time is quite right skew. I am interested in the average wait (for example, in working out my average travel time or how much time I waste at that intersection in a year); on the other hand if I am worried about being late to work, neither the mean nor the median are much direct use; I'm much more interested in the chance that the wait might exceed say 10 minutes (in heavy traffic it does sometimes happen)

how do I represent uncertainties of this estimate?

If you're interested in an interval for the population median for a continuous variate, one can be produced without even assuming a distributional form (a nonparametric/distribution-free estimate), based on sample quantiles (or more precisely, on order statistics).

This calculation is discussed in various places, including other questions on site. Also see Wikipedia or here for example. These small-sample intervals are "exact" in the sense that they have the relevant coverage (from the binomial), but those possible values for the coverage ('confidence level') are discrete (i.e. you can't form an exact 95% interval but for example at n=30, you can choose symmetric intervals that have coverages 99.5%, 98.4%, 95.7% and 90.1%).

This sort of interval is related to sign tests and proportions tests.

As an explicit example, let's say we have n=15 values randomly drawn from a continuously distributed population; one of the available levels is 96.5%, corresponding to the interval from the 4th to the 12th sorted observations. That is to say, under repeated sampling, about 96.5% of intervals from the 4th largest to the 12th largest observation would include the population median.

If you're interested in a standard error of the sample median, there's an asymptotic approximation that relies on knowing the height of the density at the median (in large samples from a continuous distribution the sample median will be asymptotically normal, so this can potentially be used to give large-sample intervals).

$\text{s.e.}(\tilde{x})\approx\frac{1}{2\sqrt{n}\,f(\tilde{\mu})}$

If your sample is also large enough to form a reliable estimate of scale (so that you can in turn get that estimate of the density at the median if you know $f$ up to location and scale) this may be useful.

should I represent it as median±something something (maybe IQR/2? std?)? What's the best way to represent it?

What's "best" for your purposes? What, if anything is known about the distribution?

$\endgroup$
8
  • $\begingroup$ Here's what the plot looks like: drive.google.com/open?id=1xZDzNXD2qdGN8Fdf1B_2SSUcgrmSdYEy What I want to point out is that the red curve is further to the right than the blue curve. For the other quantities I've examined, I've had no problem because all curves were symmetric (so I just used mean $\pm$ std), but here I'm at a loss what's the best way to represent what the graph tells. $\endgroup$ – irene Jun 27 '18 at 6:52
  • $\begingroup$ It seems you have a different problem to the one you asked about (you asked about your attempted solution to the problem rather than the problem you started with). "The red curve is further to the right than the blue curve" looks like an excellent description to me. Symmetry or not, if you give a pair of means and standard deviations it doesn't really convey the extent of what is obvious in the diagram. ...ctd $\endgroup$ – Glen_b Jun 27 '18 at 7:01
  • $\begingroup$ ctd... You can quantify that movement of probability to the right in a number of ways, but conceiving of it as a location shift (whether of means or medians) may not be so useful when it's bounded. It may be that the proportion of red values higher than blue values (out of those higher and lower, considered pairwise) could be more useful for example. If it's only intended as a rough summary of a plot, you may be fine to talk about the change in the mean but ultimately you must tailor your choices to your audience of course. $\endgroup$ – Glen_b Jun 27 '18 at 7:01
  • $\begingroup$ I could describe it that way, but it has to be described in a table together with all the other quantities I've obtained. I have several of these curves, and the degree of difference differs from one plot to another, hence a table of values (instead of several graphs) is preferred. The idea is that the cyan curve is actually composed of two different types of users -- those in the red curve and those in the blue, each characterized by a different "typical value". I was actually debating whether to use median or mode in this case, but median seems better; but the uncertainty, I'm not sure. $\endgroup$ – irene Jun 27 '18 at 7:08
  • 2
    $\begingroup$ You might be best to make a new post relating to what you need to do; other thoughts than mine may be more help to you $\endgroup$ – Glen_b Jun 27 '18 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.