0

I'm looking to combine multiple different distributions in a mixture probability distribution, where each of the distributions has its own limits, mean and standard deviations.

The aim is to plot something below:

Example Mixture Probability Distribution with Limits at -9 and 20

I've tried using guides on mixture probability distributions from here and from limits with numpy normal distributions here, however, there doesn't appear to be crossover between numpy and scipy packages.

Any guidance on this would be much appreciated!

AlwaysInTheDark
  • 67
  • 1
  • 11

1 Answers1

1

So to clarify your question:

  • Do you consider only Gaussian distributions in your mixture model?
  • Do you want to create a mixture distribution that you can sample from? Or are you only trying to plot the PDF of the mixture distribution?

For the sampling part, the first link you provided seems to give the idea: first sample the index of the sub-distribution in the mixture (with the choice method), then sample your data from this sub-distribution.

Regarding the limits of a given distribution, it seems that it is not straightforward to do in Python. Scipy provides a way to do it for some distributions (as mentioned in your second linked article). Otherwise, you can take a look at this question. Basically, you repeat sampling until you fall into your limits range.

In addition, the .rvs method of the scipy.stats distribution returns numpy arrays, so the libraries are supposed to be easy to combine. What do you mean by "crossover" in this case ?

  • thank you for responding! Yes, I'd like to consider Gaussian distributions, and my intention is to sample from this mixture distribution. I think the resampling makes some sense, however, I was wondering whether there was a more elegant solution whereby the sampling is restricted by the defined PDF so resampling isn't necessary – AlwaysInTheDark Feb 28 '23 at 11:40