[R-sig-Geo] How to perform K-fold cross validation for the spdep spautolm (CAR) and spgwr GWR models

Roger Bivand Roger.Bivand at nhh.no
Fri Sep 7 09:54:28 CEST 2012


On Wed, 5 Sep 2012, Muhammad Imran wrote:

>
> hi people,
>
> My objective is to perform K-fold cross validation for the spdep 
> spautolm (CAR) and spgwr GWR model objects, to evaluate the models 
> predictive performance (using model predictions and sampled data). For 
> this, I have been searching for some functions/packages. Any 
> idea/R-code/tutorial? The R-packages Design and DAAG only take 'lm' 
> object to perform K-fold CV. With krige.cv I can perform the CV for the 
> CAR and GWR residuals, but would that serve the objective?

Is your objective sensible? The model object returned by spautolm() does 
not have a predict method, so I don't understand how you can predict for 
dropped observations. Since in any case the coefficients of a CAR (or SAR) 
error model should only differ from OLS a little, the prediction from the 
OLS part (X %*% b) should be adequate, but you'll have a hard time getting 
the prediction standard errors, which involve (I - \lambda W)^{-1}.

Why anyone would try to use GWR for prediction is beyond my comprehension. 
As I've said before, GWR can find pattern in simulated random noise data 
sets. The differences in local coefficients are not "statistically" 
significant, but they look pretty enough anyway, and who bothers about 
significant if the map is pretty? For prediction, simply use 
geostatistics, possibly with an implied disc by including only k-nearest 
data points.

The ipred package provides the general framework for testing in errorest() 
methods, but there are none provided there for these models. The tools are 
there to "roll your own".

Hope this helps,

Roger

>
> Thanks in advance!
>
> -Imran
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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