[R-SIG-Finance] Grouped Log Likelihood function??

Noah Silverman noah at smartmediacorp.com
Mon Nov 2 18:49:36 CET 2009


Hi,

I'm still fairly new to R and this is my first time posting to this group.

I've searched 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(i) * X) / sum(exp(a(i) * 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 on entries 
in a portfolio.)

Any suggestions would be gratefully appreciated.

Thanks!



More information about the R-SIG-Finance mailing list