# [jira] Created: (MATH-323) Add Semivariance calculation

26 messages
12
Open this post in threaded view
|

## [jira] Created: (MATH-323) Add Semivariance calculation

 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             Priority: Minor              Fix For: 2.1 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.
Open this post in threaded view
|

## [jira] Updated: (MATH-323) Add Semivariance calculation

 [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Larry Diamond updated MATH-323: -------------------------------     Attachment: StatUtilsTest.java                 StatUtils.java Please find attached the modified StatUtils.java and StatUtilsTest.java classes for semivariance > 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 >            Priority: Minor >             Fix For: 2.1 > >         Attachments: StatUtils.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.
Open this post in threaded view
|

## [jira] Updated: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)      [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Larry Diamond updated MATH-323: -------------------------------     Attachment: patch.txt And here's the patch file as per the Math developers contribution guideline > 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 >            Priority: Minor >             Fix For: 2.1 > >         Attachments: patch.txt, StatUtils.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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791336#action_12791336 ] Phil Steitz commented on MATH-323: ---------------------------------- Looks like a good addition to me.  Will complete review and commit (possibly with some mods) this weekend assuming others are OK with the addition. > 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 >            Priority: Minor >             Fix For: 2.1 > >         Attachments: patch.txt, StatUtils.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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791454#action_12791454 ] Larry Diamond commented on MATH-323: ------------------------------------ Oh my this is embarrassing.  You're right Luc.  I messed up the algo when copying it from my source. When computing the Sortino ratio, you're eliminating the losses - so the code is correct for the Sortino ratio but is not truly semivariance.   For anything below the mean, you should replace the value with the mean for the original distribution.  I had zero adjusted the distribution before I called the method. I'll do a rewrite on this code and reattach it to this issue.  Thank you for reviewing the code!  I am so embarrassed! > 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, StatUtils.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.
Open this post in threaded view
|

## [jira] Updated: (MATH-323) Add Semivariance calculation

Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794740#action_12794740 ] Phil Steitz commented on MATH-323: ---------------------------------- The definition provided here: http://www.jstor.org/pss/2330500 makes sense to me as a "semivariance" measure.  An unbiased estimator would be the sum of the squared deviations from the target of the values below the target divided by the total number of values. > 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.
Open this post in threaded view
|

## [jira] Issue Comment Edited: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794740#action_12794740 ] Phil Steitz edited comment on MATH-323 at 12/28/09 1:03 AM: ------------------------------------------------------------ The definition provided here: http://www.jstor.org/pss/2330500 makes sense to me as a "semivariance" measure.  An unbiased estimator would be the sum of the squared deviations from the target of the values below the target divided by the total number of values minus one.       was (Author: psteitz):     The definition provided here: http://www.jstor.org/pss/2330500 makes sense to me as a "semivariance" measure.  An unbiased estimator would be the sum of the squared deviations from the target of the values below the target divided by the total number of values.   > 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12794944#action_12794944 ] Larry Diamond commented on MATH-323: ------------------------------------ I'm working on a SemiVariance.java class and SemiVarianceTest.java class for the second try on this.   It's a bit different working on code for public reuse than it is working on code for reuse within the firm or for your own use. As regards to the biased vs unbiased thing, I feel that Variance does it right - start it off bias corrected and allow the caller to change it if it's appropriate for their use. There's also an upside standard deviation which is the same thing except you accept only the data elements above the cutoff value. I should have it ready tomorrow > 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795132#action_12795132 ] Phil Steitz commented on MATH-323: ---------------------------------- It might make sense to introduce another boolean constructor parameter to indicate upper- or lower- semivariance.  Assuming that lower semivariance is more common, lower could be the default.   Alternatively, this can always just be computed by subtracting the lower value from the unconditioned variance, so it might not be necessary.  Could always be added later.   > 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795454#action_12795454 ] Larry Diamond commented on MATH-323: ------------------------------------ How do the files I'm about to attach look?  I believe this is the right direction - I still need to hook this into the class hierarchy, write up the documentation, and possibly put in something into the StatUtils class. I went with an independent class that's a peer of Variance.   This code does require Java 5 to build - I hope Math is building that way. > 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.
Open this post in threaded view
|

## [jira] Updated: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)      [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Larry Diamond updated MATH-323: -------------------------------     Attachment: SemiVarianceTest.java                 SemiVariance.java Please find attached the new class for SemiVariance and the testing class.  I'll get going on the remaining items I listed.  Can you please take a look and confirm this is the right direction please? Thank you very much! Larry Diamond (PS - Happy New Year if we dont email before then!) > 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, SemiVariance.java, SemiVarianceTest.java, 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)     [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795553#action_12795553 ] Phil Steitz commented on MATH-323: ---------------------------------- Happy almost New Year to you, Larry! Great progress here.  I like the the less smelly approach to defining upper and lower than a boolean.  I do have a couple of comments: * This class should extend either AbstractStorelessUnivatiateStatistic or AbstractUnivariateStatistic.  The former is for stats that do not require the full array of values to be provided and stored.  I am honestly not sure at this point whether we are going to be able to define increment() methods for this statistic, so it could be AbstractUnivariateStatistic is a better parent.  Once you do this, you can replace your argument checking with calls to the test() method defined in AbstractUnivariateStatistic.  Have a look at how Variance does this. * The cutoff and direction should be optional constructor parameters.  The UnivariateStatistic interface requires that statistics have evaluate methods that require no parameters beyond the input array and subarray indices.  To implement this interface while supporting the other config options, you need to supply the config parameters in constructor arguments. * I am still struggling a little with the definition.  This is why the "documentation goes here" bits would really help ;).  I was assuming that when you use a cutoff value in place of the mean, you compute deviations from the cutoff rather than from the mean.  That would correspond more neatly to the variance decomposition that I thought this statistic was supposed to measure.  If I have this right, you don't need to compute the mean when a cutoff value is provided and deviations should be computed against the cutoff. > 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, SemiVariance.java, SemiVarianceTest.java, 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.
Open this post in threaded view
|

## [jira] Commented: (MATH-323) Add Semivariance calculation

Open this post in threaded view
|

## [jira] Updated: (MATH-323) Add Semivariance calculation

 In reply to this post by Gary D. Gregory (Jira)      [ https://issues.apache.org/jira/browse/MATH-323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Larry Diamond updated MATH-323: -------------------------------     Attachment: SemiVariance.java Hi again.   The class is now documented, hopefully I have made the concept easier to understand.   Most of the work on this class has been documentation, most of the code changes are to ensure the class extends AbstractUnivariateStatistic and fills in any missing methods that AbstractUnivariateStatistic requires. I've broken every last one of my test cases and I need to rework them from scratch now, but I think I'm at a point now where I can post the work for review. > 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, SemiVariance.java, SemiVariance.java, SemiVarianceTest.java, 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.