Publication date: 07/08/2024

Example of Fitting a Weibull Loss Function

In this example, models are fit to the survival time using the Weibull, lognormal, and exponential distributions in the Nonlinear platform. Model fits include a simple survival model containing only two effects, a more complex model with all the effects, and the creation of dummy variables for the discrete effect Cell Type to be included in the full model.

Nonlinear model fitting is often sensitive to the initial values that you give to the model parameters. In this example, one way to find reasonable initial values is to first use the Nonlinear platform to fit only the linear model. When the model converges, the solution values for the parameters become the initial parameter values for the nonlinear model.

1. Select Help > Sample Data Folder and open VA Lung Cancer.jmp.

The first model and all the loss functions have already been created as formulas in the data table. The Model column has the following formula:

Log(:Time) - (b0 + b1 * Age + b2 * Diag Time)

2. Select Analyze > Specialized Modeling > Nonlinear.

3. Select Model and click X, Predictor Formula.

4. Click OK.

5. Click Go.

Figure 15.24 Initial Parameter Values in the Nonlinear Fit Control Panel 

Initial Parameter Values in the Nonlinear Fit Control Panel

The report computes the least squares parameter estimates for this model.

6. Click Save Estimates.

The parameter estimates in the column formulas are set to those estimated by this initial nonlinear fitting process.

The Weibull column contains the Weibull formula. See Weibull Loss Function in Reliability and Survival Methods.

To continue with the fitting process:

7. Select Analyze > Specialized Modeling > Nonlinear again.

8. Select Model and click X, Predictor Formula.

9. Select Weibull loss and click Loss.

10. Click OK.

Figure 15.25 Initial Nonlinear Fit Control Panel 

Initial Nonlinear Fit Control Panel

There is now the additional parameter called sigma in the loss function. Because it is in the denominator of a fraction, a starting value of 1 is reasonable for sigma. When using any loss function other than the default, the Loss is Neg LogLikelihood box on the Control Panel is checked by default.

11. Click Go.

Figure 15.26 Nonlinear Fit 

Nonlinear Fit

The fitting process estimates the parameters by maximizing the negative log of the Weibull likelihood function.

12. (Optional) Click Confidence Limits to show lower and upper 95% confidence limits for the parameters in the Solution table.

Figure 15.27 Solution Report 

Solution Report

Note: Because the confidence limits are profile likelihood confidence intervals instead of the standard asymptotic confidence intervals, they can take time to compute.

You can also run the model with the predefined exponential and lognormal loss functions. Before you fit another model, reset the parameter estimates to the least squares estimates, as they might not converge otherwise. To reset the parameter estimates:

13. (Optional) Click the Nonlinear Fit red triangle and select Revert to Original Parameters.

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