Skip to content
Prev 29158 / 29559 Next

Error when running multiscale GWR: Error in gw_weight_vec: Not compatible > with requested type: [type=NULL; target=double]

The parameter  var.dMat.indx  is defined for the usage of distance matrix for each variable, and was used wrongly in your code. Try this:

 ab_gwr <- gwr.multiscale(PURCHASE ~ FLOORSZ + PROF,
                         data = londonhp,
                         criterion = "dCVR",
                         kernel = "gaussian",
                         adaptive = FALSE,
                         var.dMat.indx = 1:3,
                         bws0 = c(100,
                                  100,
                                  100),
                         bw.seled = rep(T, 3),
                         dMats = list(dist,
                                      dist,
                                      dist),
                         parallel.method = "omp",
                         parallel.arg = "omp")
It should work now.


binbinlu at whu.edu.cn
 
From: Nikolaos Tziokas
Date: 2023-02-06 01:14
To: r-sig-geo
Subject: [R-sig-Geo] Error when running multiscale GWR: Error in gw_weight_vec: Not compatible > with requested type: [type=NULL; target=double]
I am trying to run multiscale geographically weighted regression (MGWR)
using the GWmodel package in R. When running the function gwr.multiscale
this error is shown:
 
Error in gw_weight_vec(vdist, bw, kernel, adaptive): Not compatible with
requested type: [type=NULL; target=double].
 
An example:
 
library(GWmodel)
 
data(LondonHP)
 
dist <- gw.dist(coordinates(londonhp))
 
ab_gwr <- gwr.multiscale(PURCHASE ~ FLOORSZ + PROF,
                         data = londonhp,
                         criterion = "dCVR",
                         kernel = "gaussian",
                         adaptive = FALSE,
                         var.dMat.indx = 2,
                         bws0 = c(100,
                                  100,
                                  100),
                         bw.seled = rep(T, 3),
                         dMats = list(dist,
                                      dist,
                                      dist),
                         parallel.method = "omp",
                         parallel.arg = "omp")
 
I am following the example from the package's PDF. Also, I tried with my
dataset and many different combinations (different number of covariates,
the dMats parameter, adaptive bandwidths etc etc).