4.46 FAQ-660 How to calculate descriptive statistics by using LabTalk Script

Last Update: 3/27/2015

On Selecting Range or Specific Columns

You can perform the descriptive statistics on datasets in workbook by using X function Stats on selected range or specific columns

The syntax is as follows:

stats ix:=<active> //on the selecting range
stats ix:=wcol(1) //on the 1st column

The following statistical values are calculated:

Statistic Stored Result
Mean stats.mean
Total stats.sum
Minimum stats.min
Maximum stats.max
Standard Deviation stats.sd
Number of Points stats.n

For example:

stats ix:=wcol(1)
//view the results
stats.mean=;
stats.sd=;
stats.sum=;
Notes:

You can also define labels for the variables and use them in later operations, for example:

stats ix:=col(a) mean:=m sd:=std sum:=mysum
//view the results
m=;
std=;
mysum=;
On Rows

The x-function Rowstats can be used across multiple columns to return new dataset which contains the statistics(mean, sd, sem, min, max, n, sum), of each row.

For example:

rowstats irng:=col(1):col(3) mean:=<new> sd:=<new>; //mean and sd of each row will be generated in the new columns
rowstats irng:=col(1):col(3) mean:=wcol(4) sd:=<optional>; //output mean of each row to the 4th column

To learn more labtalk scripts for descriptive statistics, please refer to the page.


Keywords:LabTalk, Descriptive Statistics