how to model multivariate normal distribution in matlab?
Show older comments
I have a data set of ut, control input which i would like to model it as a mixture with K component Gaussian densities. p(ut) = sum(pi*(N(ut;mean;covariance)). Sum from 1 to the K. Pi is the mixing parameter. N denotes the multivariate normal density function. With only data set ut, i have to estimate the mean, covariance and the mixing parameter with expectation maximisation algorithm. Below is the code that i wrote trying to model it. i wonder if they are correct or did i miss out anything?
obju = gmdistribution.fit(U1',K,'SharedCov',true,'CovType','diagonal');
sigmau = obju.Sigma;
muu = obju.mu;
pu=0;
for k=1:T-m
pu = mvnpdf(U1(:,k),muu(1),sigmau)+mvnpdf(U1(:,k),muu(2),sigmau)+pu;
end
Answers (1)
Peter Perkins
on 27 Nov 2012
0 votes
Wei, unless you want to evaluate each component's pdf separately, I think you want to use the pdf method of the gaussian mixture distribution that you've created with gmdistributin.fit:
Hope this helps.
1 Comment
Wei Cai Law
on 28 Nov 2012
Edited: Wei Cai Law
on 28 Nov 2012
Categories
Find more on Gaussian Mixture Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!