0
$\begingroup$

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

$\endgroup$
6
  • 2
    $\begingroup$ 1) I'd have used the ecdf function. 2) The function doesn't have an actual inverse. What did you need it for? Random sampling? $\endgroup$
    – Glen_b
    Commented Feb 25, 2014 at 20:36
  • 3
    $\begingroup$ @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. $\endgroup$
    – whuber
    Commented Feb 25, 2014 at 21:09
  • 1
    $\begingroup$ 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. $\endgroup$
    – Glen_b
    Commented Feb 25, 2014 at 21:46
  • 3
    $\begingroup$ @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) $\endgroup$
    – Glen_b
    Commented Feb 25, 2014 at 21:46
  • 1
    $\begingroup$ To clarify my last sentence in the previous comment ... I'd use sample with replace=TRUE (of course). $\endgroup$
    – Glen_b
    Commented Feb 27, 2014 at 2:07

1 Answer 1

1
$\begingroup$

Basically answered in comments, recollected here:

An ECDF has right inverses but no left inverses; sometimes the former is good enough when an inverse is needed. (A function 𝑓 has a right inverse 𝑔 when 𝑓(𝑔(𝑦))=𝑦 for all 𝑦 in the image of 𝑓.) 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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.