Stat

LabTalk Object Type:

External Object

The stat object provides for the following operations:

  • Linear regression.
  • Polynomial regression.
  • Multiple regression.
  • Descriptive statistics.

Please see the fitlr, fitpoly, stats X-Function.

Properties:

Common Stat Object Properties:

Property Access Description
stat.adrsq Read only
numeric

Adjust Coefficient of Determination (R squared).

stat.chiSqrErr Read/write
numeric

Multiply the error on the parameters with the reduced chi-square value. 1 = enable, 0 = disable.

stat.cod Read only
numeric

Coefficient of Determination (R squared).

stat.confLevel Read/write
numeric

Confidence level for calculating confidence and prediction limits.

stat.errBarData$ Read/write
string

Name of the error bar column to be used for calculating weights.

stat.fitxData$ Read/write
string

Name of the X column to be fitted.

stat.fityData$ Read/write
string

Name of the Y column to be fitted.

stat.fValue Read only
numeric

F test value (MSR/MSE).

stat.lclData$ Read/write
string

Name of the lower control line.

stat.lplData$ Read/write
string

Name of the lower prediction line.

stat.makeX.fitnpts Read/write
numeric

Number of points for the fitted curve.

stat.makeX.fitX1 Read/write
numeric

First X value to be used when making the FitX$ dataset with the MakeX() method.

stat.makeX.fitX2 Read/write
numeric

Last X value to be used when making the FitX$ dataset with the MakeX() method.

stat.makeX.margin Read/write
numeric

Percent of the raw data's range, of which to extend the fit X dataset beyond.

stat.MSE Read only
numeric

Mean sum of squares of residuals.

stat.MSR Read only
numeric

Mean sum of squares due to regression.

stat.npts Read only
numeric

Number of valid data points

stat.pvalue Read only
numeric

P-value for F test.

stat.r Read only
numeric

Correlation coefficient.

stat.resData$ Read only
string

Name of the residual column.

stat.sd Read only
numeric

Standard deviation of the fit.

stat.SSE Read only
numeric

Residual sum of squares.

stat.SSR Read only
numeric

Sum of squares due to regression.

stat.SSTO Read only
numeric

Total sum of squares.

stat.uclData$ Read/write
string

Name of the upper control line.

stat.uplData$ Read/write
string

Name of the upper prediction line.

stat.wTotal Read only
numeric

Total weight.

stat.xMean Read only
numeric

Mean value of the X column.

stat.yMean Read only
numeric

Mean value of the Y column

Stat Object Properties Specific to Linear Regression:

Property Access Description
stat.lr.a Read only
numeric

Intercept.

stat.lr.ap Read only
numeric

P-value for the t test of a.

stat.lr.ase Read only
numeric

Standard error of a.

stat.lr.b Read only
numeric

Slope.

stat.lr.bp Read only
numeric

P-value for the t-test of b.

stat.lr.bse Read only
numeric

Standard error of b.

stat.lr.t Read only
numeric

t value corresponding to the confidence level.

Stat Object Properties Specific to Polynomial Regression:

Property Access Description
stat.pr.a,

stat.pr.b1, etc.

Read only
numeric

Fitted parameters (a is the intercept).

stat.pr.ap Read only
numeric

P-value of the t-test for parameter a.

stat.pr.ase,
stat.pr.bse1, etc.
Read only
numeric

Standard error of a and b[i].

stat.pr.bp1,

stat.pr.bp2, etc.

Read only
numeric

P-values of the t-tests for parameters bi.

stat.pr.order Read/write
numeric

Order of the polynomial.

stat.pr.t Read only
numeric

t value according to the confidence level.

Stat Object Properties Specific to Multiple Regression:

Property Access Description
stat.mr.a Read only
numeric

Intercept.

stat.mr.ap Read only
numeric

P-value of t-test for parameter a.

stat.mr.ase Read only
numeric

Intercept's error

stat.mr.bestr2wks$ Internal use only

Not implemented in Origin.

stat.mr.bi Read only
numeric

Fitting parameters (i = 1 .. 9).

stat.mr.bpi Read only
numeric

P-values of t-test for parameters bi (i = 1 ..9).

stat.mr.bsei Read only
numeric

b[i]'s errors (i = 1 .. 9).

stat.mr.NumX Read only
numeric

The total number of X columns.

stat.mr.pIn Read only
numeric

Critical P-value to enter a variable in stepwise regression.

stat.mr.pOut Read only
numeric

Critical P-value to remove a variable in stepwise regression.

stat.mr.t Read only
numeric

t value according to confidence level.

stat.mr.XDatai$ Read/write
string

X column names (i = 1 ..9).

stat.mr.YData$ Read/write
string

Y column name

Stat Object Properties Specific to Descriptive Statistics:

Property Access Description
stat.DS.ad --

Not currently implemented.

stat.DS.CIL Read only
numeric

Lower confidence limit about the mean (the percentage is set with stat.ds.confLev).

stat.DS.CIU Read only
numeric

Upper confidence limit about the mean (the percentage is set with stat.ds.confLev).

stat.DS.cName1$ --

Not currently implemented.

stat.DS.confLev Read/write
numeric

Confidence level (set to 0.95 by default). Set this property to load stat.ds.ciu and stat.ds.cil.

stat.DS.data$ Read/write
string

Name of dataset used to calculate descriptive statistics.

stat.DS.geoMean

Not currently implemented.

stat.DS.interpolate Read/write
numeric

Use interpolation when finding the quartiles/percentiles. 1 = enable, 0 = disable.

stat.DS.kurt Read only
numeric

Kurtosis of the data. Kurtosis measures the long-tailedness or peakedness of the distribution of a random variable relative to the normal or Gaussian distribution with the same mean and variance.

stat.DS.max Read only
numeric

Maximum of the data.

stat.DS.mean Read only
numeric

Mean value of the data.

stat.DS.medCIL --

Not currently implemented. Lower confidence limit about the median.

stat.DS.medCIU --

Not currently implemented. Lower confidence limit about the median.

stat.DS.median Read only
numeric.

Median of the data.

stat.DS.min Read only
numeric

Minimum of the data.

stat.DS.missing Read only
numeric

Number of missing values in the dataset.

stat.DS.more Read/write
numeric

Perform advanced statistics. 1 = enable, 0 = disable.

stat.DS.percent Read/write
numeric

The percentile to calculate when stat.ds() is performed. The percentile is loaded into stat.ds.percentile.

stat.DS.percentile Read only
numeric

Percentiles of the data.

stat.DS.quart75 Read only
numeric

The upper quartile (75th percentile).

stat.DS.quartl25 Read only
numeric

The lower quartile (25th percentile).

stat.DS.quartl50 Read only
numeric

The second quartile (50th percentile).

stat.DS.range Read only
numeric

Range of the data.

stat.DS.sd Read only
numeric

Standard deviation.

stat.DS.se Read only
numeric

Standard error of the mean.

stat.DS.size Read only
numeric

Number of data points in the dataset.

stat.DS.skew Read only
numeric

Skewness of the data.

stat.DS.ssq Read only
numeric

Sum of squares

stat.DS.sum Read only
numeric

Sum of the data.

stat.DS.testNorm --

Not currently implemented.

stat.DS.var Read only
numeric

Sample variance.

Methods:

Common Stat Object Methods:

Method Description
stat.makeX()

Make an X dataset in fitX$ that spans from FitX1 to FitX2.

stat.name(CtrlBit, WksName_ColName, NewColNam1[, NewColNam2, ..., NewColNamn])

CtrlBit is either 1 or 0. When CtrlBit = 1, concatenate WksName_ColName to WksNameColName. This becomes the name of the new worksheet. Scan for already existing datasets: WksNameColName_NewColNam1, WksNameColName_NewColNam2, ..WksNameColName_NewColNamn. If a dataset already exists, then generate a new worksheet name (WksNameColNamen, where n = 1, 2, etc.) and scan again. When no duplicate names are found, set stat.name.worksheet$ to WksNameColName or WksNameColNamen. When CtrlBit = 0, concatenate WksName_ColName to WksNameColName. Do not search for previously existing datasets with identical names. Set stat.name.worksheet$ to WksNameColName.

stat.reset()

Reset all parameter values to their initial, unassigned values.

Stat Object Methods Specific to Linear Regression:

Method Description
stat.lr([z])

Linear regression for given datasets. When "z" is specified, the fitting line goes through the origin.

For example :

stat.data$ = %H_B;
stat.errbardata$ = %H_C;
stat.lr();
stat.lr.a = ;
//Display intercept in Script window
stat.lr.b = ;
//Display slope in Script
window

Stat Object Methods Specific to Polynomial Regression:

Method Description
stat.pr()

Polynomial regression for given datasets. For example:

stat.data$ = %H_B;
stat.fitxdata$ = %H_D; //(optional)
stat.fitydata$ = %H_E; //(optional)
stat.pr();

Stat Object Methods Specific to Multiple Regression:

Method Description
stat.mr() Multiple regression for the given datasets.
stat.mr();

Stat Object Methods Specific to Descriptive Statistics:

Method Description
stat.DS()

Descriptive and basic statistics for given dataset.

Examples:

This script performs a second order polynomial regression. It assumes that a Data1 worksheet is active and contains four columns: an X column with data, a Y column named B with data, an empty column named fitx, and an empty column named fity.

  • First create a script file containing the following script and save this file as PolyNom.OGS to your Origin software folder:
//Performs polynomial regression 
//%1 = order 
//%2 = name of dataset to fit (y variable) 
//%3 = name of dataset to store fitted x data 
//%4 = name of dataset to store fitted y data 
//%5 = number of points to create fitted curve 
[main] 
stat.reset(); //Reset the DLL 
stat.pr.order = %1; //order 
stat.data$ = %2; //dataset to fit 
stat.fitxdata$ = %3; //dataset to store fitted x values 
stat.fitYdata$ = %4; //dataset to store fitted y values 
stat.makeX.fitnpts = %5; //number of points of regression curve 
limit %2; //finds limiting values for the dataset to fit 
stat.makex.fitx1 = limit.xmin; 
stat.makex.fitx2 = limit.xmax; 
stat.makex(); 
stat.PR();
  • Then execute the following script to run the script file and perform the polynomial regression:
run.section(polynom.ogs, main, 2 
data1_b data1_fitx data1_fity 
100);