0

I fitted a empirical distribution to a set of time series data (Y) by following code in R:

Ye=rank(Y)/(length(Y)+1)

How we can find the inverse of this distribution? Thanks

Firebug
  • 19,076
  • 6
  • 77
  • 139
Fred
  • 1,037
  • 2
  • I'd have used the ecdf function. 2) The function doesn't have an actual inverse. What did you need it for? Random sampling?
  • – Glen_b Feb 25 '14 at 20:36
  • @Glen_b Thank you This is what I did: I have a time series first I deseasonalized it then I differenced it to make it stationary then I fitted empirical distribution to fit copula (I want to use Markov process with copula) Finally I want to use inverse of the empirical distribution to be able to compare the results with original observations.If there is no inverse func I should probably do the comparing without transferring back – Fred Feb 25 '14 at 20:42
  • 3
    @glen_b An ECDF has right inverses but no left inverses; sometimes the former is good enough when an inverse is needed. (A function $f$ has a right inverse $g$ when $f(g(y))=y$ for all $y$ in the image of $f$.) The right inverse can be found with a binary search or its equivalent. I cannot tell from the information given so far whether a right inverse would be suitable in this situation. – whuber Feb 25 '14 at 21:09
  • 1
    Hmm, I missed the 'time series' part the first read through. If the time series isn't serially independent I'd be very unlikely to deal with the marginal distribution. – Glen_b Feb 25 '14 at 21:46
  • 3
    @whuber Yes, you're quite right (as usual) -- I was insufficiently precise. It would be nice to know what the actual thing the OP is trying to achieve (the only thing that jumps out at me is trying to sample from the empirical distribution, for which I'd just use sample) – Glen_b Feb 25 '14 at 21:46
  • 1
    To clarify my last sentence in the previous comment ... I'd use sample with replace=TRUE (of course). – Glen_b Feb 27 '14 at 02:07