---
title: Correlation In Statistics | Correlation Analysis Software
description: See how Statgraphics can help compute correlation in statistics and rank correlation data. Learn how Statgraphics functions as correlation analysis software!
---

[![Statgraphics 19 logo](https://www.statgraphics.com/hs-fs/hubfs/stat19plain-01-1.png?width=2272&height=484&name=stat19plain-01-1.png "Statgraphics 19 logo")](https://www.statgraphics.com)

- [Products](https://www.statgraphics.com/product)
- [Learn](https://www.statgraphics.com/statistics-library)
- [Training](https://www.statgraphics.com/training-and-consulting)

- [Product](https://www.statgraphics.com/product) 
    - [Centurion XVIII](https://www.statgraphics.com/centurion-xvii)
    - [Sigma Express](https://www.statgraphics.com/statgraphics-sigma-express)
    - [Online](https://www.statgraphics.com/statgraphics-stratus)
    - [Web Services](https://www.statgraphics.com/statgraphics-web-services)
- [Learn](https://www.statgraphics.com/statistics-library) 
    - [Statistics Library](https://www.statgraphics.com/statistics-library)
    - [Six Sigma & Lean](https://www.statgraphics.com/six-sigma-lean)
    - [Instructional Videos](https://www.statgraphics.com/instructional-videos)
    - [Applications/ Case Studies](https://www.statgraphics.com/application)
- [Training & Consulting](https://www.statgraphics.com/training-and-consulting) 
    - [Statpoint Seminars](https://www.statgraphics.com/statpoint-seminar)
    - [Statpoint Instructors](https://www.statgraphics.com/statpoint-instructor)
    - [Training Partners](https://www.statgraphics.com/training-partners)
    - [Webinars](https://www.statgraphics.com/webinars)
- [Support](https://www.statgraphics.com/customer-support-overview)
- [Blog](https://www.statgraphics.com/blog)
- [Store](http://store.statgraphics.com)

### Statgraphics

## [Centurion](https://www.statgraphics.com/centurion-overview)

#### [LEARN MORE](https://www.statgraphics.com/centurion-overview)

### Statgraphics

## [Sigma *express*](https://www.statgraphics.com/statgraphics-sigma-express)

#### [LEARN MORE](https://www.statgraphics.com/statgraphics-sigma-express)

### Statgraphics

## [*Stratus*](https://www.statgraphics.com/statgraphics-stratus)

#### [LEARN MORE](https://www.statgraphics.com/statgraphics-stratus)

### Statgraphics

## [Web Services](https://www.statgraphics.com/statgraphics-web-services)

#### [LEARN MORE](https://www.statgraphics.com/statgraphics-web-services)

## [Statistics Library](https://www.statgraphics.com/statistics-library)

#### [LEARN MORE](https://www.statgraphics.com/statistics-library)

## [Six Sigma & Lean](https://www.statgraphics.com/six-sigma-lean)

#### [LEARN MORE](https://www.statgraphics.com/six-sigma-lean)

## [Instructional Videos](https://www.statgraphics.com/instructional-videos)

#### [LEARN MORE](https://www.statgraphics.com/instructional-videos)

## [Applications/ Case Studies](https://www.statgraphics.com/statistical-applications)

#### [LEARN MORE](https://www.statgraphics.com/statistical-applications)

## [Statgraphics Seminars](https://www.statgraphics.com/statpoint-seminar)

#### [LEARN MORE](https://www.statgraphics.com/statpoint-seminar)

## [Statgraphics Instructors](https://www.statgraphics.com/statpoint-instructor)

#### [LEARN MORE](https://www.statgraphics.com/statpoint-instructor)

## [Training Partners](https://www.statgraphics.com/public-seminar)

#### [LEARN MORE](https://www.statgraphics.com/public-seminar)

## [Webinars](https://www.statgraphics.com/webinars)

#### [LEARN MORE](https://www.statgraphics.com/webinars)

#### Statbeans

- [STATBEANS® Overview](https://www.statgraphics.com/statbeans)
- [DataSource STATBEANS®](https://www.statgraphics.com/statbeans_datasource)
- [Calculation STATBEANS®](https://www.statgraphics.com/statbeans_calculations)
- [Tabular STATBEANS®](https://www.statgraphics.com/statbeans_tabular)
- [Graphical STATBEANS®](https://www.statgraphics.com/statbeans_graphical)

[Back to Product Overviews](https://www.statgraphics.com/product)

<https://www.statgraphics.com/statbeans/calculations/correlations#anchor3>

# Calculation STATBEANS®

 

**STATBEAN Name:** Correlations

 

******Purpose:** Let's Statgraphics function as correlation analysis software to calculate correlation in statistics. Computes product-moment and rank correlation coefficients between pairs of numeric columns.

**DataSource: **Any. 

**Correlation Analysis Software Read/Write Properties******

| **Name** | **Type** | **Description** | **Possible Values** | **Default Value** |
| --- | --- | --- | --- | --- |
| columnNames | String array | The names of the columns to be analyzed. | One or more strings. | {""} |
| computeRankCorrelations | boolean | Whether to compute rank correlations as well as product-moment correlations. | true,false | false |
| missingValueExclusion | String | The method for handling records which contain missing values. | "Columnwise","Casewise", "Tablewise" | "Columnwise" |

  
******Other Public Methods For Correlation In Statistics******

| **Name** | **Description** | **Arguments** | **Return Value** |
| --- | --- | --- | --- |
| double getCorrelation(int columnNumber,int rowNumber) | Returns product-moment correlation. | Column number, row number (0 origin). | Estimated correlation, or missingValueCode if n<2. |
| double getPValue(int columnNumber,int rowNumber) | Returns P-value for two-sided test of null hypothesis that correlation = 0. | Column number, row number (0 origin). | P-value. |
| double getRankCorrelation(int columnNumber,int rowNumber) | Returns Spearman rank correlation. | Column number, row number (0 origin). | Estimated correlation, or missingValueCode if n<2. |
| double getRankPValue(int columnNumber,int rowNumber) | Returns P-value for two-sided test of null hypothesis that rank correlation = 0. | Column number, row number (0 origin). | P-value. |
| int getNumberOfVariables() | Returns number of columns. | None. | Number of columns (and rows). |
| int getSampleSize(int columnNumber,int rowNumber) | Returns number of pairs of data values used to calculate correlation. | Column number, row number (0 origin). | n |

**Correlation Analysis Software Code Sample** 

//create a filedatasource bean   
FileDataSource fileDataSource1 = new FileDataSource(); 

//set the file name   
fileDataSource1.setFileName("c:\\\\statbeans\\\\samples\\\\cardata.txt"); 

//create a calculation bean   
Correlations correlations1 = new Correlations(); 

//set missing value handling   
correlations1.setMissingValueExclusion("Columnwise"); 

//set the column names   
String\[\] temp = new String\[5\];   
temp\[0\] = new String("mpg");   
temp\[1\] = new String("weight");   
temp\[2\] = new String("horsepower");   
temp\[3\] = new String("displace");   
temp\[4\] = new String("price");   
correlations1.setColumnNames(temp); 

//create a table bean   
CorrelationsTable correlationsTable1 = new CorrelationsTable(); 

//set table size   
correlationsTable1.setScaleRowsToFit(false);   
correlationsTable1.setScaleColumnsToFit(false);   
correlationsTable1.setNumberOfRowsInDisplay(15);   
correlationsTable1.setNumberOfColumnsInDisplay(5); 

//prevent some rows and columns from scrolling   
correlationsTable1.setHoldRows(3);   
correlationsTable1.setHoldColumns(1); 

//add the table to the display panel   
add(correlationsTable1); 

//register the calculation StatBean as a listener to the datasource   
fileDataSource1.addDataChangeListener(correlations1.listenerForDataChange); 

//register the table StatBean as a listener to the calculation StatBean   
correlations1.addDataChangeListener(correlationsTable1.listenerForDataChange); 

//read the file   
fileDataSource1.readData(); 

//notify all listeners   
fileDataSource1.updateListeners();

[![contact-icon](https://www.statgraphics.com/hs-fs/hubfs/stat19web/sales.png?width=50&name=sales.png "contact-icon.fw")](https://www.statgraphics.com/contact-us-dealers-global-partners)

### [CONTACT SALES](https://www.statgraphics.com/contact-us-dealers-global-partners)

Contact our Sales team today

[![youtube-icon.fw](https://www.statgraphics.com/hubfs/stat19web/watchr.png)](https://www.statgraphics.com/instructional-videos)

### [WATCH A VIDEO](https://www.statgraphics.com/instructional-videos)

Learn more about the many enhancements added to Version 19

[![download](https://www.statgraphics.com/hubfs/stat19web/downloadr.png)](https://www.statgraphics.com/download18)

### [DOWNLOAD TRIAL](https://www.statgraphics.com/download19)

Try Statgraphics 19 today for free!

[![eye icon](https://www.statgraphics.com/hubfs/stat19web/viewr.png)](https://www.statgraphics.com/download-brochure-0)

### [VIEW BROCHURE](https://www.statgraphics.com/download-brochure-0)

Discover Statgraphics 19 with our product brochure.

![contact us](https://www.statgraphics.com/hubfs/stat19web/contactr.png)

© 2025 Statgraphics Technologies, Inc.

The Plains, Virginia

[CONTACT US](https://www.statgraphics.com/contact-us-partner)

![Statgraphics download center](https://www.statgraphics.com/hs-fs/hubfs/stat19web/downloadcr.png?width=50&name=downloadcr.png)

Have you purchased Statgraphics Centurion or Sigma Express and need to download your copy?

[CLICK HERE](https://www.statgraphics.com/download-center)

- [Support](https://www.statgraphics.com/customer-support-overview)
- [Company](https://www.statgraphics.com/contact-us-dealers-global-partners)
- [Blog](https://blog.statgraphics.com)

-  
-          

-  