For the latest version of JMP Help, visit JMP.com/help.


Predictive and Specialized Modeling > Nonlinear Regression > Example of Fitting a Custom Model
Publication date: 11/10/2021

Example of Fitting a Custom Model

This example fits a custom model by creating a formula column for the model and then fitting the model using the Nonlinear platform. This method requires a few more steps than fitting a built-in model, but it allows any nonlinear model to be fit. You can also provide a custom loss function, and specify several other options for the fitting process.

Tip: If the custom model is one that you use often for several data tables, you can add the model to the Model Library instead. See Customize the Nonlinear Model Library.

The data are in the US Population.jmp data table. The response variable is the population (in millions) of the Unites States and the predictor is the year.

Create a Formula Column

To fit a custom model, you must first create a model column with initial parameter estimates.

1. Select Help > Sample Data Library and open Nonlinear Examples/US Population.jmp.

2. Create a new column called Model.

3. Right-click the Model column and select Column Properties > Formula.

The Formula Editor appears.

4. Select Parameters from the list below the list of columns.

Figure 15.2 Select Parameters 

Select Parameters

5. Select New Parameter.

6. Type B0 for Name.

7. Type 3.9 for Value. This is the initial estimate of the parameter.

8. Click OK.

9. Select New Parameter.

10. Type B1 for Name and enter 0.022 for Value.

11. Click OK.

12. Enter the model formula using the Formula Editor functions, the column year, and the parameters.

Figure 15.3 Completed Model Formula 

Completed Model Formula

Tip: Click the gray triangle next to Transcendental to find the Exp command.

13. Click OK.

Fit a Nonlinear Model

1. Select Analyze > Specialized Modeling > Nonlinear.

2. Assign Model to the X, Predictor Formula role.

3. Assign pop to the Y, Response role.

4. Click OK.

5. Click Go on the Control Panel to fit the model.

Figure 15.4 Plot and Solution Report 

Plot and Solution Report

The final parameter estimates are shown in the Solution report, along with other fit statistics. The fitted model is shown on the plot.

Parameters for Models with a Grouping Variable

In the formula editor, when you add a parameter, note the check box for Expand Into Categories, selecting column. This option is used to add several parameters (one for each level of a categorical variable for example) at once. When you select this option, a dialog appears that enables you to select a column. After selection, a new parameter appears in the Parameters list with the name D_column, where D is the name that you gave the parameter. When you use this parameter in the formula, a Match expression is inserted, containing a separate parameter for each level of the grouping variable.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).