# If parametric quantile esimation estimates $p$ by computing the MLE, then how to get non-parametric $p$? [closed]

For non-parametric or parametric quantile estimation.

If parametric quantile esimation estimates $p$ by computing the MLE, then how to get non-parametric $p$?

Related:

https://mathoverflow.net/questions/48223/parametric-vs-non-parametric-estimation-of-quantiles

But I don't understand how to do non-parametric quantile estimation, nor how is $p$ estimated in that case. Does one still have to use the inverse CDF?

## closed as unclear what you're asking by Raskolnikov, kimchi lover, José Carlos Santos, Maria Mazur, user223391 Nov 9 '17 at 16:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Suppose you have a sample of size $n = 1000$ from an unknown normal distribution. We want to estimate the 65th percentile of the unknown distribution. I just happen to have one in my computer now, in a vector $\mathbf{x}.$

As you say, there are two possible approaches. One is to take the 65th percentile of the sample. The result is 105.45, which I get using R statistical software.

quantile(x, .65)
##      65%
## 105.4531


The second approach is to estimate the mean $\mu$ and standard deviation $\sigma$ of the normal population, by using the sample mean and sample standard deviation. I get $\hat \mu = \bar X = 100.40$ and $\hat \sigma = S = 14.74.$

mean(x);  sd(x)
## 100.4008
## 14.74482


But the 65th percentile of $\mathsf{Norm}(100.50, 14.745)$ is 105.98.

qnorm(.65, 100.40, 14.475)
## 105.9775


The question now arises: which is closer to the right answer? The first (nonparametric) estimate 105.45 or the second (parametric) estimate 105.98. In a real life situation we would never know for sure, but might expect the parametric estimate based on MLEs $\hat \mu$ and $\hat \sigma$ would be better.

But in this case, we can know for sure because I simulated my sample of 1000 from $\mathsf{Norm}(100, 15),$ which has 65th percentile 105.78. So the parametric estimate is a little closer.

 qnorm(.65, 100, 15)
## 105.7798


The data were simulated by the following R code. Because I set a seed, you can replicate the experiment precisely in R.

set.seed(2017); x = round(rnorm(1000, 100, 15), 3)


Addendum per question in Comment: Here is a brief demo of quantile in the current context.

quantile(x, .65)
##      65%
## 105.4531
sx = sort(x);  sx[650];  sx[651]
## 105.423
## 105.509


Note: The superiority of the parametric estimator in the example above is not a one-time accidental result. In a simulation of 100,000 samples of size $n=200,$ the mean of the parametric estimators was 105.77 with a mean squared error of 1.22; the mean of the nonparametric estimators was 105.74 with a MSE of 1.85.

• What does R's quantile do/not do? – mavavilj Nov 7 '17 at 6:58
• For quantile .65, roughly speaking, it sorts the data then picks a number $q$ with not more than 65% of the observations below $q$ and not more than 35% above. Various programs use various methods to deal with ties and with gaps between observations. For details see the help screen in R at ? quantile. See Addendum to my Answer for current context. – BruceET Nov 7 '17 at 7:24

They are just looking at the sample quantiles. If you think about "observations" instead of being a collection of values, instead think of them as a discrete approximation to the true distribution. That is, if you have a set of observations $\{x_n\}_{n=1}^N$, you can construct the empirical cdf as a mixture of point masses centered at these locations:

$$\hat{P}[X] = \sum_{n=1}^N \frac 1 N \delta_{x_n}$$

For small $N$ this isn't very effective, and so it's helpful to incorporate some parametric assumptions (like they do in that link), but if you have tons of data $\hat{P}$ can characterize the true distribution very well; it's analogous to Bayesians using Monte Carlo to characterize their posterior instead of explicitly getting an expression for it.

It turns out that the empirical CDF has a bunch of useful properties, like, for example, consistency in moments, consistency in quantiles, etc. If you want to get an approximation to $P[a \leq X \leq b]$, then $\hat{P}[a \leq X \leq b]$ is a very good estimate with large sample sizes.

To specifically estimate quantiles, you just look for points in your support where the proportion of observations on one side or the other matches your goal. For example, say you have 1000 observations and you want to estimate the .25 quantile. Then you would find the first point in your support such that 25% of the sampled values are below that point.