MATLAB: Why change in mean and covariance doesnot effect gmdistribution

gaussian distributionpdf

Hello,
Below I have given 5 points. In each point mu, sigma and mixp is given. Gmdistribution is calculated for each . Changing of mu and sigma values do not make any change in the answer. But if I change the mixp values then the distribution value changes. Why does the change in mean and sigma doesnot affect the gmdistribution?
1. mu = [1 2;-3 -5]; Sigma = [2 0; 0 .5],[1 0; 0 1]; mixp = ones(1,2)/2; gm = gmdistribution(mu,Sigma,mixp) ans= Sigma = 2.0000 0 0 0.5000 gm = Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.500000 Mean: 1 2
Component 2: Mixing proportion: 0.500000 Mean: -3 -5
2. I have changed the value of mixp
mu = [1 2;-3 -5]; Sigma = [2 0; 0 .5],[1 0; 0 1]; mixp = ones(1,2); gm = gmdistribution(mu,Sigma,mixp) ans= Sigma = 2.0000 0 0 0.5000 gm = Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.500000 Mean: 1 2
Component 2: Mixing proportion: 0.500000 Mean: -3 -5
3. I have changed the value of mixp again
mu = [1 2;-3 -5]; Sigma = [2 0; 0 .5],[1 0; 0 1]; mixp = [3 4]; gm = gmdistribution(mu,Sigma,mixp) ans= Sigma = 2.0000 0 0 0.5000 gm = Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.428571 Mean: 1 2
Component 2: Mixing proportion: 0.571429 Mean: -3 -5
4. I have changed the value of sigma. The mixing proportion remains the same as above.
mu = [1 2;-3 -5]; Sigma = [8 0; 0 .5],[1 0; 0 1]; mixp = [3 4]; gm = gmdistribution(mu,Sigma,mixp) Sigma = 8.0000 0 0 0.5000 gm = Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.428571 Mean: 1 2
Component 2: Mixing proportion: 0.571429 Mean: -3 -5 5. I have changed the value of mean but the mixing proportion doesnot change.
mu = [7 2;-3 -5]; Sigma = [8 0; 0 .5],[1 0; 0 1]; mixp = [3 4]; gm = gmdistribution(mu,Sigma,mixp)
Sigma =
8.0000 0
0 0.5000
gm =
Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.428571 Mean: 7 2
Component 2: Mixing proportion: 0.571429 Mean: -3 -5
Thanks,
Nidhi

Best Answer

There are two ways to create a gmdistribution. One is by specifying the mean, covariance, and mixing proportion. The result is a distribution with the parameters you specified. That seems to be what is happening in your case. The resulting objects have the means that you specify. The mixing proportions are also the same as the ones you provided, but they are normalized to sum to 1 (so they are real proportions, not just relative sizes.
The other way is to fit to data using the gmdistribution.fit function.
So what is confusing about the output you quote? It may be the normalization of the mixing proportions. My only other idea is that you seem to be trying to specify two covariance matrices, but that's not working. You have
Sigma = [8 0; 0 .5],[1 0; 0 1];
This is actually two statements, one assigning a 2-by-2 matrix to Sigma and the other simply creating a second matrix and discarding it. You may be intending this:
>> Sigma = cat(3,[8 0; 0 .5],[1 0; 0 1])
Sigma(:,:,1) =
8.0000 0
0 0.5000
Sigma(:,:,2) =
1 0
0 1