---
title: Simple Linear Regression Analysis | Regression Software
description: This STATBEAN® allows for simple linear regression analysis using Statgraphics. Learn about our regression software and the tools for regression analysis!
---

[![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/simple_regression#anchor3>

# Calculation STATBEANS®

 

**STATBEAN Name:** SimpleRegression

 

**Purpose:** Regression software that fits any of 12 linear and non-linear models to describe the relationship between two numeric variables for simple linear regression analysis.

**Regression Software DataSource:** any. 

**Read/Write Properties For Simple Linear Regression Analysis**

| **Name** | **Type** | **Description** | **Possible Values** | **Default Value** |
| --- | --- | --- | --- | --- |
| includeConstant | boolean | Whether to include a constant term in the model. | true,false | true |
| includeLackOfFit | boolean | Whether to divide the residual sum of squares into lack-of-fit and pure error components. | true,false | false |
| modelType | String | Type of model to be fit. | "Linear", "Exponential", "Reciprocal-Y", "Reciprocal-X", "Double reciprocal", "Logarithmic-X", "Multiplicative", "Square root-X", "Square root-Y", "S-curve", "Logistic", "Log probit" | "Linear" |
| tablewiseExclusion | boolean | Whether all rows of the data table containing a missing value in any column should be excluded from the calculations. | true,false | false |
| xVariableName | String | The name of the column with data values to be used for the independent (X) variable. | Any string. | "X" |
| yVariableName | String | The name of the column with data values to be used for the dependent (Y) variable. | Any string. | "Y" |

**Other Public Methods For Simple Linear Regression Analysis**

| **Name** | **Description** | **Arguments** | **Return Value** |
| --- | --- | --- | --- |
| double getAdjustedRSquared() | Returns the adjusted coefficient of determination. | None. | Adjusted R-squared, or missingValueCode if model cannot be fit. |
| void getCooksDistance(double c\[n\]) | Returns Cook's distance corresponding to each row in the datasource. | Double output array. | None. |
| double getCorrelationCoefficient() | Returns the sample correlation coefficient. | None. | r, or missingValueCode if model cannot be fit. |
| void getDegreesOfFreedom(int df\[5\]) | Returns the degrees of freedom corresponding to the sums of squares. | Double output array. | None. |
| void getDFFITS(double d\[n\]) | Returns the DFFITS statistic corresponding to each row in the datasource. | Double output array. | None. |
| double getDurbinWatson() | Returns the Durbin-Watson statistic. | None. | DW, or missingValueCode if model cannot be fit. |
| double getIntercept() | Returns the estimated intercept. | None. | Estimated intercept, or missingValueCode if model cannot be fit. |
| double getLackOfFitPValue() | Returns the P-value for lack-of-fit test. | None. | P-value. |
| void getLeverages(double h\[n\]) | Returns the leverage corresponding to each row in the datasource. | Double output array. | None. |
| double getLowerConfidenceLimit(double x,double conflevel) | Returns the lower confidence limit for the mean value of Y. | Value of X at which to make prediction, and the percentage confidence. | Lower limit. |
| double getLowerPredictionLimit(double x,double meansize,double conflevel) | Returns the lower prediction limit for a new value of Y. | Value of X at which to make prediction,number of observations at X, and the percentage confidence. | Lower limit. |
| void getMahalanobisDistance(double c\[n\]) | Returns the Mahalanobis distance corresponding to each row in the datasource. | Double output array. | None. |
| double getMeanAbsoluteError() | Returns the residual mean absolute error. | None. | MAE, or missingValueCode if model cannot be fit. |
| double getMeanSquaredError() | Returns the residual mean squared error. | None. | MSE, or missingValueCode if model cannot be fit. |
| double getModelPValue() | Returns the P-value for the fitted model. | None. | P-value. |
| void getPredictedValues(double p\[n\]) | Returns the predicted value of Y corresponding to each row in the datasource. | Double output array. | None. |
| double getPrediction(double x) | Returns the predicted value of Y. | Value of X at which to make prediction. | Predicted value. |
| double getResidualDegreesOfFreedom() | Returns the d.f. for the error term used to estimate the standard errors. | None. | Residual df, or 0 if model cannot be fit. |
| void getResiduals(double r\[n\]) | Returns the residual corresponding to each row in the datasource. | Double output array. | Residual or missingValueCode. |
| double getResidualStandardError() | Returns the estimated standard deviation of the residuals. | None. | Standard error of the estimate, or missingValueCode if model cannot be fit. |
| double getReverseLowerConfidenceLimit(double y,double conflevel) | Returns the value of X for the lower confidence limit at a predicted value of Y. | Predicted value of Y, and the percentage confidence. | Value of X. |
| double getReverseLowerPredictionLimit(double y,double meansize,double conflevel) | Returns the value of X for the lower prediction limit at a predicted value of Y. | Predicted value of Y, number of observations at X, and the percentage confidence. | Value of X. |
| double getReversePrediction(double y) | Returns the value of X associated with a predicted value of Y. | Predicted value of Y. | Value of X. |
| double getReverseUpperConfidenceLimit(double y,double conflevel) | Returns the value of X for the upper confidence limit at a predicted value of Y. | Predicted value of Y, and the percentage confidence. | Value of X. |
| double getReverseUpperPredictionLimit(double y,double meansize,double conflevel) | Returns the value of X for the upper prediction limit at a predicted value of Y. | Predicted value of Y, number of observations at X, and the percentage confidence. | Value of X. |
| double getRSquared() | Returns the coefficient of determination. | None. | R-squared, or missingValueCode if model cannot be fit. |
| double getSlope() | Returns the estimated slope. | None. | Estimated slope, or missingValueCode if model cannot be fit. |
| double getSampleSize() | Returns the number of non-missing data values. | None. | Sample size. |
| double getStandardErrorIntercept() | Returns the standard error for the estimated intercept. | None. | Standard error, or missingValueCode if model cannot be fit. |
| double getStandardErrorSlope() | Returns the standard error for the estimated slope. | None. | Standard error, or missingValueCode if model cannot be fit. |
| void getStudentizedResiduals(double s\[n\]) | Returns the studentized deleted residual corresponding to each row in the datasource. | Double output array. | None. |
| void getSumsOfSquares(double ss\[5\]) | Returns the following sums of squares: total, model, residual, lack-of-fit, pure error. | Double output array. | None. |
| double getUpperConfidenceLimit(double x,double conflevel) | Returns the upper confidence limit for the mean value of Y. | Value of X at which to make prediction, and the percentage confidence. | Upper limit. |
| double getUpperPredictionLimit(double x,double meansize,double conflevel) | Returns the upper prediction limit for a new value of Y. | Value of X at which to make prediction, number of observations at X, and the percentage confidence. | Upper limit. |

**Regression Software Output Variables**

| **Name** | **Description** |
| --- | --- |
| CooksD | Cook's distance corresponding to each row in the datasource. |
| DFFITS | The DFFITS statistic corresponding to each row in the datasource. |
| Leverage | The leverage corresponding to each row in the datasource. |
| MahalanobisD | The Mahalanobis distance corresponding to each row in the datasource. |
| Predicted | The predicted value of Y corresponding to each row in the datasource. |
| Residual | The residual corresponding to each row in the datasource. |
| SResidual | The studentized deleted residual corresponding to each row in the datasource. |

**Regression Software Code Sample** 

//create a datasource bean   
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource(); 

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

//create a calculation bean   
SimpleRegression simpleRegression1 = new STATBEANS.SimpleRegression(); 

//create a table bean   
SimpleRegressionTable simpleRegressionTable1 = new STATBEANS.SimpleRegressionTable(); 

//create a plot bean   
SimpleRegressionPlot simpleRegressionPlot1 = new STATBEANS.SimpleRegressionPlot(); 

//set the columns for the x and y axes   
simpleRegression1.setYVariableName("mpg");   
simpleRegression1.setXVariableName("weight"); 

//make the calculation bean a listener for changes in the FileDataSource bean   
fileDataSource1.addDataChangeListener(simpleRegression1.listenerForDataChange); 

//make the table and plot beans listeners for changes in the calculation bean   
simpleRegression1.addDataChangeListener(simpleRegressionTable1.listenerForDataChange);   
simpleRegression1.addDataChangeListener(simpleRegressionPlot1.listenerForDataChange); 

//instruct the fileDataSource bean to read the file   
fileDataSource1.readData();

[![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)

-  
-          

-  