[R] Minimizing the negative log likelihood function...

From: François Aucoin <frank.aucoin_at_gmail.com>
Date: Tue, 03 Jun 2008 21:54:02 -0300


Hey,

The following is a function I wrote which generates random variables from a Kappa (2-parameter) distribution.

rkappa <- function(n,beta,alpha){
 if(alpha <= 0)
  stop("alpha must be greater than zero!")  if(beta <= 0)
  stop("beta must be greater than zero!")  Vec <- beta*exp((1/alpha)*(log(-(alpha/(-1 + exp(alpha*log(runif(n,0,1))))))+ alpha*log(runif(n,0,1))))  return(Vec)
}

Now I would like to estimate the parameters of such a distribution using the Maximum likelihood method.
I know that I have to minimize the following negative log likelihood function:

Neg.Log.Like <- function(beta,alpha,x){
 -(sum( log((alpha/beta)*(alpha + (x/beta)^alpha)^( -(alpha + 1)/alpha))))
}

I have tried several R's functions for optimization but the results I yield are not correct.
Is there anybody who can help me?

Thanks!

Francois Aucoin

        [[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 Wed 04 Jun 2008 - 00:57:20 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 Wed 04 Jun 2008 - 13:30:37 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.

list of date sections of archive