[R-sig-Geo] GWR Newbie

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 7 20:37:18 CET 2006


On Tue, 7 Nov 2006, Raphael Saldanha wrote:

> Hi,
> 
> I'm using a SpatialPolygonsDataFrame object called "x" derived from a
> shapefile.
> 
> Here is what I have:
> 
> > x.adapt.gauss <- gwr.sel(PESSOAS ~ ENSFUND + ENSMEDI, data=x, adapt=TRUE)
> Adaptive q: 0.381966 CV score: 0
> Adaptive q: 0.618034 CV score: 0
> Adaptive q: 0.527864 CV score: 0
> Adaptive q: 0.5623059 CV score: 0
> Adaptive q: 0.5491503 CV score: 0
> Adaptive q: 0.5541753 CV score: 0
> Adaptive q: 0.5522559 CV score: 0
> Adaptive q: 0.552989 CV score: 0
> Adaptive q: 0.552709 CV score: 0
> Adaptive q: 0.552816 CV score: 0
> Adaptive q: 0.5527751 CV score: 0
> Adaptive q: 0.5527751 CV score: 0
> > res.adpt <- gwr(PESSOAS ~ ENSFUND + ENSMEDI, data=x, adapt=x.adapt.gauss)
> Erro em gwr(PESSOAS ~ ENSFUND + ENSMEDI, data = x, adapt = x.adapt.gauss) :
>         Input data and coordinates have different dimensions
> 
> What that can be ???

Thank you for a good report. With high probability, one of the variables 
in your model has missing values. This is signalled by the zero CV scores, 
too. I reproduced your problem in the Georgia data set example on the help 
page by:

data(georgia)
gSRDF$TotPop90[1] <- NA
g.adapt.gauss <- gwr.sel(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + 
  PctPov + PctBlack, data=gSRDF, adapt=TRUE)
res.adpt <- gwr(PctBach ~ TotPop90 + PctRural + PctEld + PctFB + PctPov + 
  PctBlack, data=gSRDF, adapt=g.adapt.gauss)

with the same error message, because the code for the model itself drops 
the observation with the missing value, but its polygon is still present. 
You'll have to decide whether to subset to remove that polygon, or to try 
to establish what the missing value should have been. It is possible that 
the code should simply fail, reporting missing values in the data.

Roger

> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> 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