Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Solve for parameters of a truncated normal

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122913] Re: Solve for parameters of a truncated normal
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 16 Nov 2011 04:44:25 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201111151050.FAA23783@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

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 at 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 at yahoo.com



  • Prev by Date: Re: How to find more solutions for an periodical equation with infinity solutions
  • Next by Date: Re: Keeping track of variables used in Mathematica
  • Previous by thread: Re: Solve for parameters of a truncated normal distribution
  • Next by thread: Re: Solve for parameters of a truncated normal distribution