# Calculating confidence bands for nonlinear regression

D

#### Dolphin72

##### Guest
Hi,

I am trying to find a way to calculate the 95% confidence bands for nonlinear regression. I have found the following text on the web, but I do not understand it well.

"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 do not understand how to define G|x and the matrix cov? I would appreciate any help with that, and an example with numbers would be fantastic!