# Re: [R] try to find the MLE of a function

From: Manli Yan <manliyanrhelp_at_gmail.com>
Date: Thu, 19 Jun 2008 02:20:22 -0600

Yes,thats it,thank you guys so much~

2008/6/18 Moshe Olshansky <m_olshansky_at_yahoo.com>:

> Hi,
>
> mle caused me some confusion too.
>
> Anyway, first of all, your x should not contain 0, so make it, let say,
> (1:10)/10.
> Secondly, f should not be the density, but -log(density), so in your case
> it should be
> f <-function(theta) -sum(log(theta) + (theta-1)*log(x))
>
> and finally you must specify a start value, i.e. your call should be
> mle(f,start=list(thetha=1))
>
>
> --- On Thu, 19/6/08, Manli Yan <manliyanrhelp_at_gmail.com> wrote:
>
> > From: Manli Yan <manliyanrhelp_at_gmail.com>
> > Subject: [R] try to find the MLE of a function
> > To: "r-help_at_r-project.org" <r-help_at_r-project.org>
> > Received: Thursday, 19 June, 2008, 1:49 PM
> > Hi everyone:
> > I have a density function
> > f(x|theta)=theta*x^(theta-1),where
> > 0<x<1,0<theta<infinite
> >
> > I want to pratice on R to find the MLE of this
> > function,here is my code:
> > x <- (0:10)/10
> > f<-function(theta) prod(theta*x^(theta-1))
> > mle(f)
> > and r gave me :Error in eval(expr, envir, enclos) :
> > argument is missing,
> > with no default
> >
> > what mistake I just made?and how to add a constraint of
> > theta>0 in my
> > function.
> >
> > Great thanks for your time~
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained,
> > reproducible code.
>

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 Jun 2008 - 09:10:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Jun 2008 - 09:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.