# Incorrect result of ParameterMixtureDistribution

Let us consider in 13.1 on Windows 10

distr = ParameterMixtureDistribution[BinomialDistribution[n + 1, p],
n \[Distributed] PoissonDistribution[\[Lambda]]];
PDF[distr, t];
FullSimplify[%, Assumptions ->  t >= 0 && t \[Element] Integers && p > 0 && p < 1 && \[Lambda] > 0]


Piecewise[{{ComplexInfinity, t <= 1}}, (p^t*\[Lambda]^(-1 + t)*(t + \[Lambda] - p*\[Lambda]))/(E^(p*\[Lambda])*t!)]

The above result is clearly incorrect in view of

Sum[(E^(-p \[Lambda]) p^t \[Lambda]^(-1 + t) (t + \[Lambda] - p *\[Lambda]))/ t!,
{t, 2, Infinity}, Assumptions -> p > 0 && p < 1 && \[Lambda] > 0]


E^(-p \[Lambda]) (-1 + E^(p \[Lambda]) - p \[Lambda] + p^2 \[Lambda])

instead of 1.

Is it a bug or I don't understand something? If we face with a bug, is there a workaround?

$Version (* "13.2.0 for Mac OS X x86 (64-bit) (November 18, 2022)" *) Clear["Global*"] distr = ParameterMixtureDistribution[ BinomialDistribution[n + 1, p], n \[Distributed] PoissonDistribution[λ]]; assume = DistributionParameterAssumptions[distr] (* 0 <= p <= 1 && λ > 0 *) PDF[distr, t]  pdf0 = PDF[distr, 0] (* -E^(-p λ) (-1 + p) *) pdf1 = PDF[distr, 1] (* E^(-p λ) p (1 + λ - p λ) *) pdft = Assuming[t > 1 && Element[t, Integers], PDF[distr, t] // FullSimplify] (* (E^(-p λ) p^t λ^(-1 + t) (t + λ - p λ))/t! *) pdf0 + pdf1 + Sum[pdft, {t, 2, Infinity}] // Simplify (* 1 *)  EDIT: (pdft /. t -> 1) == pdf1 (* True *) (pdft /. t -> 0) == pdf0 // Simplify (* True *)  Consequently, pdf = pdft (* (E^(-p λ) p^t λ^(-1 + t) (t + λ - p λ))/t! *)  The mean is μ = Sum[t*pdf, {t, 0, Infinity}] // Simplify (* p (1 + λ) *)  The variance is var = Sum[(t - μ)^2*pdf, {t, 0, Infinity}] // Simplify (* p (1 - p + λ) *)  • This is it. Works in 13.1 on Windows 10 too. Therefore, we face with a bug in FullSimplify, not in ParameterMixtureDistribution. Jan 4, 2023 at 5:46 • I don't think this is a bug in FullSimplify. FullSimplify did what you asked. The problem is that with the definition of the PDF the values for t==0 and t==1 are only defined in the limit. Once you have the simplified pdf, use it to redefine the distribution, i.e., distr2 = ProbabilityDistribution[pdf, {t, 0, Infinity, 1}, Assumptions -> assume]; Jan 4, 2023 at 16:55 I agree the that resulting Piecewise function is wrong if for no other reason than ComplexInfinity is assigned when t = 0. If you want a Piecewise function that works, the following is a workaround: distr = ParameterMixtureDistribution[BinomialDistribution[n + 1, p], n \[Distributed] PoissonDistribution[λ], Assumptions -> 0 < p < 1 && λ > 0]; PDF[distr, t]; temp = FullSimplify[%, Assumptions -> t >= 0 && t ∈ Integers && p > 0 && p < 1 && λ > 0][[2]]; pmf = Piecewise[{{temp, t ∈ NonNegativeIntegers}}, 0]  This sums to 1: Sum[pmf, {t, 0, ∞}] (* 1 *)  • Than you for your interest to the question. Unfortunately, this is not any workaround. Let us call things by their proper names. You choose from Piecewise[{{ComplexInfinity, t <= 1}}, (p^t*\[Lambda]^(-1 + t)*(t + \[Lambda] - p*\[Lambda]))/(E^(p*\[Lambda])*t!)] its second part, i.e. (p^t*\[Lambda]^(-1 + t)*(t + \[Lambda] - p*\[Lambda]))/(E^(p*\[Lambda])*t!) and then make its unwarranted and ungrounded extension on all the PositiveIntegers. The relation Sum[pmf, {t, 0, ∞}]==1 proves nothing: there is a lot ow ways to extend temp on PositiveIntegers to make the sum equal to 1. Jan 3, 2023 at 17:37 • Thank you for your frank response. I used NonNegativeIntegers and not PositiveIntegers. Where do you see PositiveIntegers? (I agree that just because the sum of the resulting probabilities is 1 doesn't confirm that it is the correct answer. But that is a necessary condition.) – JimB Jan 3, 2023 at 17:41 • n+1 ,where n \[Distributed] PoissonDistribution[\[Lambda]] , cannot take 0. Jan 3, 2023 at 17:44 • True. But the pdf is about$t$(the number of successes) and not$n+1\$ (the number of trials).
– JimB
Jan 3, 2023 at 17:46
• JimB (@ does not work.) : You are right. BTW, ParameterMixtureDistribution[BinomialDistribution[n , p], n \[Distributed] PoissonDistribution[\[Lambda]]] is OK. Jan 3, 2023 at 17:51

I'm running 11.3 on Windows, and I noticed that you summed only from two to infinity, rather than from zero.

Sum[(E^(-p \[Lambda]) p^
t \[Lambda]^(-1 + t) (t + \[Lambda] - p*\[Lambda]))/t!, {t, 0,
Infinity}, Assumptions -> p > 0 && p < 1 && \[Lambda] > 0]
`

Returns 1.