General Syntax Conventions: Loss Function
The specification of the loss function is quite straightforward. In the estimation procedure, the specified value will be computed for each case in the data file; the estimation procedure will then attempt to find parameters that minimize the sum of those values across all cases.
In general, all rules apply as outlined for the specification of the regression equation for the model. In addition, the two keywords Pred and Obs (the case is ignored) are available to allow you to refer to the predicted and observed values, respectively, for the dependent variable. For example, the default least squares loss function can be specified as:
L = (Obs - Pred)2
- In the Estimated Function and Loss Function dialog, specify the regression model:
v3 = b0 + b1 *v1 + b3 *exp(b1 *v2)
- Now, specify the desired loss function with a penalty assessment as follows:
L = (obs-pred)2 + (b0 <0)*100000 + (b1 <0)*10000
Note how the logical operators are used in this loss function. If either b0 or b1 is less than zero, then the program adds a large number, thus assessing a penalty to the loss function. As a result, the various estimation procedures move away from the regions that produce those functions.