CDF for Gaussian Mixture Distribution
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I am ultimately trying to calculate the KS-test statistic for a mixture Gaussian distribution for a data set 'TestData' I have tried to find the appropriate syntax for this but I cannot seem to get it correct. Below is my code with the error messages. I have also included my 1 mixture Gaussian solution as a guide. I didn't think it would be much different. I still think it might not be. Thank you for any help you cn provide.
% Mixture Code:
for j=1:10000 if rand <=0.4 TestData(j) = normrnd(0,2); else TestData(j) = normrnd(10,2); end end
% Fit TestData to Gaussian 2 Mixture Model mpd01 = fitgmdist(TestData, 2);
% Calculate the CDF value for the Mixture Distribution at a given TestData % value test_cdf = [TestData,cdf(TestData,mpd01.mu, mpd01.sigma, mpd01.p)];
% Calculate hypothesis test and p-value for the KS test [h,p] = kstest(test_cdf, 'Alpha', 0.01);
% --------------- Error Message
%No appropriate method, property, or field 'sigma' for class 'gmdistribution'.
%Error in classreg.learning.internal.DisallowVectorOps/subsref (line 21) % [varargout{1:nargout}] = builtin('subsref',this,s);
%Error in BurrTest (line 10) %test_cdf = [TestData,cdf(TestData,mpd01.mu, mpd01.sigma, mpd01.p)]
% Singular Gaussian Code
% Normal Distribution
pd18 = fitdist(TestData,'normal'); test_cdf = [TestData,cdf('normal',TestData,pd18.mu,pd18.sigma)]; [h,p] = kstest(test_cdf, 'Alpha', 0.01); pValKStest(18) = p;
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Hypothesis Tests in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!