In order to perform a manual regression analysis, you will use a custom data set. To demonstrate the use of this feature, we will fill a new data set with fixed values. Normally, you would use Tokens, representing some statistic from your analysis. Defining regressions manually is easy in FCS Express 6 with Scatter with Regression plots. We highly recommend you visit the Scatter with Regression plots chapter before proceeding with a manual fit.

 

In Figure 11.50, we have a Spreadsheet, with values typed into the cells.  Please note that these are freetext values, but in practice many of these will be tokens derived from plots on your layout.

 

 

Figure 11.50  Spreadsheet Data for Regression Analysis

Figure 11.50  Spreadsheet Data for Regression Analysis

 

With this data, a linear regression should yield a slope of approximately 10 and a Y-intercept of approximately 1.

 

Regression analysis is performed using Custom Tokens.

 

1.First, create a new custom token and name it Linear Regression.

 

If you right-click in the formula area of the Custom Token window and choose Insert Function, you will find a list of available regressions, each beginning with the word Perform (Figure 11.51).

 

Figure 11.51  Regression Functions

Figure 11.51  Regression Functions

 

2.Start a formula with an equals sign (=), right-click to bring up the pop-up menu, and choose Insert FunctionPerformLinearFit([xValues, [yValues], [SDvalues], [fixedParameters]) (Figure 11.52).

 

 

Figure 11.52  Linear Regression Formula

Figure 11.52  Linear Regression Formula

 

3.In the formula, highlight xValues, right-click to bring up the pop-up menu, and choose Insert Token (Figure 11.53).

 

 

Figure 11.53  Inserting a Token into a Linear Regression Formula

Figure 11.53  Inserting a Token into a Linear Regression Formula

 

 

An Insert a Token dialog will appear that contains a Data Parameter token (Figure 11.54).

 

 

Figure 11.54  Data Parameter Token

Figure 11.54  Data Parameter Token

 

4.Select the Data Parameter token and click Insert.

 

5.In the Create Data Parameter dialog which appears, choose the Spreadsheet radio button as a Data Source, and select New Spreadsheet (Figure 11.55).

 

Figure 11.55  Create Data Parameter -- Data Source

Figure 11.55  Create Data Parameter -- Data Source

 

6.Then, go to the Parameter category and from the Parameter drop-down list, choose the data in column A (Figure 11.56). Leave Macro for the Output As drop-down selection. Choosing Data Values converts all of the data to string values which is not efficient when there is a large amount of data.

 

 

Figure 11.56  Create Data Parameter -- Parameter Page

Figure 11.56  Create Data Parameter -- Parameter Page

 

7.Repeat steps 3-6 using yValues in the formula and choosing Parameter B.

 

8.Highlight SDvalues and press the Del key (leaving the area between the brackets blank. Do the same for fixedParameters (Figure 11.57).

 

 

Figure 11.57  Completed Linear Regression Formula

Figure 11.57  Completed Linear Regression Formula

 

 

If the measurement in your B column was made from multiple data points and you know the standard deviation of each of the data points, you can enter a list of comma-delimited values in the SDvalues parameter of the linear regression formula. The model will weigh the points with the lower standard deviation more strongly than the points with higher SD values.

 

The fixed Parameters for a linear regression are m (slope) and b (Y-intercept). By leaving the parameter blank, the model will fit both of them. If you wanted to force a Y-intercept of 0, for example, you could enter b=0 in fixedParameters, and the model will fix that parameter, rather than letting it float.

 

 

9.Convert both Data Parameter values in the formula to display a numeric result type (they will be highlighted in blue instead of pink, as shown below in Figure 11.58).

Figure 11.58  Completed Linear Regression Formula with result type converted to Numeric

Figure 11.58  Completed Linear Regression Formula with result type converted to Numeric

 

10. Insert a Text Box onto your layout.

 

11. Drag the custom token Linear Regression into the text box. The m, b, and r2 (r-squared) values will be displayed (Figure 11.59).

 

 

Figure 11.59  Linear Regression Token inserted into a Text Box

Figure 11.59  Linear Regression Token inserted into a Text Box

 

The result is a comma-delimited list of every parameter that the linear regression fit.

 

If you want to display just the slope of the linear regression in a text box, you create a new custom token, and:

 

12. Use the function ExtractLinearResults([modelParameters], "m" | "b" | "r2") (Figure 11.60) as in step 2.

 

13. Then, select modelParameters and insert the Linear Regression token, as in step 4.

 

14. Delete the "b" and "r2" parameters.

 

15. Create a text box and insert the text: "The slope is: ".

 

16. Drag the Slope token into the text box (Figure 11 below).

 

Figure 11.60  Slope Parameter of Linear Regression Analysis Inserted into a Text Box as a Token

Figure 11.60  Slope Parameter of Linear Regression Analysis Inserted into a Text Box as a Token

 

 

In summary, it is a two-step process. You make one custom token for the fit, and a second custom token for the parameter that you want to use from that fit.