Fitting Bimodal/Unimodal Distributions in MATLAB

  • MATLAB
  • Thread starter Lobotomy
  • Start date
  • Tags
    Distributions
In summary, the conversation involves finding a distribution that fits a worker's operation, which includes the tasks of sewing pockets and batching them. The data appears to have two distinct modes and the speaker is unsure how to fit a distribution to it in MATLAB. The function gmdistribution is mentioned but it is only for bivariate Gaussian distributions with two modes. The speaker also inquires about a generalized or lognormal version of this function. They mention using polynomial regression to fit an odd distribution but warn against using too many terms. The speaker is ultimately looking for a distribution to use in a computer simulation of the worker's operation. They discuss using a bimodal distribution and iterating between modes, as well as using one distribution for the operation and adding in
  • #1
Lobotomy
58
0
i have some values that seems to have 2 modes and i don't know how to fit a distribution to them in matlab. Does MATLAB have any function for fitting bimodal/unimodal distributions?

edit: it seems like the function gmdistribution have something to do with it but this only concerns gaussian distributions with 2 modes. is there a generalized version or more specifically lognormal version of this?
 
Last edited:
Physics news on Phys.org
  • #2
Lobotomy said:
i have some values that seems to have 2 modes and i don't know how to fit a distribution to them in matlab. Does MATLAB have any function for fitting bimodal/unimodal distributions?

edit: it seems like the function gmdistribution have something to do with it but this only concerns gaussian distributions with 2 modes. is there a generalized version or more specifically lognormal version of this?

My gmdistribution is for bivariate Gaussian distributions. A strongly bimodal distribution may result from data from two overlapping Gaussian populations, in which case they should be disaggregated and described separately. For this, it's best to go back to the original data.

If the data is naturally strongly bimodal, then it can't (and shouldn't) be normalized. What are you trying to do? You can fit any odd distribution with polynomial regression. However, you have to be careful not to enter too many terms in the equation, or it will be too sensitive to the specific data to be meaningful.

EDIT: If you want to use gmdistribution, it seems you need the parameters of the individual components of the Gaussian mixture to begin with, but I don't know for sure. I haven't used it.
 
Last edited:
  • #3
SW VandeCarr said:
My gmdistribution is for bivariate Gaussian distributions. A strongly bimodal distribution may result from data from two overlapping Gaussian populations, in which case they should be disaggregated and described separately. For this, it's best to go back to the original data.

If the data is naturally strongly bimodal, then it can't (and shouldn't) be normalized. What are you trying to do? You can fit any odd distribution with polynomial regression. However, you have to be careful not to enter too many terms in the equation, or it will be too sensitive to the specific data to be meaningful.

EDIT: If you want to use gmdistribution, it seems you need the parameters of the individual components of the Gaussian mixture to begin with, but I don't know for sure. I haven't used it.


im trying to find a distribution that fits a worker operation. It is a worker doing a task for instance sewing a pocket on a jacket and every n:th jacket he has sewn he batches them and moves them. n is not a fixed number i.e. batch sizes vary a bit.

so there will be one mode for the mean time of sewing one pocket, and a smaller mode for the mean time of batching.

the pocket sewing operation is lognormally distributed, i think the batching process is as well. and i want to describe the entire process with a distribution which will be used in a computer simulation
 
  • #4
=Lobotomy;2675432]im trying to find a distribution that fits a worker operation. It is a worker doing a task for instance sewing a pocket on a jacket and every n:th jacket he has sewn he batches them and moves them. n is not a fixed number i.e. batch sizes vary a bit.

so there will be one mode for the mean time of sewing one pocket, and a smaller mode for the mean time of batching.

the pocket sewing operation is lognormally distributed, i think the batching process is as well. and i want to describe the entire process with a distribution which will be used in a computer simulation

If your parameter is mean time for each operation, then it seems you have two distinct unmixed distributions. However if your time line is for total throughput, you would probably have some overlap at some point after zero time in a region where some pockets are being sewed, while others are being batched. This seems to be the kind of bivariate mixed Gaussian distribution for which gmdistribution is useful since you have the parameters for both the sewing and batching distributions.

As for additional modes, you could probably iterate the process forward between the second mode and a third mode, etc.

Again, I remind you, I haven't actually used this application.
 
Last edited:
  • #5
SW VandeCarr said:
If your parameter is mean time for each operation, then it seems you have two distinct unmixed distributions. However if your time line is for total throughput, you would probably have some overlap at some point after zero time in a region where some pockets are being sewed, while others are being batched. This seems to be the kind of bivariate mixed Gaussian distribution for which gmdistribution is useful since you have the parameters for both the sewing and batching distributions.

As for additional modes, you could probably iterate the process forward between the second mode and a third mode, etc.

Again, I remind you, I haven't actually used this application.


what i measure is the time between output. So the time between output could be

10 11 12 9 11 11 8 13 34 10 9 etc etc

where the 34 is when a batching occurs.


so do you think a better idea is to take one distribution for the operation and using that for simulation of time. and for every n:th element you add another time taken from the batch distribution??

this will be more complicated to program i guess. the best solution for me would be to simulate the time for the operation and batching as taken from one bimodal distribution
 
  • #6
Lobotomy said:
you think a better idea is to take one distribution for the operation and using that for simulation of time. and for every n:th element you add another time taken from the batch distribution??

this will be more complicated to program i guess. the best solution for me would be to simulate the time for the operation and batching as taken from one bimodal distribution

Well, the latter seemed to be what you were aiming for. Both would provide useful information for an operations manager.
 
  • #7
SW VandeCarr said:
Well, the latter seemed to be what you were aiming for. Both would provide useful information for an operations manager.


yes, so how can i fit a bimodal distribution to the above measurements?

i can fit a mixed gaussian distribution to my measurements with the gmdistribution, but this is not so correct since the distributions are not gaussian. i would assume that a bimodal lognormal distribution would fit better, and the question is therefore is there a way in MATLAB to fit measurements to a bimodal lognormal distribution.
 
  • #8
Lobotomy said:
yes, so how can i fit a bimodal distribution to the above measurements?

It shouldn't be a problem if they're lognormal. You'll be fitting the curve to a log scale on the x axis. All stat packages can do that. You've already got the parameters.
 
  • #9
SW VandeCarr said:
It shouldn't be a problem if they're lognormal. You'll be fitting the curve to a log scale on the x axis. All stat packages can do that. You've already got the parameters.

well it sounds simple when you say it but i don't know how to (im no master at MATLAB either by the way)

so if x is your vector with measurements. which MATLAB commands would you use to fit a distribution and get the parameters for it to be more specific?
 

Related to Fitting Bimodal/Unimodal Distributions in MATLAB

1. How do I determine if my data follows a bimodal or unimodal distribution?

To determine if your data follows a bimodal or unimodal distribution, you can create a histogram or a probability plot in MATLAB. If there are two distinct peaks in the histogram or a clear curve in the probability plot, then your data may follow a bimodal distribution. If there is only one peak or no clear curve in the probability plot, then your data may follow a unimodal distribution.

2. What are the key differences between bimodal and unimodal distributions?

The key difference between bimodal and unimodal distributions is the number of peaks in the data. Bimodal distributions have two distinct peaks, while unimodal distributions have only one peak. Bimodal distributions also tend to have a larger variance compared to unimodal distributions.

3. How can I fit a bimodal or unimodal distribution to my data in MATLAB?

In MATLAB, you can use the fitdist function to fit a probability distribution to your data. To fit a bimodal distribution, you can use the bimodal distribution option, and for a unimodal distribution, you can use options such as normal, lognormal, or exponential.

4. What is the significance of fitting a bimodal or unimodal distribution to my data?

Fitting a bimodal or unimodal distribution to your data can help you understand the underlying patterns and characteristics of your data. It can also be useful for making predictions and identifying outliers in your data. Additionally, it can help you choose appropriate statistical tests and models for further analysis.

5. Can I visualize the fitted bimodal or unimodal distribution in MATLAB?

Yes, you can use the pdfplot function in MATLAB to visualize the fitted distribution. This function plots the probability density function of the fitted distribution, along with the histogram of your data. You can also use the cdfplot function to visualize the cumulative distribution function of the fitted distribution.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
917
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • General Math
Replies
6
Views
929
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
4K
Back
Top