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

2008-06-04 Thread Karl Ove Hufthammer
François Aucoin: > I have tried several R's functions for optimization but the results I > yield are not correct. > Is there anybody who can help me? I couldn't get it to estimate the correct values either, so I guess either your random number generator 'rkappa' is wrong, or your 'Neg.Log.Like' f

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

2008-06-03 Thread François Aucoin
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(