[R-sig-Geo] using gwr for interpolation

Roger Bivand Roger.Bivand at nhh.no
Fri May 29 13:34:03 CEST 2009


On Fri, 29 May 2009, Torleif Markussen Lunde wrote:

> Hi
>
> I think the error is in .GWR_int line 42:
> df[i, (m + 3)] <- ei[i]
>
> ei will have length equal to dim(data)[1], while i is equal to
> nrow(fit.points). So as i > dim(data)[1] ei[i] will be NA.
>
> This could explain why only the first 155 points are evaluated (in your
> example).

Right, thanks. Residuals are only defined when the fit points are the same 
as the data points - when fit points are given, NA should be returned.

Roger

>
> Best wishes
> Torleif
>
> On Friday 29 May 2009 11:36:08 am Edzer Pebesma wrote:
>> Can I use gwr for interpolation?
>>
>> I would for example use something like
>>
>> library(spgwr)
>> data(meuse)
>> coordinates(meuse) = ~x+y
>> data(meuse.grid)
>> gridded(meuse.grid) = ~x+y
>> x = gwr(cadmium ~ dist, meuse, bandwidth = 228, fit.points = meuse.grid)
>> spplot(x$SDF["gwr.e"])
>>
>> But it doesn't give what I'd expected - somehow nicely interpolated
>> cadmium values. I probably misused fit.points, but I couldn't see any
>> predict method. Is this possible at all?
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list