(New page: MATLAB has a "[http://www.mathworks.com/access/helpdesk/help/toolbox/stats/mle.html mle]" function for maximum likelihood estimation. I think that this function is useful to verify the re...)
 
Line 1: Line 1:
 
 
MATLAB has a "[http://www.mathworks.com/access/helpdesk/help/toolbox/stats/mle.html mle]" function for maximum likelihood estimation. I think that this function is useful to verify the result of hw2 if you have MATLAB. I try to find the effect of the sample size in MLE using "mle" function because the number of samples is critical for estimation. To do this, I generate samples from normal distribution with mean as 0 and std as 5. The below graph shows the results of MLE according to the number of samples.  
 
MATLAB has a "[http://www.mathworks.com/access/helpdesk/help/toolbox/stats/mle.html mle]" function for maximum likelihood estimation. I think that this function is useful to verify the result of hw2 if you have MATLAB. I try to find the effect of the sample size in MLE using "mle" function because the number of samples is critical for estimation. To do this, I generate samples from normal distribution with mean as 0 and std as 5. The below graph shows the results of MLE according to the number of samples.  
  
 
[[Image:mle_samples.jpg]]
 
[[Image:mle_samples.jpg]]
 +
 +
The code for this graph is like below.
 +
 +
samples_step = 3;
 +
num_samples = samples_step:samples_step:10000;
 +
len = length(num_samples);
 +
mu = 0;
 +
sigma = 5;
 +
muhat = zeros(1, len);
 +
sigmahat = zeros(1, len);
 +
for x = num_samples
 +
    data = mu + sigma * randn(1, x);
 +
    phat = mle(data(1, :));
 +
    muhat(1, x/samples_step) = phat(1);
 +
    sigmahat(1, x/samples_step) = phat(2);
 +
end
 +
plot(num_samples, muhat);
 +
hold on;
 +
plot(num_samples, sigmahat);
  
 
--[[User:Han84|Han84]] 22:49, 2 April 2010 (UTC)
 
--[[User:Han84|Han84]] 22:49, 2 April 2010 (UTC)

Revision as of 18:00, 2 April 2010

MATLAB has a "mle" function for maximum likelihood estimation. I think that this function is useful to verify the result of hw2 if you have MATLAB. I try to find the effect of the sample size in MLE using "mle" function because the number of samples is critical for estimation. To do this, I generate samples from normal distribution with mean as 0 and std as 5. The below graph shows the results of MLE according to the number of samples.

Mle samples.jpg

The code for this graph is like below.

samples_step = 3; num_samples = samples_step:samples_step:10000; len = length(num_samples); mu = 0; sigma = 5; muhat = zeros(1, len); sigmahat = zeros(1, len); for x = num_samples

   data = mu + sigma * randn(1, x);
   phat = mle(data(1, :));
   muhat(1, x/samples_step) = phat(1);
   sigmahat(1, x/samples_step) = phat(2);

end plot(num_samples, muhat); hold on; plot(num_samples, sigmahat);

--Han84 22:49, 2 April 2010 (UTC)

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett