Skip to content

Finding MLE

4 messages · Li Li, Bert Gunter

#
Hi all,
  I am trying to use the mle function in R to find the maximum likelihood
estimator. The ll function below is the negative of the log likelihood.
Suppose x0 is the observed values, I want to find the maximum likelihood
for a and b. After running the code below, I get the error message "Error
in eval(expr, envir, enclos) : argument is missing, with no default".
  Could anyone familiar with this function give some suggetion? Thanks very
much!
     Hanna
+
-sum(log(gamma((n-1)/2+a-1)/(gamma((n-1)/2)*gamma(a))*1/(2*b^a)*(x/2)^((n-1)/2-1)*(1/b+x/2)^(-((n-1)/2+a-1))))}

  
  
#
You do not appear to provide initial values for a and b , i.e. the
"start" argument for mle.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll
On Sun, Nov 2, 2014 at 10:36 AM, li li <hannah.hlx at gmail.com> wrote:
#
Thanks Bert for the reply. I still get a message when adding the start
argument.
+
-sum(log(gamma((n-1)/2+a-1)/(gamma((n-1)/2)*gamma(a))*1/(2*b^a)*(x/2)^((n-1)/2-1)*(1/b+x/2)^(-((n-1)/2+a-1))))}
Error in validObject(.Object) :
  invalid class ?mle? object: invalid object for slot "fullcoef" in class
"mle": got class "list", should be or extend class "numeric"
2014-11-02 14:57 GMT-05:00 Bert Gunter <gunter.berton at gene.com>:

  
  
#
I think I made an error in my funciton. Now it works.


library(stats4)
n <- 8
ll<- function(a,b,x){
-sum(log(gamma((n-1)/2+a-1)/(gamma((n-1)/2)*gamma(a))*1/(2*b^a)*(x/2)^((n-1)/2-1)*(1/b+x/2)^(-((n-1)/2+a-1))))}
fit <- mle(ll, start=list(a=3, b=1), fixed=list(x=c(2,3)))





2014-11-02 22:04 GMT-05:00 li li <hannah.hlx at gmail.com>: