commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Commented: (MATH-323) Add Semivariance calculation
Date Tue, 22 Dec 2009 16:52:29 GMT


Phil Steitz commented on MATH-323:

First, thanks for the patch.   I am having a hard time validating the computing formula, based
on the description in the references.  The formula provided in the Wikipedia reference appears
to be different from what the patch is computing.   That is OK if what we want to compute
is something different.  We can provide the formula directly in the javadoc.  But if there
is a standard formula, we should try to implement something equivalent.

If the intent is to estimate the Sortino ratio, it would seem to me that the values above
the mean should be excluded, rather than collapsed to the mean.  If I understand correctly
what the code is trying to compute, these values should be excluded, not recoded.  The Sortino
ratio also would seem to require another parameter - the "target" return value.  I guess this
is why in your application you shift the mean to zero?  

Thanks again for the patch and sorry for the delay reviewing it. 

Two comments on the code in the latest patch:
1)  the mean() function (actually the Mean statistic) will perform the array bounds check,
so if you move that outside the if statement, you can eliminate the test function.
2)  If this is a widely used statistic and/or the computation becomes any more involved than
the patch, we should implement a UnivariateStatisic class to represent it.

> Add Semivariance calculation
> ----------------------------
>                 Key: MATH-323
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Larry Diamond
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.1
>         Attachments: patch.txt, patch2.txt,,,,
> I've added semivariance calculations to my local build of commons-math and I would like
to contribute them.
> Semivariance is described a little bit on ,
but a real reason you would use them is in finance in order to compute the Sortino ratio rather
than the Sharpe ratio.
> gives an explanation of the Sortino ratio
and why you would choose to use that rather than the Sharpe ratio.  (There are other ways
to measure the performance of your portfolio, but I wont bore everybody with that stuff)
> I've already got the coding completed along with the test cases and building using mvn
> The only two files I've modified is src/main/java/org/apache/commons/stat/
and src/test/java/org/apache/commons/math/stat/

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message