spdep

R spdep giant weight matrix

此生再无相见时 提交于 2019-12-23 04:51:11
问题 I'm new to spatial statistics, and I'm trying to create a spatial weight matrix for all Census tracts in the US in R. There are around 74000 tracts. Based on US Census Tiger Files, I created a shapefile of all tracts, and then did (using the spdep package): #Create adjacency matrix am = poly2nb(us) is.symmetric.nb(am) This works fine, though am is pretty large. Next: am = nb2mat(am, style="B",zero.policy=T) Which gives me this error: Error: cannot allocate vector of size 40.9 Gb Obviously my

Create a map of spatial clusters LISA in R

柔情痞子 提交于 2019-12-07 08:10:49
问题 I would like to create a map showing local spatial cluster of a phenomenon, preferably using Local Moran (LISA). In the reproducible example below, I calculate the local moran's index using spdep but I would like to know if there is as simple way to map the clustes, prefebly using ggplot2 . Help ? library(UScensus2000tract) library(ggplot2) library(spdep) # load data data("oregon.tract") # plot Census Tract map plot(oregon.tract) # create Queens contiguity matrix spatmatrix <- poly2nb(oregon

Spatial Autocorrelation Analysis (Global Moran's I) in R

淺唱寂寞╮ 提交于 2019-12-06 04:59:43
问题 I have a list of points I want to check for autocorrelation using Moran's I and by dividing area of interest by 4 x 4 quadrats. Now every example I found on Google (e. g. http://www.ats.ucla.edu/stat/r/faq/morans_i.htm) uses some kind of measured value as the first input for the Moran's I function, no matter which library is used (I looked into the ape and spdep packages). However, all I have are the points themselves I want to check the correlation for. The problem is, as funny (or sad) as

Create a map of spatial clusters LISA in R

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 15:57:18
I would like to create a map showing local spatial cluster of a phenomenon, preferably using Local Moran (LISA). In the reproducible example below, I calculate the local moran's index using spdep but I would like to know if there is as simple way to map the clustes, prefebly using ggplot2 . Help ? library(UScensus2000tract) library(ggplot2) library(spdep) # load data data("oregon.tract") # plot Census Tract map plot(oregon.tract) # create Queens contiguity matrix spatmatrix <- poly2nb(oregon.tract) #calculate the local moran of the distribution of black population lmoran <- localmoran(oregon

Spatial Autocorrelation Analysis (Global Moran's I) in R

天大地大妈咪最大 提交于 2019-12-04 11:23:44
I have a list of points I want to check for autocorrelation using Moran's I and by dividing area of interest by 4 x 4 quadrats. Now every example I found on Google (e. g. http://www.ats.ucla.edu/stat/r/faq/morans_i.htm ) uses some kind of measured value as the first input for the Moran's I function, no matter which library is used (I looked into the ape and spdep packages). However, all I have are the points themselves I want to check the correlation for. The problem is, as funny (or sad) as this might sound, I've no idea what I'm doing here. I'm not much of a (spatial) statistics guy, all I

Using mat2listw function in R to create spatial weights matrix

拈花ヽ惹草 提交于 2019-12-01 11:43:42
问题 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) SW=mat2listw(matrix) I am getting the following error: Error in if (any(x<0)) stop ("values in x cannot be negative"): missing value where TRUE/FALSE needed. What's going wrong here? My current matrix is all 0's and 1's, with no missing values and no negative