LR

LabTalk Object Type:

Utility

Results generated from the (linear regression) lr command are placed in the following lr object properties.

For further control when performing linear regression, see the stat object.

Please see the fitlr X-Function.


Note on use the lr -b dataset or lr -e dataset commands to perform a linear regression

When you use the lr -b dataset or lr -e dataset commands to perform a linear regression on the beginning (b) or ending (e) linear region of dataset, the dataset is automatically searched for linearity, as determined by the following parameters that can be modified in the ORGSYS.CNF file:

lr.maxLRange: The percentage of the entire data range to perform a linear regression on. For example, when lr.maxLRange = 40 (default) and dataset has 20 points, lr -b dataset performs a linear regression on the first 8 points in dataset, if these points meet the requirements of the lr.chkLinearR parameter. Thus, if the fourth point is outside the tolerance set by lr.chkLinearR, then the lr -b dataset command would only perform a linear regression on the first three points in dataset.
lr.chkLinearR: Sets the amount of tolerance in the automatic determination of linear segments.

 

Properties:

Property Access Description
lr.a Read only,
numeric

Intercept.

lr.b Read only,
numeric

Slope.

lr.n Read only,
numeric

Number of points used in the fitting.

lr.r Read only,
numeric

Correlation coefficient.

lr.sd Read only,
numeric

Standard deviation of the fit.

lr.sda Read only,
numeric

Standard deviation of the intercept

lr.sdb Read only,
numeric

Standard deviation of the slope.

 

Examples:

This script performs a linear fit of dataset Data1_B beginning at the first data point and continuing until the end of the linear region. It types the resulting slope and intercept to the Script window.

Lr Data1_B;
type "Slope is $(lr.b)";
type "Intercept is $(lr.a)";