Ss
Contents
Description
The ss function returns the sum of the square of individual values in vd minus some reference value. The function ss is defined by the following equation:
/math-f2a0a689fb524cf94141584b40ae0d75.png)
![(data[i]-ref)^2 (data[i]-ref)^2](/labtalk/ja/images/Ss_(function)/math-e4ed215422123b6ab85afcd1620bf164.png)
Syntax
//If ref is a constant double sumSquares = ss(dataset vd[, double ref]); //If ref is a vector double sumSquares = ss(dataset vd[, dataset ref]); //If ref is a function double sumSquares = ss(dataset vd[, string ref]);
Parameter
vd
- can be a dataset, or a column in Origin worksheet.
ref
- the reference value you want to subtract from vd.
- If ref is not specified the function defaults to using the mean of vd as the value of ref.
- ref can be a constant, a dataset, or a function (see examples below).
Return
Returns the sum of the square of individual values in vd minus some reference value.
Examples
No ref value specified
// Calculates the mean-subtracted sum of squares: double sumSq = ss(dataset);
ref is a constant
// Calculates the sum of squares, after subtracting 4 from each member // of 'dataset': double sumSq = ss(dataset,4);
ref is a dataset
// Calculates the sum of squares, subtracting each corresponding member // of 'dataset2' from 'dataset1': double sumSq = ss(dataset1,dataset2);
ref is a function of i or x
ref is an expression involving x or i, where x is the X-value corresponding to each element in dataset (assumed to be Y-values), and i is the corresponding row number for each element in dataset.
double AA = 1; double BB = 2; // Calculates the sum of squares, subtracting the line described by 1+2x: double sumSq = ss(dataset, AA+BB*x);