Inverse function of unknown cumulative function

I work with a data file, observations inside are random values. In this case, I do not know the distribution of x (my observations). I use density functions to estimate density, because I have to apply kernel estimation.

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

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

 ecdf() quantile() 

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

Is there a function that I can use to determine the quantile value of 95 source data?

I notice that this is an unknown distribution, for this I would like to introduce a nonparametric method, like Newton, like the one that is in SAS solve()

+4
source share
1 answer

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

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

Here, the data is evenly 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 
+5
source

All Articles