Questions tagged [spdep]

An R package to provide functions for spatial regression, dependence, and weighting analysis.

62 questions
1
vote
1 answer

R error with spatial point data frame when using lapply

I have a list of lists called flat_head. dput(flat_head) structure(list(`0.25_0.05` = list(c(66, 102, 4.84), c(56, 75, 3.63), c(15, 134, 0)), `0.25_0.1` = list(c(147, 27, 0), c(98, 18, 4.84), c(141, 54, 4.84)), `0.5_0.05` = list(c(64, 130,…
user2359494
  • 731
  • 5
  • 18
1
vote
0 answers

Spatial Autocorrelation between time series in R

So I'm using the spdep package in R to do this. I need to use the localmoran function in it to get clusters of hot/cold spots in the study area. After going through the reference guide, I got it to work. But since the data is a time series, now I'm…
ace_01S
  • 387
  • 2
  • 5
  • 16
1
vote
0 answers

Spdep: Test for heteroscedasticity in GMerrosar residuals

Using spdep in R, and after conducting a Jarque-Bera test confirming non-normality of the residuals resulting from the maximum likelihood estimation of my Spatial Error Model, I used the generalized moments technique (GMerrorsar). Now I want to test…
Houssem
  • 143
  • 9
1
vote
0 answers

Modify SPDEP package - insert new function

I am trying to modify the stsls function of the R package spdep. The function compute a spatial autoregressive function using a two stage least square. For both stages, the function uses the same spatial matrix. What I want is to create a new…
vscia
  • 11
  • 2
1
vote
0 answers

Missing links in a spdep (R) Queen Contiguity Neighborhood

I'm puzzled by the following result in plotting the Queen Contiguity Neighbors using the spdep library in R. library(spdep) Using a World shape file wrld_simp to get the centroid points (spatial…
1
vote
2 answers

Installing R package (spdep) in OS X from source --- compilation error

I am trying to install a R package (spdep) on a OS X 10.9 Mavericks, with R 3.0.1 (sessionInfo at the bottom). The package was downloaded from http://cran.r-project.org/web/packages/spdep/index.html (source file spdep_0.5-71.tar.gz), and I tried to…
Fran Villamil
  • 491
  • 4
  • 13
1
vote
0 answers

spdep package, errorsarlm(): too many elements in matrix

I am using the errorsarlm() function of the spdep package on a PC with a 64-bit OS and 7.8 GB RAM. The allocated quota by my administrator is 12 GB. Input to my errorsarlm() is: 1) a non-symmetric weight matrix, converted from a .gwt (by means of…
1
vote
1 answer

Using mat2listw function in R to create spatial weights matrix

I am attempting to create a weights object in R with the mat2listw function. I have a very large spatial weights matrix (roughly 22,000x22,000) that was created in Excel and read into R, and I'm now trying to implement: library(spdep)…
user3050574
  • 23
  • 1
  • 5
0
votes
1 answer

spdep: How to extract variables of localG object

I used the localG_perm() function which unlike localmoran_perm() doesn't return a dataframe but instead a localG num object. I'm having trouble extracting the variables ("Gi", "E.Gi", "Var.Gi", "StdDev.Gi", "Pr(z != E(Gi))", "Pr(z != E(Gi)) Sim",…
Corbjn
  • 276
  • 1
  • 10
0
votes
0 answers

Error with calculating localG (Getis-Ord* ststistic) for a set of spatial points

I want to calculate the Getis-Ord* statistic for each point in an R simple feature (SF) point object to detect "hotspots" among land cover classes. To do this, I am using the localG function from the spdep package (link) with a set of neighbor and…
0
votes
0 answers

How to calculate IDW (inverse distance weight) for multipolygon geometry in R (spdep lib)

I have a sfc dataframe and would like to change the weights for my distances from equal weights to IDW. I tried many conversions from multipolygon sfc to other types (like polygon, point, etc.), but it does not seem to work out. I am using R library…
ElMago
  • 11
  • 3
0
votes
0 answers

Singular Spatial Weight Matrix

Good morning, I want to perform a spatial panel regression using the splm package. To do so, I need a Spatial Weight Matrix and I would like to create Distance-Band Weights using the package spdep. I have a shapefile with 7904 elements that you can…
0
votes
2 answers

Difficulty with poly2nb() and nb2mat() in spdep package

I would appreciate some advice on making a spatial weights matrix using the spdep() package. (1) If I have spatial data download from the rnaturalearth package, and a list of countries in another dataset, what is an efficient way to subset the data.…
Lindsay
  • 131
  • 1
  • 10
0
votes
1 answer

How to create a graph file for INLA using region names

i.e. use the region.id of class nb from the spdep package rather than ignoring it as spdep::nb2INLA does? I've been trying to link a column in my data containing these regions as a factor, to an INLA model with a graph describing their spatial…
JCran
  • 375
  • 2
  • 14
0
votes
0 answers

Is there any R package for producing marginal effects plots from interaction terms in spatial models? (Using spdep::lagsarlm)

There are several easy and efficient R packages and functions to produce conditional effects plots (marginal effects) for linear regression models, such as interplot (Solt and Hu 2021), ggeffects (Lüdecke 2018), and JKmisc/ggintfun.R (Karreth 2017).…
Thiago
  • 173
  • 11