Re: Plot InverseSurvivalFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg132023] Re: Plot InverseSurvivalFunction
- From: Itai Seggev <itais at wolfram.com>
- Date: Sun, 17 Nov 2013 18:23:35 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20131115114157.A96816A4F@smc.vnet.net>
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] =
ProbabilityDistribution[
PDF[TransformedDistribution[
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_] =
SurvivalFunction[
TransformedDistribution[
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
217-398-0700
- References:
- Plot InverseSurvivalFunction
- From: "Eduardo M. A. M. Mendes" <emammendes@gmail.com>
- Plot InverseSurvivalFunction