Re: Problems with gmdistribution



Jaime,

GMDISTRIBUTION implements the standard Expectation-Maximization (EM)
algorithm. In some cases, it may converge to a solution which contains
singular or close-singular covariance matrix for one or more components.
Those components usually contains a few data points almost lying in a
lower-dimensional subspace. A solution with singular covariance matrix is
usually considered as spurious. Sometimes, this problem may go away if you
try another set of initial values; Sometimes, this problem will always occur
because of any of the following reasons: (a) The number of dimension of
data is relatively high, but there are not enough observations. (b) Some of
the features(variables) of your data are highly correlated. (c) Some or all
the features are discrete. (d) You try to fit the data to too many
components.
In your case, it seems that the number of components that you used, fifty,
is too big. you can try to reduce the number of components. Generally,
there are also other ways that you can use to avoid getting
"Ill-conditioned covariance matrix" error message"
1. If you don't mind to get solutions with ill-conditioned covariance
matrix, you can use option 'Regularize' in the GMDISTRIBUTION/FIT function
to add a very small positive number to the diagonal of every covariance
matrix.
2. You can specify the value of 'SharedCov' to be true to use equal
covariance matrix for every component.
3 You can specify the value of 'CovType' to be 'diagonal' .



"Jaime Zamora" <jaime.zamora@xxxxxxxxx> wrote in message
news:b536f1bb-283d-4485-b437-0d34cef43ca5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I'm trying to cluster stocks with gaussian clustering. I tried this
code:

function c=generaclusters_gauss(X,k)

options = statset('Display','off');
obj = gmdistribution.fit(X,50,'Options',options);
c = cluster(obj,X);

Where X is the stock matrix (rows: days columns: stocks)

I got this error:
??? Error using ==> gmcluster>gmcluster_learn at 254
Ill-conditioned covariance created at iteration 2.

Error in ==> gmcluster>gmcluster_learn at 254
error('stats:gmdistribution:IllCondCov', ...

Error in ==> gmcluster at 181
[S0,ll0, optimInfo0] = gmcluster_learn...

Error in ==> gmdistribution.fit at 199
[S,NlogL,optimInfo] =...

Is there any workaround to this?

Best Regards,
Jaime


.



Relevant Pages

  • Re: singular covariance matrix Gaussian pdf question
    ... I searched the group and found some message dealing with the singular ... One of which is using pseudo inverse based ... on svd to generate pseudo inversed covariance matrix for the singular ... should I deal with the determinant of the singular matrix which is 0 ...
    (sci.stat.math)
  • Re: Moments over a Simplex
    ... >Han de Bruijn wrote: ... >(singular) covariance matrix, but what do you mean by one scalar variance? ...
    (sci.math)
  • Re: singular covariance matrix Gaussian pdf question
    ... I searched the group and found some message dealing with the singular ... One of which is using pseudo inverse based ... on svd to generate pseudo inversed covariance matrix for the singular ... My question, in order to calculate the Gaussian pdf, how ...
    (sci.stat.math)
  • singular covariance matrix Gaussian pdf question
    ... I searched the group and found some message dealing with the singular ... One of which is using pseudo inverse based ... on svd to generate pseudo inversed covariance matrix for the singular ... My question, in order to calculate the Gaussian pdf, how ...
    (sci.stat.math)
  • Re: Portfolio optimization
    ... stock time series dating back to 1980. ... some of the 50 stocks did not exist in 1980s. ... calculate the covariance matrix of these 50 stocks, ... they are NaN values or zeros, then you can search your data matrix for these ...
    (comp.soft-sys.matlab)