Skip to content

help for MLE

3 messages · Edward Sun, Andy Bunn, Spencer Graves

#
Dear Sir/Madam,

I am using R version 1.8.1. I am doing following tast:

First generate 100 Gaussion(3,1) numbers, then write the likelihood function 
to estimate the parameters of Gaussian distribution by direct maximizing the 
likelihood function.

My likelihood function is:
After I input above function, the '' >'' turned to be '' + ''. and it did 
not work.

I am looking for the help to solve this tast by writting a likelihood 
function.

Thanks a lot.

Best regards.
edward sun
#
I fear you have a problem with your parentheses. The '>' sign turns to a
'+' when the line is incomplete. See the R-FAQ for information. This
evaluates but I'm not sure if it's what you want....

fn < -function(x){
 
(-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(sum((x-(mea
n(x))^2)))
}


fn(1:10)


HTH, Andy
#
Is this a homework problem? 

      The "+" means the statement is not syntactically complete.  
Perhaps you have more "(" than ")"? 

      Also, have you read "the posting guide! 
http://www.R-project.org/posting-guide.html"?  Many people answer their 
own questions just following that guide. 

      spencer graves
Edward Sun wrote: