Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Plot InverseSurvivalFunction
Replies: 8   Last Post: Nov 17, 2013 4:24 AM

 Messages: [ Previous | Next ]
 emammendes@gmail.com Posts: 143 Registered: 8/22/05
Re: Plot InverseSurvivalFunction
Posted: Nov 17, 2013 4:05 AM

Hello

Yes, it is faster. Many thanks.

The last command should be Plot[invsurv[q], {q, 0.01, 0.999}], shouldn't it?

Cheers

Ed

On Nov 15, 2013, at 10:22 PM, Itai Seggev <itais@wolfram.com> wrote:

> 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

Date Subject Author
11/15/13 Bob Hanlon
11/17/13 emammendes@gmail.com
11/17/13 Itai Seggev
11/17/13 Itai Seggev
11/17/13 emammendes@gmail.com