Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3946 > unrolled thread
| Started by | paulvonhippel at yahoo <paulvonhippel@yahoo.com> |
|---|---|
| First post | 2011-07-24 07:22 +0000 |
| Last post | 2011-08-26 09:36 +0000 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
TransformedDistribution -- odd problem paulvonhippel at yahoo <paulvonhippel@yahoo.com> - 2011-07-24 07:22 +0000
Re: TransformedDistribution -- odd problem paulvonhippel at yahoo <paulvonhippel@yahoo.com> - 2011-07-25 11:34 +0000
Re: TransformedDistribution -- odd problem paulvonhippel at yahoo <paulvonhippel@yahoo.com> - 2011-07-25 11:34 +0000
Re: TransformedDistribution -- odd problem Paul von Hippel <paulvonhippel@yahoo.com> - 2011-07-26 11:09 +0000
Re: TransformedDistribution -- odd problem Paul von Hippel <paulvonhippel@yahoo.com> - 2011-07-26 11:10 +0000
Re: TransformedDistribution -- odd problem Darren Glosemeyer <darreng@wolfram.com> - 2011-07-27 10:23 +0000
Re: TransformedDistribution -- odd problem paulvonhippel at yahoo <paulvonhippel@yahoo.com> - 2011-08-26 09:36 +0000
| From | paulvonhippel at yahoo <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-07-24 07:22 +0000 |
| Subject | TransformedDistribution -- odd problem |
| Message-ID | <j0gh7s$bd7$1@smc.vnet.net> |
I'm having a very strange problem with TransformedDistribution, where I can calculate the mean of an F distribution but I cannot calculate the mean of a constant multiplied by an F distribution. That is, if I type Mean[TransformedDistribution[F, F \[Distributed] FRatioDistribution[v, v]]] Mathematica gives me an answer. But if I type Mean[TransformedDistribution[k*F , F \[Distributed] FRatioDistribution[v, v]]] Mathematica just echoes the input. I swear I got an answer for the second expression earlier today. What am I doing wrong?
[toc] | [next] | [standalone]
| From | paulvonhippel at yahoo <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-07-25 11:34 +0000 |
| Message-ID | <j0jkbl$p0i$1@smc.vnet.net> |
| In reply to | #3946 |
I also have a more complicated example where Mathematica will give the mean of A and the mean of B, but when I ask for the mean of A+B Mathematica just echoes the input. (Here A and B are complicated functions of several random variables.) This strikes me as really odd, since of course Mean(A+B)=Mean(A)+Mean(B). What could be going on here? Under what circumstances does Mathematica echo the input when asked to provide a Mean? Is there a setting I need to change? I suspect this is a software issue rather than a mathematical issue.
[toc] | [prev] | [next] | [standalone]
| From | paulvonhippel at yahoo <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-07-25 11:34 +0000 |
| Message-ID | <j0jkck$p0r$1@smc.vnet.net> |
| In reply to | #3946 |
A little more experimenting shows that the TransformedDistribution function will also not provide the mean of k+F where k is a constant and F has an F distribution -- i.e., Mean[TransformedDistribution[k*F , F \[Distributed] FRatioDistribution[v, v]]] If I changce the distribution of F to NormalDistribution or ChiSquareDistribution, I can get a mean for k*F or k+F. So the problem only occurs when I define a simple function of an F variable using the TransformedDistribution function. This all strikes me as very strange, and I'd be curious to know if others can reproduce my results. If you can't reproduce my results, I'd be interested in theories about why my results differ from yours. E.g., is there a setting I should change in the software? I am using version 8.0.0.0 and looking to upgrade to 8.0.1, if that makes a difference. Many thanks for any pointers. On Jul 24, 2:22 am, paulvonhippel at yahoo <paulvonhip...@yahoo.com> wrote: > I'm having a very strange problem with TransformedDistribution, where > I can calculate the mean of an F distribution but I cannot calculate > the mean of a constant multiplied by an F distribution. That is, if I > type > > Mean[TransformedDistribution[F, F \[Distributed] > FRatioDistribution[v, v]]] > > Mathematica gives me an answer. But if I type > > Mean[TransformedDistribution[k*F , F \[Distributed] > FRatioDistribution[v, v]]] > > Mathematica just echoes the input. I swear I got an answer for the > second expression earlier today. What am I doing wrong?
[toc] | [prev] | [next] | [standalone]
| From | Paul von Hippel <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-07-26 11:09 +0000 |
| Message-ID | <j0m79p$946$1@smc.vnet.net> |
| In reply to | #3946 |
Thanks -- that fixes it!
Bonus question: if we don't specify v2>2, why doesn't Mathematica return a two part solution:
k v2 / (v2-2) v2>2
Indeterminate True
That's what it does if we request the mean of F -- why doesn't it do the same if we request the mean of k*F.
________________________________
From: Barrie Stokes <Barrie.Stokes@newcastle.edu.au>
Sent: Monday, July 25, 2011 8:09 PM
Subject: Re: TransformedDistribution -- odd problem
Hi Paul
There are conditions on the v1 and v2, the degrees of freedom of the F distribution:
Assuming[v2 > 2,
Mean[TransformedDistribution[F ,
F \[Distributed] FRatioDistribution[v1, v2]]]]
{Assuming[v2 > 2,
Mean[TransformedDistribution[k*F ,
F \[Distributed] FRatioDistribution[v1, v2]]]], k*v2/(-2 + v2)}
{Assuming[v2 > 2,
Mean[TransformedDistribution[k + F ,
F \[Distributed] FRatioDistribution[v1, v2]]]],
k + v2/(-2 + v2)} // FullSimplify
which shows precisely what you expect for k*F and k+F.
Cheers
Barrie
>>> On 25/07/2011 at 9:29 pm, in message <201107251129.HAA25540@smc.vnet.net>,
paulvonhippel at yahoo <paulvonhippel@yahoo.com> wrote:
> A little more experimenting shows that the TransformedDistribution
> function will also not provide the mean of k+F where k is a constant
> and F has an F distribution -- i.e.,
> Mean[TransformedDistribution[k*F , F \[Distributed]
> FRatioDistribution[v, v]]]
>
> If I changce the distribution of F to NormalDistribution or
> ChiSquareDistribution, I can get a mean for k*F or k+F. So the problem
> only occurs when I define a simple function of an F variable using the
> TransformedDistribution function.
> This all strikes me as very strange, and I'd be curious to know if
> others can reproduce my results. If you can't reproduce my results,
> I'd be interested in theories about why my results differ from yours.
> E.g., is there a setting I should change in the software?
>
> I am using version 8.0.0.0 and looking to upgrade to 8.0.1, if that
> makes a difference.
>
> Many thanks for any pointers.
>
> On Jul 24, 2:22 am, paulvonhippel at yahoo <paulvonhip...@yahoo.com>
> wrote:
>> I'm having a very strange problem with TransformedDistribution, where
>> I can calculate the mean of an F distribution but I cannot calculate
>> the mean of a constant multiplied by an F distribution. That is, if I
>> type
>>
>> Mean[TransformedDistribution[F, F \[Distributed]
>> FRatioDistribution[v, v]]]
>>
>> Mathematica gives me an answer. But if I type
>>
>> Mean[TransformedDistribution[k*F , F \[Distributed]
>> FRatioDistribution[v, v]]]
>>
>> Mathematica just echoes the input. I swear I got an answer for the
>> second expression earlier today. What am I doing wrong?
[toc] | [prev] | [next] | [standalone]
| From | Paul von Hippel <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-07-26 11:10 +0000 |
| Message-ID | <j0m7ap$94j$1@smc.vnet.net> |
| In reply to | #3946 |
That problem went away, thanks. I upgraded to 8.0.1, and I learned that Mathematica can have trouble evaluating symbols with subscripts. ________________________________ From: Barrie Stokes <Barrie.Stokes@newcastle.edu.au> Sent: Monday, July 25, 2011 8:12 PM Subject: Re: TransformedDistribution -- odd problem Hi Paul Could we see an example of "a more complicated example where Mathematica will give the mean of A and the mean of B, but when I ask for the mean of A+B Mathematica just echoes the input", please? Barrie >>> On 25/07/2011 at 9:29 pm, in message <201107251129.HAA25532@smc.vnet.net>, paulvonhippel at yahoo <paulvonhippel@yahoo.com> wrote: > I also have a more complicated example where Mathematica will give the > mean of A and the mean of B, but when I ask for the mean of A+B > Mathematica just echoes the input. (Here A and B are complicated > functions of several random variables.) This strikes me as really odd, > since of course Mean(A+B)=Mean(A)+Mean(B). > > What could be going on here? Under what circumstances does Mathematica > echo the input when asked to provide a Mean? Is there a setting I need > to change? I suspect this is a software issue rather than a > mathematical issue.
[toc] | [prev] | [next] | [standalone]
| From | Darren Glosemeyer <darreng@wolfram.com> |
|---|---|
| Date | 2011-07-27 10:23 +0000 |
| Message-ID | <j0oovj$ku8$1@smc.vnet.net> |
| In reply to | #3946 |
On 7/26/2011 6:06 AM, Paul von Hippel wrote:
> Thanks -- that fixes it!
>
> Bonus question: if we don't specify v2>2, why doesn't Mathematica return a two part solution:
> k v2 / (v2-2) v2>2
>
> Indeterminate True
>
> That's what it does if we request the mean of F -- why doesn't it do the same if we request the mean of k*F.
>
>
>
>
> ________________________________
> From: Barrie Stokes<Barrie.Stokes@newcastle.edu.au>
> To: mathgroup@smc.vnet.net; paulvonhippel at yahoo<paulvonhippel@yahoo.com>
> Sent: Monday, July 25, 2011 8:09 PM
> Subject: Re: TransformedDistribution -- odd problem
>
> Hi Paul
>
> There are conditions on the v1 and v2, the degrees of freedom of the F distribution:
>
> Assuming[v2> 2,
> Mean[TransformedDistribution[F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]]
>
> {Assuming[v2> 2,
> Mean[TransformedDistribution[k*F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]], k*v2/(-2 + v2)}
>
> {Assuming[v2> 2,
> Mean[TransformedDistribution[k + F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]],
> k + v2/(-2 + v2)} // FullSimplify
>
> which shows precisely what you expect for k*F and k+F.
>
> Cheers
>
> Barrie
>
>>>> On 25/07/2011 at 9:29 pm, in message<201107251129.HAA25540@smc.vnet.net>,
> paulvonhippel at yahoo<paulvonhippel@yahoo.com> wrote:
>> A little more experimenting shows that the TransformedDistribution
>> function will also not provide the mean of k+F where k is a constant
>> and F has an F distribution -- i.e.,
>> Mean[TransformedDistribution[k*F , F \[Distributed]
>> FRatioDistribution[v, v]]]
>>
>> If I changce the distribution of F to NormalDistribution or
>> ChiSquareDistribution, I can get a mean for k*F or k+F. So the problem
>> only occurs when I define a simple function of an F variable using the
>> TransformedDistribution function.
>> This all strikes me as very strange, and I'd be curious to know if
>> others can reproduce my results. If you can't reproduce my results,
>> I'd be interested in theories about why my results differ from yours.
>> E.g., is there a setting I should change in the software?
>>
>> I am using version 8.0.0.0 and looking to upgrade to 8.0.1, if that
>> makes a difference.
>>
>> Many thanks for any pointers.
>>
>> On Jul 24, 2:22 am, paulvonhippel at yahoo<paulvonhip...@yahoo.com>
>> wrote:
>>> I'm having a very strange problem with TransformedDistribution, where
>>> I can calculate the mean of an F distribution but I cannot calculate
>>> the mean of a constant multiplied by an F distribution. That is, if I
>>> type
>>>
>>> Mean[TransformedDistribution[F, F \[Distributed]
>>> FRatioDistribution[v, v]]]
>>>
>>> Mathematica gives me an answer. But if I type
>>>
>>> Mean[TransformedDistribution[k*F , F \[Distributed]
>>> FRatioDistribution[v, v]]]
>>>
>>> Mathematica just echoes the input. I swear I got an answer for the
>>> second expression earlier today. What am I doing wrong?
The reason is internal processing in the general moment/expectation code. The result for mean of FRatioDistribution is hard-coded, while TransformDistribution has to go through more general code. In simple cases like shifting or rescaling by a constant, correctly propagating indeterminacies and infinities is fairly straightforward, but for more complicated transforms this may not be as easy. This is an area we will look at for improvement in the future.
Darren Glosemeyer
Wolfram Research
[toc] | [prev] | [next] | [standalone]
| From | paulvonhippel at yahoo <paulvonhippel@yahoo.com> |
|---|---|
| Date | 2011-08-26 09:36 +0000 |
| Message-ID | <j37pet$4n8$1@smc.vnet.net> |
| In reply to | #3946 |
Here is a variant of the same difficulty. In the input I specify that
v2>2, yet in the output I get two solutions, one of which only applies
if v2<=2.
Many thanks if you can tell me what I'm doing wrong. I believe my
mistake here may be causing more serious problems in more complicated
input.
In[3]:= Assuming[v2 > 2,
Mean[TransformedDistribution[
w, {w \[Distributed] FRatioDistribution[v1, v2]}]]] // InputForm
Out[3]//InputForm=
Piecewise[{{v2/(-2 + v2), v2 > 2}}, Indeterminate]
On Jul 26, 6:09 am, Paul von Hippel <paulvonhip...@yahoo.com> wrote:
> Thanks -- that fixes it!
>
> Bonus question: if we don't specify v2>2, why doesn't Mathematica return a two part solution:
> k v2 / (v2-2) v2>2
>
> Indeterminate True
>
> That's what it does if we request the mean of F -- why doesn't it do the same if we request the mean of k*F.
>
> ________________________________
> From: Barrie Stokes <Barrie.Sto...@newcastle.edu.au>
> Sent: Monday, July 25, 2011 8:09 PM
> Subject: Re: TransformedDistribution -- odd problem
>
> Hi Paul
>
> There are conditions on the v1 and v2, the degrees of freedom of the F distribution:
>
> Assuming[v2 > 2,
> Mean[TransformedDistribution[F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]]
>
> {Assuming[v2 > 2,
> Mean[TransformedDistribution[k*F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]], k*v2/(-2 + v2)}
>
> {Assuming[v2 > 2,
> Mean[TransformedDistribution[k + F ,
> F \[Distributed] FRatioDistribution[v1, v2]]]],
> k + v2/(-2 + v2)} // FullSimplify
>
> which shows precisely what you expect for k*F and k+F.
>
> Cheers
>
> Barrie
>
> >>> On 25/07/2011 at 9:29 pm, in message <201107251129.HAA25...@smc.vnet.net>,
>
> paulvonhippel at yahoo <paulvonhip...@yahoo.com> wrote:
>
>
>
>
>
>
>
> > A little more experimenting shows that the TransformedDistribution
> > function will also not provide the mean of k+F where k is a constant
> > and F has an F distribution -- i.e.,
> > Mean[TransformedDistribution[k*F , F \[Distributed]
> > FRatioDistribution[v, v]]]
>
> > If I changce the distribution of F to NormalDistribution or
> > ChiSquareDistribution, I can get a mean for k*F or k+F. So the problem
> > only occurs when I define a simple function of an F variable using the
> > TransformedDistribution function.
> > This all strikes me as very strange, and I'd be curious to know if
> > others can reproduce my results. If you can't reproduce my results,
> > I'd be interested in theories about why my results differ from yours.
> > E.g., is there a setting I should change in the software?
>
> > I am using version 8.0.0.0 and looking to upgrade to 8.0.1, if that
> > makes a difference.
>
> > Many thanks for any pointers.
>
> > On Jul 24, 2:22 am, paulvonhippel at yahoo <paulvonhip...@yahoo.com>
> > wrote:
> >> I'm having a very strange problem with TransformedDistribution, where
> >> I can calculate the mean of an F distribution but I cannot calculate
> >> the mean of a constant multiplied by an F distribution. That is, if I
> >> type
>
> >> Mean[TransformedDistribution[F, F \[Distributed]
> >> FRatioDistribution[v, v]]]
>
> >> Mathematica gives me an answer. But if I type
>
> >> Mean[TransformedDistribution[k*F , F \[Distributed]
> >> FRatioDistribution[v, v]]]
>
> >> Mathematica just echoes the input. I swear I got an answer for the
> >> second expression earlier today. What am I doing wrong?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web