Dear R list,
I have a function specifying my log-likelihood, and now I need to set the
constraint that *alpha > kappa*, could anyone help me with setting this in
my function?
the function is defined as follows:
mll <- function(param){
n <- length(x)
psi <- numeric(n)
psi[1] <- 1.0
a0 <- exp(param[1]); a1 <-exp(param[2]); b1 <- exp(param[3]); *alpha *<-
exp(param[4]); *kappa *<- exp(param[5]);
for (i in 2:n) {psi[i] <- a0 + a1*x[i-1] + b1*psi[i-1]}
lam <- gamma(kappa)/gamma(kappa+(1/alpha))
ll <-
n*log(alpha/gamma(kappa))+kappa*alpha*sum(log(x))-n*kappa*alpha*log(lam)-kappa*alpha*sum(log(psi))-lam^(-alpha)*sum((x/psi)^alpha)
return(list(maxl=-ll,vpsi=psi))
}
Thanks in advance!!
Cheers,
Carol
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.