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@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.