Example: Using Logical Expressions to Estimate Regression Parameters

When specifying regression functions, you can use logical expressions that will evaluate to 0 if they are false, and to 1 if they are true. This example will demonstrate how one can estimate separate regression parameters for each of the plants in the above example. Specifically, instead of using the b1 parameter as in the model in Example: Specifying a regression model that will evaluate differences across groups, we will use logical operators to estimate the different b0 parameters directly.

1. In the Estimated function or Estimated Function and Loss Function dialog, first specify the regression model:

v3 = b0A *(v1=1) + b0B *(v1=0) + b3 *exp(b2 *v2)

Note how the logical operators are used in this example. If v1 (Plant Location) is equal to 1 then the program will estimate b0A, that is, the constant for plant A; if v1 is equal to 0 then STATISTICA will estimate b0B.

2. If you selected User-Specified Regression, Custom Loss Function from the Startup Panel, you also need to specify the desired loss function [option User-Specified Regression, Least Squares will automatically use the least squares loss function in conjunction with the efficient Levenberg-Marquardt Algorithm (Nonlinear Least Squares)]. For example:

L = (obs - pred)2

the standard (default) least squares loss function.

3. Once you have entered the desired model and loss function, click OK to exit the dialog and proceed with the analysis. STATISTICA will automatically check the syntax of the expressions for errors and notify you if there are any.

See also, General syntax conventions: Regression equations and Example: Specifying a regression model that will evaluate differences across groups.