Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:08:42+00:00 2026-06-01T20:08:42+00:00

I am trying to use Apache Commons Math’s SpearmansCorrelation but I am having some

  • 0

I am trying to use Apache Commons Math’s SpearmansCorrelation but I am having some difficulty as I do not have enough background in mathematics/statistics.

I have researched Spearman’s Rank Correlation from:

  • https://statistics.laerd.com/statistical-guides/spearmans-rank-order-correlation-statistical-guide-2.php
  • http://geographyfieldwork.com/SpearmansRank.htm

I have found the following examples:

  • http://www.devdaily.com/java/jwarehouse/commons-math/src/main/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java.shtml
  • http://www.devdaily.com/java/jwarehouse/commons-math/src/test/java/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java.shtml
  • http://www.androidadb.com/class/na/NaturalRanking.html

I would like to calculate the correlation between two lists of my class:

public class TestClass{
    int rank; // there may be two or more classes with the same rank - will need an averaging ties strategy
}

From which I have deduced the following:

NaturalRanking naturalRanking = new NaturalRanking(NaNStrategy.FIXED,
        TiesStrategy.AVERAGE);

RealMatrix dataMatrix= createRealMatrix(double[], int, int); // what do I need this matrix for and what parameters do I need to pass?

SpearmansCorrelation sc = SpearmansCorrelation(dataMatrix, naturalRanking);
sc.correlation(double[],double[]);// I have to convert my class into a list of doubles? How? 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:08:42+00:00Added an answer on June 1, 2026 at 8:08 pm

    For the example found in the link you provided, all you need to do is:

    new SpearmansCorrelation().correlation(mathsList,englishList);
    

    The class will average ties by default.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use GLSMultipleLinearRegression (from apache commons-math package) for multiple linear regression.
Ok so I'm trying to use Apache Commons Math library to compute a double
I am trying to use org.apache.commons.collections.CollectionUtils in android with following code import java.util.ArrayList; import
I am trying to figure out how to use Apache Commons IO DirectoryWalker .
I'm trying to use the StringEscapeUtils.escapeXML() function from org.apache.commons.lang... There are two versions of
I'm trying to use VFS S3 a plugin for the Apache Commons VFS for
I'm trying to use Apache Commons Net for FTP file transfers. Problem is files
I am trying to fill a RealVector (from Apache Commons Math) with values. I
We're trying to use Apache Commons VFS to access something over SFTP. It claims
I am trying to use org.apache.commons.collections.CollectionUtils in Android. The sample is below import java.util.ArrayList;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.