Skip to content
Prev 27732 / 29559 Next

Spatial Autocorrelation Estimation Method

Dear Roger,

Many thanks for your help.

I have an additional question:

Is it possible to create a "separate" lw (nb2listw) (with different rownumbers) from my data set? For now, I am taking my data set and merging with the sf object polygon_nyc with the function "merge(polygon_nyc, listings, by=c("zipcode" = "zipcode"))", so I create a huge n x n matrix (depending of the size of my data set).

Taking the polygon_nyc alone and turning it to a lw (weights list) object has only n = 177.

Of course running

spatialreg::lagsarlm(formula=model, data = listings_sample, polygon_nyc_lw, tol.solve=1.0e-10)

does not work ("Input data and weights have different dimensions").

The only option is to take my data set, merge it to my polygon_nyc (by zipcode) and then create the weights list lw? Or there another option?

Best regards,
Robert