Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6510 > unrolled thread
| Started by | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| First post | 2011-11-18 11:28 +0000 |
| Last post | 2011-11-18 11:28 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Solve for parameters of a truncated DrMajorBob <btreat1@austin.rr.com> - 2011-11-18 11:28 +0000
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-11-18 11:28 +0000 |
| Subject | Re: Solve for parameters of a truncated |
| Message-ID | <ja5fg2$6e3$1@smc.vnet.net> |
I'll meet that and raise you this:
X = TruncatedDistribution[{0, \[Infinity]},
NormalDistribution[\[Mu], \[Sigma]]];
{mean, var} = FullSimplify@Through[{Mean, Variance}@X];
Manipulate[p = {3.3532, .2242, .3637};
Column@{Row@{Style["variance = ", FontFamily -> "Arial",
FontSize -> 11.5, Red],
Style[ToString@height, FontFamily -> "Arial", FontSize -> 11.5],
Style[" = mean ", FontFamily -> "Arial", FontSize -> 11.5,
Blue]}, Show[{ContourPlot[
mean == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
ContourStyle -> {Red}, ImageSize -> 350],
ContourPlot[var == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
ContourStyle -> {Blue}]}, FrameLabel -> {"\[Mu]", "\[Sigma]"}],
Plot3D[{mean, var, 1}, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
PlotStyle -> {Blue, Green, {Opacity[0.5], Gray}},
ImageSize -> 350, ViewPoint -> Dynamic[p]],
ViewPoint -> Dynamic[p]}, {{height, 1}, 0.1, 3, 0.001}]
Bobby
On Thu, 17 Nov 2011 17:23:10 -0600, Barrie Stokes
<Barrie.Stokes@newcastle.edu.au> wrote:
> Hi Bobby
>
> Very nice. My final mod of your mod of ...
>
> Manipulate[
> Column@{Style[
> "mean equals variance equals " <>
> ToString[height], FontFamily -> "Arial", FontSize -> 11.5],
> Show[{ContourPlot[
> mean == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
> ContourStyle -> {Red}, ImageSize -> 350],
> ContourPlot[var == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
> ContourStyle -> {Blue}]},
> FrameLabel -> {"\[Mu]", "\[Sigma]"}],
> Plot3D[{mean, var, height}, {\[Mu], 0.01, 3}, {\[Sigma],
> 0.01, 3},
> PlotStyle -> {Blue, Green, {Opacity[0.5], Gray}},
> ImageSize -> 350]}, {{height, 1},
> 0.1, 3, 0.001}]
>
>
> Best,
>
> Barrie
>
>>>> On 18/11/2011 at 6:19 am, in message
>>>> <op.v43um9zhtgfoz2@bobbys-imac.local>,
> DrMajorBob <btreat1@austin.rr.com> wrote:
>> Try this:
>>
>> X = TruncatedDistribution[{0, \[Infinity]},
>> NormalDistribution[\[Mu], \[Sigma]]];
>> {mean, var} = FullSimplify@Through[{Mean, Variance}@X];
>>
>> Manipulate[
>> p = {3.3532, .2242, .3637};
>> Column@{Style[
>> "mean can equal variance if contours intersect at height = " <>
>> ToString[height], FontFamily -> "Arial", FontSize -> 11.5],
>> Show[{ContourPlot[
>> mean == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>> ContourStyle -> {Red}, ImageSize -> 350],
>> ContourPlot[var == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>> ContourStyle -> {Blue}]}, FrameLabel -> {"\[Mu]", "\[Sigma]"}],
>> Plot3D[{mean, var, 1}, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>> PlotStyle -> {Blue, Green, Gray}, ImageSize -> 350,
>> ViewPoint -> Dynamic[p]], ViewPoint -> Dynamic[p]}, {{height, 1},
>> 0.1, 3, 0.001}]
>>
>> I think the contour at 2 only adds confusion.
>>
>> Bobby
>>
>> On Thu, 17 Nov 2011 05:03:57 -0600, Barrie Stokes
>> <Barrie.Stokes@newcastle.edu.au> wrote:
>>
>>> Andrzej , Bobby
>>>
>>> Speaking of nice graphics:
>>>
>>> If you combine Bobby's mods to my ContourPlot ...
>>>
>>> X = TruncatedDistribution[{0, \[Infinity]},
>>> NormalDistribution[\[Mu], \[Sigma]]];
>>> {mean, var} = FullSimplify@Through[{Mean, Variance}@X];
>>> Manipulate[
>>> Column@{Style[ "contour height is " <> ToString[ height],
>>> FontFamily -> "Arial", FontSize -> 11.5 ],
>>> Show[{ContourPlot[
>>> mean == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>>> ContourStyle -> {Red}, ImageSize -> 350],
>>> ContourPlot[var == height, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>>> ContourStyle -> {Blue}]},
>>> FrameLabel -> {"\[Mu]", "\[Sigma]"}]}, {{height, 1}, 0.1, 3,
>>> 0.001}]
>>>
>>> with these plots from Andrzej's code (rotate both plots to reveal the
>>> "underside") ...
>>>
>>> X = TruncatedDistribution[{0, \[Infinity]},
>>> NormalDistribution[\[Mu], \[Sigma]]];
>>> m = Mean[X];
>>> v = Variance[X];
>>>
>>> and then ...
>>>
>>> Plot3D[{m, v, 1}, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>>> PlotStyle -> {Blue, Green, Gray}]
>>>
>>> and ...
>>>
>>> Plot3D[{m, v, 2}, {\[Mu], 0.01, 3}, {\[Sigma], 0.01, 3},
>>> PlotStyle -> {Blue, Green, Gray}]
>>>
>>> the difference between height=1 and height=2 is clearly revealed.
>>>
>>> Cheers
>>>
>>> Barrie
>>>
>>>
>>>
>>>
>>>>>> On 16/11/2011 at 8:46 pm, in message
>>>>>> <201111160946.EAA06190@smc.vnet.net>,
>>> Andrzej Kozlowski <akoz@mimuw.edu.pl> wrote:
>>>
>>>> On 15 Nov 2011, at 11:50, paul wrote:
>>>>
>>>>> I'm trying to solve the following problem:
>>>>> X = TruncatedDistribution[{0, \[Infinity]},
>>>>> NormalDistribution[\[Mu], \[Sigma]]]
>>>>> Solve[Mean[X] == 1 && Variance[X] == 1, {\[Mu], \[Sigma]}, Reals]
>>>>>
>>>>> I get an error message: "This system cannot be solved with the
>>>>> methods
>>>>> available to Solve." It doesn't help if I replace Solve with NSolve.
>>>>>
>>>>> In case I've made a mistake in defining the problem, I should say
>>>>> that
>>>>> I'm looking for the parameters of a normal distribution so that, if
>>>>> the normal is truncated on the left at zero, the result will be a
>>>>> truncated distribution whose mean and variance are both 1. It seems
>>>>> to
>>>>> me Mathematica should be able to solve this, at least numerically.
>>>>>
>>>>> Many thanks for any suggestions.
>>>>>
>>>>>
>>>>
>>>> Your first mistake is to use functions (Solve and NSolve) which are
>>>> not
>>>> intended for such purposes at all. NSolve can only solve (numerically)
>>>> polynomial equations and systems of such. Your equations are certainly
>>>> not of
>>>> this kind. Solve (in version 8) can also solve certain univariate
>>>> transcendental equations but not systems of such. So again, there is
>>>> no
>>>> point
>>>> at all of trying either of these functions on your system.
>>>>
>>>> The only function that might work is FindRoot. However, before one
>>>> even
>>>> starts, one has to have some reason for believing such a solution
>>>> exists.
>>>> Now, looking at the graphs below, I see no such reason. So do you have
>>>> one?
>>>>
>>>> X = TruncatedDistribution[{0, \[Infinity]},
>>>> NormalDistribution[\[Mu], \[Sigma]]];
>>>>
>>>> m = Mean[X];
>>>>
>>>> v = Variance[X];
>>>>
>>>> Plot3D[{m, v, 1}, {\[Mu], 0.1, 2}, {\[Sigma], 0.1, 2},
>>>> PlotStyle -> {Blue, Green, Black}]
>>>>
>>>> Andrzej Kozlowski
>>>
>>>
>>
--
DrMajorBob@yahoo.com
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web