[R] maximizing log-likelihood function
Christian Schulz
ozric at web.de
Wed Sep 29 16:39:06 CEST 2004
Hello,
I know that i have to use optim, but i'm confused how its
possible maximize the sum over all l[i] and get the optimized
r and alpha?
LL <- function(trans,time){
for(i in 1:length(trans){
l[i] <- log(lgamma(r+trans[i] -
gamma(r+1)*(alpha/alpha+t[i]))**r)*(t[i]/alpha+t[i])**trans[i]
}
return(sum(l))
}
i'm confused how i have to set r and alpha
and i found no related help in archives?
...in Excel it works with solver but only for ~65.000 rows :-)
#This notation is 1 for trans and 1 for time insteda the Startvalues for r
and alpha?
optim(c(1,1),-LL)
many thanks for an easy example or hint
regards,christian
More information about the R-help
mailing list