# Question about prediction bands for non-linear regression computation?

I am interested in computing prediction bands for a non-linear regression (log-logistic function with 3 parameters). I have read the Prism help page:

The calculation of the confidence and prediction bands are fairly standard. Read on for the details of how Prism computes prediction and confidence bands of nonlinear regression.

First, let's define G|x, which is the gradient of the parameters at a particular value of X and using all the best-fit values of the parameters. The result is a vector, with one element per parameter. For each parameter, it is defined as dY/dP, where Y is the Y value of the curve given the particular value of X and all the best-fit parameter values, and P is one of the parameters.)

G'|x is that gradient vector transposed, so it is a column rather than a row of values.

Cov is the covariance matrix (inversed Hessian from last iteration). It is a square matrix with the number of rows and columns equal to the number of parameters. Each item in the matrix is the covariance between two parameters.

Now compute c = G'|x * Cov * G|x. The result is a single number for any value of X.

The confidence and prediction bands are centered on the best fit curve, and extend above and below the curve an equal amount.

The confidence bands extend above and below the curve by: = sqrt(c)*sqrt(SS/DF)*CriticalT(Confidence%, DF)

The prediction bands extend a further distance above and below the curve, equal to: = sqrt(c+1)*sqrt(SS/DF)*CriticalT(Confidence%, DF)

I also read the topic How to compute prediction bands for non-linear regression?.

But I still do not understand something : how to compute the Hessian matrix. I do not think it is (I do not get values between -1 and 1), but, is it the second-order partial derivatives of my log-logistic function ?

In Prism, it refers to the "Hessian from last iteration" while in the topic, it is written "the second derivatives of the likelihood function at your estimates".

The likelihood function I use is ( -N / 2 ) * log( sum( ( dat - model ) .^2 ) ) where N is the number of observations, dat is a vector with data being fitted and model is a vector of model values. I do not really understand how it would be possible to do a second order derivatives of this function.

Could anyone give me a hand with this ?

• Why would the second order partial derivatives be between -1 and 1? – Glen_b Nov 1 '13 at 23:05
• Hello Glen, In Prism, they use Cov to refer to the normalized covariance matrix, where each value is between -1 and 1. I do not really understand why it is (might be) important – Adrien.M Nov 4 '13 at 18:32
• I made a mistake when writing the GraphPad Prism 6 help. While Prism only reports (optionally) the normalized covariance matrix, the calculations of the confidence and prediction bands define "cov"to be the nonnormalized covariance matrix. This FAQ is now correct: graphpad.com/support/faq/… – Harvey Motulsky Sep 29 '14 at 17:06
• This is indeed known as the delta method and uses a first order Taylor approximation. It is better though to use a 2nd order Taylor approximation for this - the predictNLS function in the propagate package does that if you're interested! – Tom Wenseleers Mar 28 '18 at 15:32