[R] help for MLE

Liaw, Andy andy_liaw at merck.com
Wed Feb 25 17:27:16 CET 2004


Do:

library(mle)
?mle

and read the documentation and the example.  That should get you on the
right track.

Andy


> From: Edward Sun
> 
> 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.
> >-------------------------------------------------------------
> -----------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list