MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plot InverseSurvivalFunction

On Fri, Nov 15, 2013 at 06:41:57AM -0500, Eduardo M. A. M. Mendes wrote:
> Hello
> Is there any way to evaluate (or even plot) the inverse survival function of a sum of two Fs?
> Here is what I have so far
> \[ScriptCapitalD]=TransformedDistribution[u+v,{u\[Distributed]FRatioDistribution[2,2 2],v\[Distributed]FRatioDistribution[2,2 2]}]
> PDF[\[ScriptCapitalD],x]
> Plot[PDF[\[ScriptCapitalD],x],{x,0,10},Filling->Axis]
> CDF[\[ScriptCapitalD],x]
> Plot[CDF[\[ScriptCapitalD],x],{x,0,10},Filling->Axis]
> All above commands return the results I expect but when I try
> Plot[InverseSurvivalFunction[\[ScriptCapitalD],x],{x,0,1},Filling->Axis,PlotRange-> Full]
> Mathematica won't show any curve. Does it mean that Mathematica could not find an expression for it?
> I know that the sum of Fs will get rather complicated.
> Is there any way to get an output from InverseSurvivalFunction[\[ScriptCapitalD],0.95] for instance?

There appears to be a bug that InverseSurivivalFunction doesn't evaluate when
given a TransformedDistribution.  One trick to deal with that is to create a
new distribution from the PDF of the TransformedDistribution:

\[ScriptCapitalD] = 
     u + v, {u \[Distributed] FRatioDistribution[2, 2 2], 
      v \[Distributed] FRatioDistribution[2, 2 2]}], x], {x, 
    0, \[Infinity]}];

In[31]:= InverseSurvivalFunction[\[ScriptCapitalD], 0.5]

Out[31]= 2.25061

However, this function will be extremely slow and not really usable for
plotting.  I tried plotting it out of curiousity to see the timing, and when I
didn't finish after 7 minutes or so I gave up.  On the other hand, it will be
usable if you need to evaluate a small number of points with relative accuracy.

For plotting, you could do something like the following:

survival[z_] = 
   u + v, {u \[Distributed] FRatioDistribution[2, 2 2], 
    v \[Distributed] FRatioDistribution[2, 2 2]}], z]

invsurv[q_Real] := 
 Block[{z}, z /. FindRoot[survival[z] == q, {z, 1}]]

Plot[qun[q], {q, 0.01, 0.999}]

Which would still not be lightning fast but usable (something like 15 seconds
on my machine.)

> Many thanks
> Ed
Itai Seggev
Mathematica Algorithms R&D

  • Prev by Date: Re: TeXForm
  • Next by Date: Re: Plot InverseSurvivalFunction
  • Previous by thread: Re: Plot InverseSurvivalFunction
  • Next by thread: Re: Plot InverseSurvivalFunction