Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inverse function of an unknown cumulative function

I'm working with a data file, the observations inside are random values. In this case I don't know the distribution of x (my observations). I'm using the function density in order to estimate the density, because I must apply a kernel estimation.

T=density(datafile[,1],bw=sj,kernel="epanechnikov")

After this I must integrate this because I'm looking for a quantile (similar to VaR, 95%). For this I have 2 options:

ecdf()
quantile()

Now I have the value of the quantile 95, but this is the data estimated by kernel.

Is there a function which I can use to know the value of the quantile 95 of the original data?

I remark that this is a distribution unknown, for this I would like to imagine a non parametric method as Newton, like the one that is in SAS solve()

like image 422
Michelle Avatar asked Jan 21 '13 20:01

Michelle


People also ask

How do you find the inverse of a cumulative distribution function?

The exponential distribution has probability density f(x) = e–x, x ≥ 0, and therefore the cumulative distribution is the integral of the density: F(x) = 1 – e–x. This function can be explicitly inverted by solving for x in the equation F(x) = u. The inverse CDF is x = –log(1–u).

What is inverse CDF used for?

The inverse cumulative distribution function gives the value associated with a specific cumulative probability. Use the inverse CDF to determine the value of the variable associated with a specific probability.

Is the CDF always invertible?

Inverse transform sampling - CDF is not invertible.

What is inverse cumulative probability?

An inverse cumulative probability function returns the value x at which the probability of the true outcome being less than or equal to x is «p». They are said to compute the fractile, percentile, quantile, etc. They perform this computation analytically, so that there is no Monte Carlo sampling error in the result.


1 Answers

You can use quantile() for this. Here is an example using random data:

> data<-runif(1000)

> q<-quantile(data, .95)
> q
      95% 
0.9450324 

Here, the data is uniformly distributed between 0 and 1, so the 95th percentile is close to 0.95.

To perform the inverse transformation:

> ecdf(data)(q)
[1] 0.95
like image 107
NPE Avatar answered Nov 04 '22 08:11

NPE