Dear Roger,

Maybe you can remember, last week I asked some questions about gwr analysis and you helped me. In order to make refresh, I want to summarize my problem. I am trying to make gwr analysis to predict precipitation distribution on a DEM. I have two datasets; first one is 'station' consists of 225 prec. measurements and 3 independent variables (Z, V1, V2). The second one is 'DEM' dataset which has 31203 # of pixels. Firstly I tried with using SPDF (SpatialPointsDataFrame) and obtained predicted precipitations on DEM. But when I plot the predicted precipitation values, I saw a lot of negative values which is impossible to get such a values. I thought that this was caused because I used point data sets (SPDF) for grid. Then I tried with using SGDF (SpatialGridDataFrame). At this time, gwr() resulted with an error message "new data matrix rows mismatch". You told me that 'The error message is generated when the number of columns in the matrix of X variables is not the same in data and and fit.points.' I gave some information about datasets below.

class(station)
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"
names(station)
[1] "PREC" "Z"    "V1"   "V2"
class(dem)
[1] "SpatialGridDataFrame"
attr(,"package")
[1] "sp"
names(dem)
[1] "Z"  "V1" "V2"

'PREC' is the observations and I want to get predictions of them on 'dem'.

I checked the str() and variables are stored in the same way.

bw=gwr.sel(PREC~Z+V1+V2,data=station,adapt=T)
xx1<-gwr(PREC~Z+V1+V2,station,adapt=bw,hatmatrix=TRUE)
x1 <-gwr(PREC~Z+V1+V2,data=station,adapt=bw, fit.points = dem, predict=T, se.fit=T, fittedGWRobject=xx1)
Error in gwr(PREC ~ Z + V1 + V2, data = station, adapt = bw, fit.points = dem, :
  new data matrix rows mismatch


If I wrote 'predict=F' then gwr() works but gives only sum.w, coefficients and localR2.

I tried to run gwr() under debug but I didn't understand the output.

I really don't understand the problem and need help.

Best regards,
Pinar

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to