How to perform the maximum like ratio test?
2 views (last 30 days)
Show older comments
Hi,
I have to test if my data have a gaussian or a double gaussian behaviour with the MAXIMUM LIKELIHOOD RATIO TEST. I have a problem defining a double gaussian and use it as a pdf. The data are composed by an histogram. I normalized it so that the integral is <=1 Below a possible code:
>> data_norm = normrnd(0,1,1000,1);
>> data = hist(data_norm,14);
>> x = 1:14;
>> figure;
>> plot(x,data);
>> data = data/sum(data); % normalize to unit length. Sum of h now will be 1.
>> figure;
>> plot(x,data)
>> Gauss_mle = mle(data);
>> Double_gauss_pdf=@(sigma1,mu1,sigma2,mu2) ((1/sqrt(2*pi*sigma1^2)*exp((x-mu1).^2/(2*sigma1^2))+1/sqrt(2*pi*sigma2^2)*exp((x-mu2).^2/(2*sigma2^2))));
>> Double_gauss_mle = mle(data,'pdf',Double_gauss_pdf,'start',[0;1;0;1]);
When I compute Double_gauss_mle it gives me:
Error using mlecustom (line 166)
Error evaluating the user-supplied pdf function '@(sigma1,mu1,sigma2,mu2)((1/sqrt(2*pi*sigma1^2)*exp((x-mu1).^2/(2*sigma1^2))+1/sqrt(2*pi*sigma2^2)*exp((x-mu2).^2/(2*sigma2^2))))'.
Error in mle (line 229) phat = mlecustom(data,varargin{:});
Caused by:
Error using @(sigma1,mu1,sigma2,mu2)((1/sqrt(2*pi*sigma1^2)*exp((x-mu1).^2/(2*sigma1^2))+1/sqrt(2*pi*sigma2^2)*exp((x-mu2).^2/(2*sigma2^2))))
Too many input arguments.
I also do not know exactly how to proceed once I have the maximum likelihood estimate.
Thank you in advance.
0 Comments
Answers (0)
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!