commons-user mailing list archives

Site index · List index
Message view
Top
Subject [math] algorithm to establish value of parameter giving max value of equation
Date Wed, 28 May 2008 18:07:51 GMT

Please excuse my ignorance to begin with, it's been years since my last
mathematics or statistics class in school. I looked through the user
guide on commons.apache.org but I was struggling with the terminology,
and had a hard time figuring out whether I could find what I'm looking for.

Also apologies if this is the wrong list - I'm following the advice on
the commons-math proposal page which said to post here.

I have two equations:

HPR = (( profit_loss / biggest_loss ) * f ) + 1

where HPR = 'holding period return' (percent gain)
profit_loss = dollar win (or loss if negative)
biggest_loss = worst loss (given beforehand)
and f = 'fixed fraction' (to optimize)

TWR = product of all HPRs for a series of profits and losses from a
financial trading or gambling system for value of f

Solving this by "brute force", I would find the value of 'f' by
incrementing up from 0.01 in steps of perhaps 0.01 and solving TWR for
each value until TWR peaks.

Fortunately it will always peak before f reaches 1.0.

Would it be possible to use part of commons-math to do this rather than
writing loops within loops to iterate the profits and losses and then
the f-values?

Best regards