Questions tagged [spdep]
The spdep tag has no usage guidance.
29
questions
0
votes
1
answer
27
views
spdep::localmoran How to access classified cluster values?
I am trying to get a LISA cluster map similar to this one, eg showing the 'High-high', 'Low-Low'.. cllassified values.
But, I can't figure out how to extract this classifications from the ...
0
votes
0
answers
10
views
Regression model where N is greater than number of polygons
I'm trying to construct an analysis where 100 users record data for each polygon in the map below, a total of 17 values per user. Using the values from each polygon, I wanted to generate a model that ...
0
votes
1
answer
44
views
Combine neighbors lists while estimating a spatial lag model with multiple time periods with R
I am trying to estimate a spatial lag model for a dataset of U.S. school districts with four years of data. The issue is that the dimensions of the school districts change every year (i.e. the ...
0
votes
0
answers
72
views
LISA clusters present very different values for the Low-Low quadrant. spdep x rgeoda
I am performing an Local Moran LISA clusters analysis using R package spdep. In some moment I compared the results with rgeoda package. OK if has some differ between them, different implementations, ...
1
vote
1
answer
79
views
poly2nb {spdep} how identify if two cities are neighbours
I'm trying to identify if two cites are neighbours using spdep::poly2nb function, but it returns a list with numbers that i can't understand.
For example,
shp_ce <- rgdal::readOGR(dsn = "...
0
votes
0
answers
40
views
Spatial neighbors to voxels for R-INLA
I am working on an fMRI dataset that I want to analyse using a Bayesian spatial model in R-INLA. I extracted the coordinates for all these voxels. (See the image to get an impression one such a ...
0
votes
2
answers
219
views
Applying Moran's I across columns
So I find myself needing to apply global Moran's I across ~20 variables (as in ~20 instances of univariate autocorrelation for each variable, not attempted multivariate spatial autocorrelation). I'm ...
1
vote
2
answers
533
views
Calculate sum/average of variable within each group of neighboring counties using R
I am trying to calculate the sum and/or average value of a variable for each group of neighboring counties in the US. I realized this needs at least two steps:
For every county, find the set of ...
4
votes
1
answer
495
views
KNN for spatial data and two sets of coordinates
I'm trying to estimate an average value of distances to K nearest neighbors. I have two sets of coordinates and I'm trying to estimate the average distance from each point in one set of coordinates to ...
1
vote
1
answer
554
views
bivariate LISA in R [closed]
I am new to R. I am interested to estimate Moran's I result. Specifically, a map of the bivariate spatial correlation (bivariate LISA) in R using spdep and ggplot2 package. I have points data over ...
2
votes
1
answer
280
views
Moran's I statistical significance with spdep mc.moran function
I would like to obtain Moran's I estimation together with its p-value from a raster data layer --which has na value-- including a figure showing the simulation distribution by mean of spdep::mc.moran()...
1
vote
1
answer
570
views
Ignore NAs when getting lagged values in spdep
I'm trying to replicate a study on gentrification of neighbourhoods and I'm dealing with some missing values of mean rent and selling prices for some neighbourhoods. Since these values are very ...
5
votes
1
answer
783
views
How to assign a neighbour status to unlinked polygons
This question is, in part, a follow up to: https://stackoverflow.com/questions/57269254/how-to-impute-missing-neighbours-of-a-spatial-weight-matrix-queen-contiguity
I have a .shp similar in structure ...
1
vote
1
answer
1k
views
Simple KNN for spatial data
I try to find an example to estimate an average value associated to a coordinate, with K nearest neighbors. I found this very help tutorial regional smoothing.
This code can find the k nearest ...
0
votes
0
answers
526
views
Problems with adjacency matrix with poly2nb in R
I am working with a shapefile of Ohio precincts, with the hope of performing areal regression models (probably BYM2). To build the adjacency matrix, I used poly2nb from the spdep package. As a double-...
1
vote
0
answers
28
views
On the calculus of joint-count test on no-full grid
I have a data points of presence-absence records and I want to perform joint-count test as it was suggested in the post https://gis.stackexchange.com/a/388939/178392 by calculating it on a grid (...
1
vote
0
answers
196
views
On the calculus of the variable "autocov" from spdep package
I’m facing a spatial autocorrelation problem and I want to calculate the « autocov» covariate through the function autocov_dist from spdep package. The problem is when I defined the neighborhood ...
2
votes
1
answer
288
views
Spatial neighbors in ggplot2
I'm trying to make a space plot with ggplot() as indicated here, but I'm having trouble using the nb2lines() function.
.shp files are here
Error in if (!is.na(projargs) && !nzchar(projargs)) ...
3
votes
1
answer
1k
views
Moran's I z-value in spdep
I wish to incrementally find the neighbour distance which maximises Moran's I test statistic. I have read that the I values are not comparable across varying spatial weight matrices but that the z-...
2
votes
1
answer
2k
views
poly2nb {spdep} not identifying neighbours correctly
I am trying to do some spatial generalised linear mixed models for areal unit data with the CARBayes package. As part of this, I need to identify the polygon neighbours into a neighbour list using ...
0
votes
1
answer
382
views
How to convert coordinates to shapefile with R package's dataset?
I need construct spatial weight matrix for data which syear=1995 (house$s1995==1)in housedataset in spdeppackage,So I tried writeOGR function as the link suggeust to get shapefile enter link ...
-1
votes
1
answer
240
views
The slot for "plotOrder" comes up as 1 instead of a vector with length specific to my data
My goal is to find neighbors from my SpatialPolygons object using the poly2nb() command from the sp package in R.
This is my code thus far:
p <- s_gis %>%
select(long, lat) %>%
...
0
votes
1
answer
399
views
How do you find the appropriate spatial weight to use for a spatial analysis? [closed]
I am currently about to run a spatial regression (OLS, Lag, Error etc) for my dataset. My dataset contains 1000 randomly generated points throughout the utilisation distribution for my animals (so, ...
3
votes
0
answers
694
views
LISA (local indicators of spatial association) p values in R versus in Geoda
When calculating LISA statistics in GeoDa versus using the localmoran() function in spdep, the I values are nearly the same, but the p values can be quite different.
I know the two programs calculate ...
4
votes
1
answer
12k
views
Merge spatial and non-spatial data and create SpatialPolygonsDataFrame in r
I am trying to merge non-spatial data (data frame in R) and spatial data (SpatialPolygonsDataFrame in R) and eventually create the merged file in SpatialPolygonsDataFrame form.
In specific, I ...
3
votes
1
answer
502
views
Out-of-Sample predictions with spdep::sarlm
I am trying to make an out of-sample-prediction for spatial data using the spdep package. The documentation claims that this should be possible. However, I do not understand how it works. In ...
4
votes
0
answers
687
views
Spatial weight matrix with boundary effects in R?
I need some help to finalize code for a spatial weight matrix that uses a nearest neighbor definition within regions, but does not allow neighbors from across a political border. For example, ...
1
vote
0
answers
681
views
Using errorsalm() from spdep with multilevel data?
I have a dataset that has multiple observations per county, and I am interested in estimating the effect of a county-level variable on individual-level outcomes. I would like to account for adjacency ...
8
votes
3
answers
2k
views
Calculating spatial lags per year in R
At the moment I am having some difficulties with calculating a spatial lag in R.
I know how to calculate the lag in space-wide format but am unable to do it in long form, i.e. have repeated ...