Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6467

Re: Solve for parameters of a truncated normal

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Solve for parameters of a truncated normal
Date 2011-11-16 09:46 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ja00pv$629$1@smc.vnet.net> (permalink)
References <201111151050.FAA23783@smc.vnet.net>

Show all headers | View raw


The problem is not algebraic, so you'll need FindRoot and good initial  
guesses.

Here's my first attempt, which might work but doesn't:

X = TruncatedDistribution[{0, \[Infinity]},
    NormalDistribution[mu, sigma]];
sub0 = mu -> sigma t
mean0 = Mean@X /. sub0;
sub1 = First@Solve[mean0 == 1, sigma]
var1 = Variance@X /. sub0 /. sub1 // FullSimplify;
sub2 = FindRoot[var1 == 1, {t, -7}]
solution = Thread[{mu, sigma} -> ({mu, sigma} /. sub0 /. sub1 /. sub2)]

mu -> sigma t

{sigma -> (E^(t^2/2) (1 + Erf[t/Sqrt[2]]))/(
   Sqrt[2/\[Pi]] + E^(t^2/2) t + E^(t^2/2) t Erf[t/Sqrt[2]])}

{t -> -6.89244}

{mu -> -49.3683, sigma -> 7.16266}

Through[{Mean, Variance}@X] /. solution

{0.999461, 0.}

(Variance 0, not 1.)

To get a hint at WHY it doesn't work, consider the VERY noisy plot

Plot[var1, {t, -20, 10}]

Increasing precision smooths it out:

p = Plot[var1, {t, -100, 100}, WorkingPrecision -> 20]

but doesn't show a value with variance 1:

Cases[p, Line[x_] :> Max@x[[All, -1]], Infinity]

{0.9998}

We can go back to FindRoot and try more precision, but the result is

sub2 = FindRoot[var1 == 1, {t, 10}, WorkingPrecision -> 20]

{t -> -150.04497603233965416}

with a FindRoot::lstol error.

t -> - Infinity if we keep looking, so no solution appears to exist.

Bobby

On Tue, 15 Nov 2011 04:50:44 -0600, paul <paulvonhippel@yahoo.com> 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.
>
>


-- 
DrMajorBob@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Solve for parameters of a truncated normal DrMajorBob <btreat1@austin.rr.com> - 2011-11-16 09:46 +0000

csiph-web