Skip to content

for help about MLE in R

2 messages · Edward Sun, Peter Dalgaard

#
Dear Sir,

I am using R to estimate two parameters in Normal distribution. I generated 
100 normal distributed numbers, on which to estimate the parameter. The 
syntax is:
but it does not work. Could you please help me to compose the syntax for the 
purpose that find maximum likelihood estimates of the generated random 
numbers by direct maximization of the likelihood function?

Thanks a lot.

Best regards
Edward Sun
#
"Edward Sun" <edwardweisun at hotmail.com> writes:
Apologies if this wasn't a homework question, but

a) That is not the likelihood function. Try fn(0). What is the z doing
in there? The log((y)^2) makes the whole thing vector valued, which
you do not want. Get this right first and perhaps do a plot of the
function values.

b) Second argument to nlm is supposed to be a starting value for the
parameter (e.g., 0.5), and you seem to be thinking differently. Also
note that you are feeding the log-likelihood to a *minimizer*.