[R] Stratified Maximum Likelihood

Noah Silverman noah at smartmediacorp.com
Sat Oct 31 02:21:38 CET 2009


Hi,

I've search rseek.org high and low and can't seem to find an answer to this.

I want to maximize likelihood for a set of training data, but the data 
is grouped.  (Think multiple trials.)

It would probably be possible to do this with some nested for loops 
manually, but would be painfully slow.

The general formula is this...  (Please excuse my notation, but I can't 
write proper math formulas in an email.)

L(a) = product(
for( trial in 1:length(groups)){
     exp(a * X) / sum(exp(a * X))
}
)

As you can see, a normal logLik function will lose all the group data.  
This seems like a common enough application that there must me some easy 
function in R.

THEN, just to complicate things, I need to run a second logLik with some 
trickier data. There are 14 variables and I need to adjust them all to 
find the maximum likelihood from a formula. (kelly criterion.)

Any suggestions would be gratefully appreciated.

Thanks!




More information about the R-help mailing list