Re: Finding distribution parameters for a mixture of product distributions

• To: mathgroup at smc.vnet.net
• Subject: [mg122344] Re: Finding distribution parameters for a mixture of product distributions
• From: Darren Glosemeyer <darreng at wolfram.com>
• Date: Wed, 26 Oct 2011 17:36:58 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```On 10/22/2011 5:06 AM, Koslicki wrote:
> I am trying to estimate parameters for a mixture of product
> distributions, and Mathematica does not like my inclusion of product
> distributions.
>
> Ignoring the stupidity of the following choice of distributions,
> consider the following:
>
> In:= data=RandomVariate[MixtureDistribution[{.1,.9},
> {BernoulliDistribution,BernoulliDistribution}],100];
>
> In:= dist1=MixtureDistribution[{p,1-p},
> {BernoulliDistribution[a1],BernoulliDistribution[a2]}];
>
> In:= FindDistributionParameters[data,dist1]
>
> Out= {p->0.261107,a1->0.919502,a2->0.960777}
>
> So everything works just fine.
>
>
> Yet if I want to look at a *product* of Bernoulli distribution
> instead, I get the following:
>
> In:= data=RandomVariate[MixtureDistribution[{.1,.9},
> {ProductDistribution[BernoulliDistribution,BernoulliDistribution],ProductDistribution[BernoulliDistribution,BernoulliDistribution]}],
> 100];
>
> In:= dist1=MixtureDistribution[{p,1-p},
> {ProductDistribution[BernoulliDistribution[a1],BernoulliDistribution[a2]],ProductDistribution[BernoulliDistribution[a3],BernoulliDistribution[a4]]}];
>
> In:= FindDistributionParameters[data,dist1]
>
> During evaluation of In:= FindDistributionParameters::ntsprt: One
> or more data points are not in support of the distribution ...
>
>
> How can it be that one of the data points is not in the support of the
> distribution when I chose the data points from the distribution
> itself?
>
> This problem seems to arise whenever I am trying to find parameters
> for a mixture of product distributions...
>
> Any thoughts?
>
> Thanks,
>
> ~David
>

The estimation code uses internal utility functions to weed out bad
combinations of distributions and data before calling off to
optimization routines. That code needs to be improved to handle this
particular case, and I will look into that for a future release. It
seems to work fine for mixtures of products of betas, so I suspect it
may be specifically mixtures of products of discrete distributions that
are problematic. I would be interested to see what other examples you've
run into trouble with so I can use those as test cases as well.

While I do not recommend doing the following in general, a possible way
around this for now is to add a definition for the internal validation
function so this case will no longer get kicked out as being invalid.

In:= data = RandomVariate[MixtureDistribution[{.1, .9},
{ProductDistribution[BernoulliDistribution, BernoulliDistribution],
ProductDistribution[BernoulliDistribution,
BernoulliDistribution]}], 100];

In:= dist1 = MixtureDistribution[{p, 1 - p},
{ProductDistribution[BernoulliDistribution[a1], BernoulliDistribution[a2]],
ProductDistribution[BernoulliDistribution[a3],
BernoulliDistribution[a4]]}];

The case we will add is for mixtures of products of discrete
distributions. The check will be weaker than it should be (we will only
check that the data points are lists of integers of the right length),
so you will need to make sure that all the integers you feed in for
these cases are in range.

In:= Unprotect[MixtureDistribution];

In:= MixtureDistribution /:
Statistics`Library`AcceptableDistributedDataQ[MixtureDistribution[_?VectorQ,

distlist :
{ProductDistribution[__?Statistics`Library`DiscreteUnivariateDistributionQ]
..}]?
DistributionParameterQ, data_?(MatrixQ[#, IntegerQ] &)] := True /;
Dimensions[data][] === Length[distlist[]]

In:= Protect[MixtureDistribution];

In:= FindDistributionParameters[data, dist1]

Out= {p -> 0.909997, a1 -> 1., a2 -> 1., a3 -> 5.31528*10^-8, a4 ->
5.31528*10^-8}

Darren Glosemeyer
Wolfram Research

```

• Prev by Date: Re: Integral points on elliptic curves
• Next by Date: Re: bug ?
• Previous by thread: Finding distribution parameters for a mixture of product distributions
• Next by thread: integration problem
{"ft_lang_label":"__label__en","ft_lang_prob":0.66870457,"math_prob":0.7141823,"size":4069,"snap":"2019-35-2019-39","text_gpt3_token_len":1043,"char_repetition_ratio":0.2519065,"word_repetition_ratio":0.03815261,"special_character_ratio":0.27058247,"punctuation_ratio":0.19476745,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9618604,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-15T08:45:05Z\",\"WARC-Record-ID\":\"<urn:uuid:4335676e-c429-4e42-becf-0a6a8c571f29>\",\"Content-Length\":\"45965\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e00a1141-4cd9-470b-bb3a-ced6ac5c7430>\",\"WARC-Concurrent-To\":\"<urn:uuid:9bc0da9a-da38-4d87-ba22-fbcaccdec756>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"http://forums.wolfram.com/mathgroup/archive/2011/Oct/msg00604.html\",\"WARC-Payload-Digest\":\"sha1:AOUJIUP3AJIE6DG4D56GH7YCKS2VXY24\",\"WARC-Block-Digest\":\"sha1:L4XZESR637HELQL34LMIVWMCMOERATZ2\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514570830.42_warc_CC-MAIN-20190915072355-20190915094355-00112.warc.gz\"}"}