Hi, when I write the likelihood function as
fn<-function(x) -50*log(2*pi)-100*log(sigma)-(1/2*(sum((x-mu)/sigma)^2))
then what should I do since it shows that Error in log(sigma) : Object "sigma" not found. Thanks edward
From: Edward Sun 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:
fn<-function(x) (-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(
sum((x-(mean(x))^2)) 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
------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. ------------------------------------------------------------------------------