2

I'm working with kernel estimation, I apply the density function from R to my data file (bivariate), after a couple of statistical treatments I need to transform this data and here comes my problem:

Is there a function of the inverse cumulative distribution with a non parametric method?

I have tried Google, ethz forums, R help but it seems to be missing.

David Robinson
  • 77,383
  • 16
  • 167
  • 187
Michelle
  • 202
  • 2
  • 14

1 Answers1

3

It sounds like you want the quantile function:

# simulate some data
mydata = rnorm(1000)

# print the quantiles at a few points
# (it's the inverse of the cumulative distribution function):
print(quantile(mydata, .5))
print(quantile(mydata, .75))

# show the curve from 0 to 1
curve(quantile(mydata, x))
David Robinson
  • 77,383
  • 16
  • 167
  • 187
  • Just to clarify: 'quantile' is the inverse function of 'density' (in a non parametric sense) ? – Michelle Jan 11 '13 at 17:56
  • Do you mean cumulative density? Then yes. Try `curve(ecdf(mydata)(x), from=-3, to=3)` and you'll see it's the inverse. – David Robinson Jan 11 '13 at 18:04
  • I have tried to implement your advice, but it seems that I exposed myself wrong. `Estimated_data = density(Original,bw=sj,kernel="epanechnikov") quantile(Estimated_data, .95)` This would give me the value of the accumulated 95% in the Estimated_data and not in the "Original" – Michelle Jan 21 '13 at 21:42
  • `density` does *not* give you the cumulative density- did you mean something else in your question and title? (You specifically asked for the "inverse cumulative distribution"). – David Robinson Jan 21 '13 at 21:50
  • The original data has been estimated by kernel (that is the reason I wrote `density`). For this reason by using quantile will give me the inverse of the cumulative distribution.In the title I also refer "Non parametric", regarding to this is that I don't know the original distribution of the data. – Michelle Jan 21 '13 at 21:57
  • In this part I explain in a plain way what I'm referring to [link]http://stackoverflow.com/questions/14446569/inverse-function-of-an-unknown-cumulative-function/14446659#14446659 – Michelle Jan 21 '13 at 22:05