SPLREG

Scatterplot linear regression equation


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example

Back to top

Description


SPLREG calculates the coefficients of a first-order linear regression equation which relates gray-level values in two image layers.
Back to top

Parameters


splreg(file, dbic, mask, imstat)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBIC * List[int] Input raster channel(s) 2 - 2 1 -
MASK List[int] Area mask 0 - 4  
IMSTAT List[float] Image Statistics 0 - 5  

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the PCIDSK image file containing image channels for which the linear regression equation is calculated.

DBIC

Specifies the two input image channels for which the linear regression equation is calculated.

MASK

Specifies the window or bitmap that defines the area to be processed within the input raster.

If a single value is specified, that value represents the channel number of the bitmap segment in the input file. Only the pixels under the bitmap are processed; the rest of the image remains unchanged.

If four values are specified, they define the x,y offsets and x,y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

If no value is specified, the entire channel is processed.

IMSTAT

When completed, SPLREG saves the coefficients of the linear regression equation, the residual Coefficient of Non-Determination (1 - R^2), the Correlation Coefficient (R) and the number of samples, in the IMSTAT output parameter.

The linear equation, which relates values in channel X to channel Y, is:

Y = A  +  B * X

where:

If the derived output function is applied to the input channel X, then the output is as simliar as possible to Y.

Back to top

Details

SPLREG determines the coefficients for a first-order linear regression equation that relates gray-level values in two specified image channels, and saves the coefficient values, the Coefficient of Non-Determination (1 - R^2) and Correlation Coefficient (R) and the number of samples in the output parameters (A, B, 1 - R^2, R, number of samples). The equation specifies a straight line which would go through a scatterplot. The Coefficient of Non-Determination (1 - R^2) indicates the amount of variation in X that is not explained by the regression equation. If X and Y are perfectly correlated, 1 - R^2 = 0; if X and Y are totally uncorrelated, 1 - R^2 = 1.

The MASK parameter specifies the area within the input channel to be sampled for calculation of the linear regression equation. Only the area under the MASK is processed; the rest of the image is not used in the calculations.

Back to top

Example

Calculate coefficients for the equation relating the first two image channels in the file 'irvine.pix'.

from pci.splreg import splreg
file	=	"irvine.pix"	# input image file
dbic	=	[1,2]	# input channels
mask	=	[]	# process entire image
imstat	=	[]

splreg( file, dbic, mask, imstat )

print("A = ", imstat[0])
print("B = ", imstat[1])
print("CND = ", imstat[2])
print("R = ", imstat[3])
print("Number Samples = ", imstat[4])

The report produced by this run is shown below:

SPLREG                                                          13:27 27May2019
Input file:  irvine.pix

Regression equation for channel 1 (X) and channel 2 (Y):

   Y = -11.3884547210186 + 0.5720667646682 * X

Correlation of Non-Determination (1-R^2):  0.0805241016376
Correlation Coefficient (R):  0.9588930588769
Number of samples:  262144

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.