[R-sig-Geo] GWR : Confidence intervals on predictions

Jean-Paul Kibambe Lubamba jean-paul.kibambe at uclouvain.be
Fri Oct 3 16:44:04 CEST 2008

Hello everybody,

I want to obtain confidence intervals on predictions when using gwr. I
received some matrix algebra to implement to do that, but I need the gwr
weight matrix and I do not know how to get it. Could anyone help me ?

Thanks in advance for any help !

JP

Here is below the matrix operations, using a latex notation:

The vector of regression coefficients at a given point is

\beta = (X^TWX)^(-1) X^TWy

Where the weight matrix W depends on the location of the point,  as usual.
We can simplify this by writing

\beta = Cy where C = (X^TWX)^(-1) X^TW

Then

Var(\beta) = CC^T \sigma^2 - so far,  this is in the GWR book - including
how to estimate \sigma^2

Now if we have a new vector of predictors x at the same point,  then
predictor of the y-variable is

x^T \beta

And so its variance is

x^T C x \sigma^2

This gives the variance of the expected y-variable given a set of
predictors - but this is just the variance of the mean of its
distribution.  The y-variable itself will be the sum of the predicted mean
plus an error term with mean zero and variance\sigma^2.

This has variance

x^T C x \sigma^2 + \sigma^2

or

(x^T C x + 1)\sigma^2

And so the standard error of the prediction is

sqrt(x^T C x + 1)\sigma