Questions tagged [spatstat]

spatstat is a package for the statistical software suite R to conduct spatial point pattern analysis and modeling

Filter by
Sorted by
Tagged with
2
votes
1answer
31 views

Calculating the cross-nearest-neighbor distance in spatstat

I wish to calculate the cross-nearest-neighbor distance between two point patterns in spatstat. According to Pr. Sadahiro, the cross-nearest-neighbor distance is defined as: My inputs are sf datasets,...
0
votes
0answers
56 views

Point pattern analysis in R

I am quite new to R and am having some trouble setting up my data for some point pattern analysis. What I want to do: conduct a point pattern analysis on NYC arrest data and see if there exists a ...
0
votes
0answers
62 views

How do you convert SpatialPoints object to PPP object?

I have a shapefile layer of polygons (houses in a city) that I want to run a kernel density on using the density() function in spatstat in R. To get my polygons as points I turned them into ...
1
vote
0answers
20 views

R statspat package (or similar pkg) and convert back to spatial objects

I've been testing the waters and doing some basic overview on the statspat package. This is a complex package and would likely require some serious effort to jump in and then get familiar with the ...
1
vote
1answer
64 views

Shapefile vector point to ppp spatstat with polygon windows

I always get error to this when converting shapefile point to ppp spatstat that windowed by a polygon shapefile # polygon that to be window neighborhoods <- st_read("neighborhoods/...
0
votes
0answers
24 views

Comparing results of cross K-L functions for point patterns

Given marked point patterns with types a, b, and c, spatstat in R allows to easily calculate cross K(a,b) and L(a,b) functions. Envelopes can be used to estimate the significance at a given alpha (0....
0
votes
1answer
43 views

Estimating spatial autocorrelation from counts on linear network [closed]

I'm working with count data sampled along roadways. I would like to estimate the spatial autocorrelation of the counts, but I'm having trouble wrapping my head around how to incorporate the network ...
0
votes
0answers
22 views

Superpixel segmented image boundary into SpatialPolygons format

I have an image mask segmented through superpixels algorithm like this. I want to just extract its boundary and save it as a shapefile SpatialPolygons for using spatstat. Can anyone help on how to go ...
1
vote
1answer
31 views

Error in converting shapefiles into spatstat window

I wish to import shapefiles of the Seoul Capital Area to use as a window in spatstat. The SCA is the combination of the Seoul, Incheon, and Gyeonggi-do level-1 administrative areas of South Korea. I ...
1
vote
0answers
18 views

How much W shape effects on the cross correlation of points in R

I am analyzing cross-correlation between these two-point data sets (all the analyses have been performed in R: by using Kcross, Lcross functions). In the first trial, I was using an irregular ...
0
votes
0answers
61 views

The confidence level alfa value for spatial randomness with Ripley K and L function

I have a point set of the spatial distribution of twitter posts relevant to a certain event. I would like to evaluate evidence for clustering or dispersion of points. This is usually performed by ...
1
vote
0answers
34 views

Replicated Point Pattern: Get Density Variance Between Replicated Patterns and Subtract from Composite

I have written a lengthy code that dissects differently shaped/sized windows into recognizable components (individual cells in the image), gets the point density within each cell, then builds a whole ...
2
votes
1answer
509 views

calculate distance of points from centroid

I have a spatialpoints object, and a spatialpolygonsdataframe, composed of rectangular cells, and which the spatialpoints fall into. What I would like is to determine which polygon in the ...
1
vote
1answer
14 views

DSpat::create.lines and spatstat::rlinegrid: Adding too many lines?

Does anybody know of an issue with either DSpat's create.lines or spatstat's rlinegrid? Whenever I use these functions on my Windows (owins), the output has far too many lines. For example, if I run ...
1
vote
1answer
97 views

Connecting spatiallines or SpatialPoints based on minimum distance using R

Does anybody know of a way to create a single polygon (that will eventually be converted to an Owin) from either a spatialpoints object or a spatiallines object? Here is an example of each: Here's ...
2
votes
1answer
48 views

Aligning Multiple Polygons (Based on centroid possibly) [Spatstat, sf, sp]

I'm trying to create a composite/average of multiple similarly shaped polygons. I think the first step is most likely to align them via the centroid of each polygon. Does anybody know of a tool to ...
2
votes
2answers
637 views

QGIS enabling R via plugin

System Ubuntu 19.10, QGIS 3.4 I am trying to utilise R in QGIS for Ripley's K function. The sample R script 'Scatterplot' works with the Processing R Provider plugin, which indicates r-base is ...
1
vote
1answer
104 views

Generating pattern in each of set of polygons using sp (r)?

I have an object of class SpatialPolygonsDataFrame, and for each polygon in the dataframe I have a number of points I would like to generate in that polygon (e.g. I have 130 polygons, and I have a ...
2
votes
2answers
535 views

R (spatstat, sp, sf): Grid a single polygon, divide, alphanumeric labels based on column/row

I am trying to take a polygon and add grid lines over top, then divide the polygon into many polygons based on the grids. I've accomplished this through st_make_grid() and raster::intersect(). The ...
1
vote
0answers
72 views

Multiple Spatial Point Patterns, create “average” heatmap

I am using R's spatstat package to analyze spatial patterns of objects across plant leaves. Let's say I have 10 leaves, each with corresponding X,Y coordinates of the objects and a window in the ...
1
vote
1answer
64 views

Point.in.polygon function in sf package miscalculate the distribution of points

I am using point.in.polygon function in sf package to determine whether a set of data fall within a polygon or not. Here is a snippet of the data and polygon visualization As the figure shows, there ...
1
vote
1answer
57 views

Convert ppp object to multitpe object

I am working on spatial point pattern analysis using R. I have two sets of coordinates, both defined inside a 32*20 region. I first convert two data sets to ppp objects: Tumor_CD8 <- ppp(...
3
votes
0answers
88 views

Test the relationship between two point patterns

I have two point patterns obtained from medical images. Points are used to represent cell markers. By visualization, the point pattern A is extremely possible to be a subset of point pattern B. So is ...
0
votes
0answers
120 views

Generating Pseudo-Absences in spatialEco?

I want to generate pseudo absences based on kernel density estimate from a linear feature spatial line layer, where pseudo absences have a higher probability of being sampled near a line. I have ...
1
vote
1answer
154 views

Adjusting resolution of spatstat::pixellate.psp() output

I am trying to accomplish exactly what is being done in this question: Convert line shapefile to raster, value=total length of lines within cell using spatstat::pixellate.psp() technique (see third ...
1
vote
1answer
217 views

Kernel Density Map points rejected as outside window

I am trying to make a kernel density plot of a points shapefile like so: library(rgdal) library(spatstat) library(maptools) points <- readOGR(dsn = "C:\\Documents", layer = "...
2
votes
0answers
67 views

One-dimensional data in spatstat

I have data of one-dimensional points (locations in a straight line). I want to check if the cluster poisson process models or Cox models are a good fit for the data. Since my data only has x-...
0
votes
1answer
335 views

How to have a Raster output of a ppm model in spastat

I am trying to compare the outputs of species distribution models. My current code uses the following function to calculate TSS scores. TSS_Score<-function(TrueBinary, Raster) { Raster[]<-as....
1
vote
2answers
75 views

Error in pairdist calculation

I'm trying to calculate pair distances among the points of my dataset. I have point in EPSG:3857. This is the code I ran: I import the data, then: coordinates(datPb) <- c("X","Y") proj4string(...
3
votes
1answer
2k views

Removing frame/plot borders from plot.im output

I am plotting point density using the plot.im command in spatstat, and my output always has a frame around the plotted image that becomes thicker when I increase resolution for export. I tried frame=F,...
1
vote
1answer
781 views

Creating polygonal windows for spatial analysis in r

I am attempting to normalize a spatial point pattern using a population density raster in r. My problem is that the function I am trying to run is recognizing the "white space" around the raster I am ...
14
votes
1answer
3k views

Calculating road density in R using kernel density? [closed]

I have a large (~70MB) shapefile of roads and want to convert this to a raster with road density in each cell. Ideally I'd like to do this in R along with GDAL command line tools if necessary. My ...
0
votes
1answer
459 views

Adding 'marks' to point file in spatstat?

Using help on this site I have already got the following code from where I can perform certain analyses. However, I'd now like to perform analyses on a certain variable (column z) within the point ...
3
votes
1answer
713 views

Adding point shapefile layer to polygon shapefile window in R?

I'm new to Spatstat for R and I'm trying to add a point layer to a window I've created from a polygon. I see questions like this have been asked before but I still can't get what I need from the ...
1
vote
2answers
1k views

R package spatstat: How to use point process model covariate as factor when pixel image values are numeric

I am trying to model a point process with an image covariate using the ppm() function in the spatstat package in R. I convert my raster to an im object for use with spatstat, and I run into a problem ...
1
vote
3answers
3k views

Converting raster to im object for point process model covariate in R?

I am trying to convert a raster object to an .im object for use with a point process model in the spatstat package in R. I begin by creating the raster from a tiff file using the raster() package. No ...
1
vote
1answer
2k views

How to find highest kernel density point

I've been using spatstat to analyse point patterns in R. Here's an example to put this in context: library(spatstat) library(maptools) # to convert sp class to ppp Some point data: set.seed(1985) x ...
0
votes
1answer
2k views

How can I connect my point pattern shapefile with my polygon window in R?

I would like to do some spatial statistics in R. I have a point layer called '1983' that represents the distribution of one species, and a polygon layer called 'SA-R' that represents the study area. ...
2
votes
1answer
1k views

Python equivalent of spatstat's spatial point process functions

Is there a free Python package (i.e. PySAL?) that implements the standard summary statistics for spatial point processes, e.g. the F, G, J, and K functions? I'm happy to use R (i.e. spatstat) if that'...
2
votes
1answer
2k views

R - Crop a pixel image produced by spatstat with a boundary shape

i am using the very good spatial statistic package spatstat to produce probability maps of spatial point patterns. Here is a simple working result from the examples to try out. require(spatstat) ...
12
votes
3answers
7k views

How to get the second nearest neighbor between two point patterns in R?

Is there a way to get the distances for the second nearest neighbor between two point patterns in R? The spatstat package has a function called nncross but it only applies to the nearest neighbors ...
22
votes
3answers
5k views

Using R with ArcGIS Desktop?

I've used the integration of R with QGIS, and found it a very uesful tool. Having taken a look at the R toolbox extension for 9 and the extension for 10 it appears they both offer only point ...