[R] help for MLE
Tom Blackwell
tblackw at umich.edu
Wed Feb 25 16:54:56 CET 2004
Edward -
Either optim() or fitdistr() has an additional required
argument which specifies the names (and incidentally starting
values) for the parameters to be estimated. Did you supply
that argument ? See help("optim"), help("fitdistr").
- tom blackwell - u michigan medical school - ann arbor -
On Wed, 25 Feb 2004, Edward Sun wrote:
> 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
>
More information about the R-help
mailing list