commons-issues mailing list archives

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

    [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793669#action_12793669
] 

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: https://issues.apache.org/jira/browse/MATH-323
>             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, StatUtils.java, StatUtils.java, StatUtilsTest.java,
StatUtilsTest.java
>
>
> 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 http://en.wikipedia.org/wiki/Semivariance ,
but a real reason you would use them is in finance in order to compute the Sortino ratio rather
than the Sharpe ratio.
> http://en.wikipedia.org/wiki/Sortino_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
site.
> The only two files I've modified is src/main/java/org/apache/commons/stat/StatUtils.java
and src/test/java/org/apache/commons/math/stat/StatUtilsTest.java

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


Mime
View raw message