2.4.7 fitMR

Brief Information

Multiple linear regression

Additional Information

Minimum Origin Version Required for all features: Origin 9.0

X-Function not designed for Auto GetN Dialog.

Command Line Usage

1. fitmr dep:=col(D) indep:=col(A):col(C) mrtree:=tr odep:=col(E);

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Dependent Data dep

Input

vector

<unassigned>
Specify dependent variable data range.
Independent Data indep

Input

Range

<unassigned>
Specify independent variables data range, multiple independent data ranges can be specified. For contiguous ranges, use ':' notation like (1:3) for columns 1 to 3. For non-contiguous ranges, use ',' separated list like (1,3,5).
Fix Intercept fixint

Input

int

0
Set to 1 to fix the intercept in multiple linear regression.
Fix Intercept At intercept

Input

double

0
Specify the value of fixed intercept. This is ignored if fixint is set to 0.
MR Tree mrtree

Output

TreeNode

mrt
Tree variable for holding the result of multiple linear regression.
Fitted Values odep

Output

vector

<optional>
Specify the range to output the fitted values of dependent variable.

Description

This X-Function performs multiple linear regression for LabTalk usage.

After executing, the tree variables include
v# = The fit variable values, enumerated as in mrt.v1, mrt.v2, mrt.v3, etc.
e# = The Standard Error values, enumerated
p# = The Prob > |t| values, enumerated
t# = The t-value values, enumerated
numX = The number of Independent variables
npts = The number of points fit
dof = The Degress of Freedom
ReducedChiSqr = Reduced Chi Square
SSE = Sum of Squares due to Error
Rvalue = R Value
cod = R-Square (COD)
adrsq = Adjusted R-Square
rmse = Root-MSE (SD)
NormRes = Norm of Residuals
pvalue = Prob>F
fvalue = F Value
MSE = Mean Square Error
MSR = Model Mean Square
SSR = Model Sum of Squares
SST = Sum of Squares Total

Examples

  • Code Sample
/* 
How to perform multiple linear regression on data with three independents
and on dependent in the active sheet and dump the results
*/
// first import some data
filename$ = system.path.program$ + "Samples\Curve Fitting\Multiple Linear Regression.dat";
newbook;
impASC filename$;

// fitting
fitmr dep:=col(D) indep:=col(A):col(C) mrtree:=tr odep:=col(E);

// add some results to a new sheet
newsheet name:=MRResult;
wks.ncols = 5;
// arrange the results to the sheet
col(1)[1]$ = Beta0;
col(1)[2]$ = Beta1;
col(1)[3]$ = Beta2;
col(1)[4]$ = Beta3;
col(2)[L]$ = Value;
col(2)[1] = tr.v1;
col(2)[2] = tr.v2;
col(2)[3] = tr.v3;
col(2)[4] = tr.v4;
col(3)[L]$ = "Standard Error";
col(3)[1] = tr.e1;
col(3)[2] = tr.e2;
col(3)[3] = tr.e3;
col(3)[4] = tr.e4;
col(4)[L]$ = t-Value;
col(4)[1] = tr.t1;
col(4)[2] = tr.t2;
col(4)[3] = tr.t3;
col(4)[4] = tr.t4;
col(5)[L]$ = Prob>|t|;
col(5)[1] = tr.p1;
col(5)[2] = tr.p2;
col(5)[3] = tr.p3;
col(5)[4] = tr.p4;
// dump the result tree
tr.=;

Algorithm

Please refer to our User Guide: Multiple Regression Results.


Keywords:curve fitting