# How to estimate the margins distribution using ecdf?

Suppose we have a random variables x.

x <- rnorm(500, 2,3)

Suppose that we do not know the marginal distribution of (x) (I know it is normal).

Then, I would like to estimate the marginal using empirical cumulative distribution function (ecdf).

Then, I can do that easily in R, i.e.,

xecdf <- ecdf(x)

Then, I can plot it as follows:

plot(xecdf).

Now I plot it and everything is great. So, I have estimated the margins non-parametrically.

My question is, how can I know what is the estimated distribution from the result of xecdf? That is, in our example, the margin is normal. I suppose it is unknown just for my question.

Now, how I can derive from the result of ecdf that the margin is normal? How to prove from the result of the ecdf that the margins is normal.

In other words,

I understand the ecdf. however, how I know from ecdf that my margin is normal. That is, when we estimate the margins, we would like to know that is the type of margins. Are they normal or any other distribution? One way to estimate the margins is to use ecdf. So, how can I know the type of margins form ecdf.

• You can’t “derive” functional form of the underlying distribution from empirical distribution. Empirical distribution approximates it, that’s all. Could you be more precise what do you mean? – Tim Jan 13 '18 at 12:18
• @Tim. Thanks for your comment. I understand the ecdf. however, how I know from ecdf that my margin is normal. That is, when we estimate the margins, we would like to know that is the margins. Are they normal or any other distribution. One way is to use ecdf. So, how can I know the type of margins form ecdf. – Silver_80 Jan 13 '18 at 12:20
• @Tim, Thanks again. So, from your comment, we cannot know the type of the margins distribution if we use the ecdf. So, why we use ecdf to estimate them? That is, it does not help use to understand the type of margins. – Silver_80 Jan 13 '18 at 12:23

## 1 Answer

You can’t "derive" functional form of the underlying distribution from the empirical distribution. Empirical distribution approximates it, that’s all. We use empirical cumulative distribution function to estimate the underlying distribution, not to find the functional form of the underlying theoretical distribution.

When building statistical models we assume probability distributions for out data, this does not mean that we "know" that our data follows such distributions, we just assume that it approximately follows them.

What you can do is you can test if your distribution differs from some theoretical distribution (but beware that such tests are misleading). One of the most popular tests for such comparisons is the Kolmogorov–Smirnov test.

• Thanks a lot for you answer. So, as I understand, we just estimate them non-parametrically and then we compare them to different (most common used) known distribution and from that we can say it is (almost) follow normal distribution. Is that correct? – Silver_80 Jan 13 '18 at 12:40
• @Silver_80 in most of the real-life cases you make such decisions based on understanding your data and choosing a model that best serves your purpose rather then comparing the empirical distribution to any possible functional distribution. In many cases we assume normality for convenience, not because normal distribution best resembles the empirical distribution. – Tim Jan 13 '18 at 12:44