Re: Solve for parameters of a truncated
- To: mathgroup at smc.vnet.net
- Subject: [mg122954] Re: Solve for parameters of a truncated
- From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
- Date: Fri, 18 Nov 2011 06:23:25 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201111151050.FAA23783@smc.vnet.net>
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 at bobbys-imac.local>, DrMajorBob <btreat1 at 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 at 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 at smc.vnet.net>, >> Andrzej Kozlowski <akoz at 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 >> >> >
- References:
- Solve for parameters of a truncated normal distribution
- From: paul <paulvonhippel@yahoo.com>
- Solve for parameters of a truncated normal distribution