0
$\begingroup$

Here is my code: 1. Define a Gaussian Mixture Model

SuperModel[w1_?NumericQ, w2_?NumericQ, w3_?NumericQ, w4_?NumericQ, 
  w5_?NumericQ, m1_?NumericQ, m2_?NumericQ, m3_?NumericQ, 
  m4_?NumericQ, m5_?NumericQ, m6_?NumericQ, m7_?NumericQ, 
  m8_?NumericQ, m9_?NumericQ, m10_?NumericQ, sigma1_?NumericQ, 
  sigma2_?NumericQ, sigma3_?NumericQ, sigma4_?NumericQ, 
  sigma5_?NumericQ] = 
 MixtureDistribution[{w1, w2, w3, w4, 
   w5}, {MultinormalDistribution[{m1, m2}, 
    IdentityMatrix[2]* sigma1], 
   MultinormalDistribution[{m3, m4}, IdentityMatrix[2]*sigma2], 
   MultinormalDistribution[{m5, m6}, IdentityMatrix[2]*sigma3], 
   MultinormalDistribution[{m7, m8}, IdentityMatrix[2]*sigma4], 
   MultinormalDistribution[{m9, m10}, IdentityMatrix[2]*sigma5]}]
  1. Integral over the product of the PDF enter image description here
NIntegrate[
 Product[PDF[
   SuperModel[w1, w2, w3, w4, 1 - (w1 + w2 + w3 + w4), m1, m2, m3, m4,
     m5, sigma1, sigma2, sigma3, sigma4, sigma5], 
   Part[ListY, j]], {j, n}], {m1, -1, 1}, {m2, -1, 1},  {m3, -1, 
  1}, {m4, -1, 1}, {m5, -1, 1}, {sigma1, 4, 16}, {sigma2, 4, 
  16}, {sigma3, 4, 16}, {sigma4, 4, 16}, {sigma5, 4, 
  16}, {w1, w2, w3, w4} \[Element] 
  RegionIntersection[
   ImplicitRegion[w1 + w2 + w3 + w4 <= 1, {w1, w2, w3, w4}],  
   ImplicitRegion[w1 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w2 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w3 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w4 >= 0, {w1, w2, w3, w4}]]]

Then it gives me following error code: enter image description here I'm curious what's wrong with the part of product of PDF?

Supplementary:

  1. ListY: the list of $\{Y_i\}$, contain $n$ $Y_i$ generated from a specific Gaussian Mixture Model. For instance, let $n = 5$, then ListY could be:
{{0.574953, -3.92776}, {1.15219, -2.60178}, {-0.851673, -2.08292}, 
{-5.36409, 0.645265}, {0.560418, 3.89104}}
  1. If I replace Product[...] with only a real number, it works:
NIntegrate[1, {m1, -1, 1}, {m2, -1, 1},  {m3, -1, 1}, {m4, -1, 
  1}, {m5, -1, 1}, {sigma1, 4, 16}, {sigma2, 4, 16}, {sigma3, 4, 
  16}, {sigma4, 4, 16}, {sigma5, 4, 16}, {w1, w2, w3, w4} \[Element] 
  RegionIntersection[
   ImplicitRegion[w1 + w2 + w3 + w4 <= 1, {w1, w2, w3, w4}],  
   ImplicitRegion[w1 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w2 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w3 >= 0, {w1, w2, w3, w4}], 
   ImplicitRegion[w4 >= 0, {w1, w2, w3, w4}]]]

enter image description here

New contributor
0o0o0o0 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
  • 1
    $\begingroup$ What happens when you evaluate the integrand at a point in the domain? Do you get a number? $\endgroup$ – Michael E2 Jan 14 at 1:09
  • $\begingroup$ What is ListY?. $\endgroup$ – Okkes Dulgerci Jan 14 at 1:11
  • $\begingroup$ Seems I found one of the mistake in my codes.... $\endgroup$ – 0o0o0o0 Jan 14 at 2:49

Your Answer

0o0o0o0 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.