14.03.2014 Views

Modeling and Multivariate Methods - SAS

Modeling and Multivariate Methods - SAS

Modeling and Multivariate Methods - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9 Performing Nonlinear Regression 269<br />

Additional Examples<br />

The loss function is used in this example, so the second derivative as well as the first one is calculated for the<br />

optimization. With least squares, the second derivatives are multiplied by residuals, which are usually near<br />

zero. For custom loss functions, second derivatives can play a stronger role. Follow these steps to fit the<br />

model:<br />

1. Select Analyze > <strong>Modeling</strong> > Nonlinear.<br />

2. Assign Model2 Y to the X, Predictor Formula role.<br />

3. Assign Loss2 to the Loss role.<br />

4. Check the Second Derivatives option.<br />

5. Click OK.<br />

6. Type 1000 for the Iteration Stop Limit.<br />

7. Click Go.<br />

The Solution report shows the same Loss <strong>and</strong> parameter estimates as before.<br />

Probit Model with Binomial Errors: Numerical Derivatives<br />

The Ingots2.jmp file in the Sample Data folder records the numbers of ingots tested for readiness after<br />

different treatments of heating <strong>and</strong> soaking times. The response variable, NReady, is binomial, depending<br />

on the number of ingots tested (Ntotal) <strong>and</strong> the heating <strong>and</strong> soaking times. Maximum likelihood estimates<br />

for parameters from a probit model with binomial errors are obtained using<br />

• numerical derivatives<br />

• the negative log-likelihood as a loss function<br />

• the Newton-Raphson method.<br />

The average number of ingots ready is the product of the number tested <strong>and</strong> the probability that an ingot is<br />

ready for use given the amount of time it was heated <strong>and</strong> soaked. Using a probit model, the P column<br />

contains the model formula:<br />

Normal Distribution[b0+b1*Heat+b2*Soak]<br />

The argument to the Normal Distribution function is a linear model of the treatments.<br />

To specify binomial errors, the loss function, Loss, has the formula<br />

-[Nready*Log[p] + [Ntotal - Nready]*Log[1 - p]]<br />

Follow these steps to fit the model:<br />

1. Select Analyze > <strong>Modeling</strong> > Nonlinear.<br />

2. Assign P to the X, Predictor Formula role,<br />

3. Assign Loss to the Loss role.<br />

4. Select the Numeric Derivatives Only option.<br />

5. Click OK.<br />

6. Click Go.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!