linguistic:translation, stylistic:style_transfer
Empirical local density

In practice, the functions f {\displaystyle f} and F {\displaystyle F} above are often not known or assumed. However, they can be estimated from an observed frequency distribution. In this section, we give an example. Consider the following table, representing a sample of 3,800 (discrete-valued) observations:

Because the observations are discrete-valued, constructing the exact distribution of the median is not an immediate translation of the above expression for Pr (med = v) {\displaystyle \Pr(\operatorname {med} =v)}; one may (and typically does) have multiple instances of the median in one's sample. So we must sum over all these possibilities:

Here, i is the number of points strictly less than the median and k the number strictly greater.

Using these preliminaries, it is possible to investigate the effect of sample size on the standard errors of the mean and median. The observed mean is 3.16, the observed raw median is 3 and the observed interpolated median is 3.174. The following table gives some comparison statistics.

The expected value of the median falls slightly as sample size increases while, as would be expected, the standard errors of both the median and the mean are proportionate to the inverse square root of the sample size. The asymptotic approximation errs on the side of caution by overestimating the standard error.