Questions tagged [spatstat]

spatstat is an R package for analysing spatial data, mainly Spatial Point Patterns.

spatstat is an R package for analysing spatial data, mainly Spatial Point Patterns. It also supports three-dimensional point patterns, and space-time point patterns in any number of dimensions. The package contains over 1000 functions for plotting spatial data, exploratory data analysis, model-fitting, simulation, spatial sampling, model diagnostics, and formal inference. Data types include point patterns, line segment patterns, spatial windows, pixel images and tessellations.

Resources:

441 questions
1
vote
2 answers

Is it reasonable to use AIC to rank point process models that are based on different likelihood functions (Poisson and Gibbs in this case)?

I am using spatstat version 3.0.2 to explore settlement patterns in archaeological data in five different periods throughout prehistory. I have formulated several point process models with different covariates including elevation, slope, etc. In…
1
vote
1 answer

Show all symbols in legend in spatstat

I'm plotting a forest with trees as in the sample data lansing in spatstat. My code is as in this example: plot(lansing, cols=rainbow(length(unique(lansing$marks))), leg.args=list(y.intersp = .5, cex = .2, pt.cex = .2)) But I have 14 tree…
Qiyuan
  • 109
  • 10
1
vote
1 answer

Using nndist.ppx to obtain near neighbor distances in multidimensional point pattern

I am fairly new to R and programming in general, so I appreciate your input. I'm trying to obtain the nearest neighbor distances for a set of points. My data consists of the scores on the first 4 Principal Components (PCs) of a PCA on morphological…
MJA
  • 11
  • 2
1
vote
1 answer

Model a 3D Point Pattern using spatstat

Is there any way to fit a spatial statistical model to 3d data in spatstat? I have tried using the functions such as ppm and kppm but they are not working for pp3
1
vote
2 answers

How to get the best polygon point pattern data in spatstat analysis in R

I have a dataset of spatial locations data. I want to do a point pattern analysis using the spatstat package in R using this data. I want the best polygon area for the analysis instead of the rectangle area. The code I have is original_data =…
MK Huda
  • 605
  • 1
  • 6
  • 16
1
vote
1 answer

spatstat: Multidimensional Space-Time Point Pattern

I'm trying to model a Multidimensional Space-Time Point Pattern (ppx object from spatstat package). But I didn't find any way at package documentation. I tried this: library(spatstat) set.seed(2022) df <-…
oespinozah
  • 11
  • 2
1
vote
1 answer

R package 'spatstat' not loading

I have downloaded and installed the 'spatstat' package multiple times, including by downloading the files. But every time I try to run it i get this error Failed with error: ‘package ‘spatstat.data’ required by ‘spatstat’ could not be found’` I've…
user18790654
1
vote
1 answer

Creation of correlated marks. E.g. point sizes varying with inter-point distances

I recently dabbled a bit into point pattern analysis and wonder if there is any standard practice to create mark correlation structures varying with the inter-point distance of point locations. Clearly, I understand how to simulate independent…
Codo1981
  • 11
  • 3
1
vote
1 answer

Unexpected result with weights in spatstat::density.psp()

I am trying to use kernel density smoothing to map the intensity of possible pest escape from vehicle traffic. Each route has been broken down into straight lines with each line having an integer attribute for the number of times the segment was…
Josh Persi
  • 83
  • 1
  • 7
1
vote
1 answer

Nearest-neighbour distances of a point pattern by year

I wish to calculate the nearest-neighbour distances (NNDs) of a point pattern by year with spatstat but get an error, although I cannot see any difference with the example provided in the documentation. What's the right way to do…
syre
  • 902
  • 1
  • 7
  • 19
1
vote
1 answer

Obtain values from simulated mppm in spatstat

I have obtained an mppm object by fitting a model on several independent datasets using the mppm function from the R package spatstat. How can I generate simulated realisations of this model and obtain the x, y, and marks attributes of the…
1
vote
1 answer

Create a unique object in UTM with mixture of zones

I'd like to use my spatial data set (sp_ds) as ppp (spatstat Point Pattern object) for complete spatial tests purposes, and I try to do: # Packages library(spatstat) library(sf) library(sp) library(raster) ## maybe a cause of pointDistance()…
Leprechault
  • 1,531
  • 12
  • 28
1
vote
1 answer

Point pattern classification with spatstat: what am I doing wrong?

I’am trying to classify bivariate point patterns into groups using spatstat. The patterns are derived from the whole slide images of lymph nodes with cancer. I’ve trained a neural network to recognize cells of three types (cancer “LP”, immune cells…
Sergej S
  • 37
  • 4
1
vote
2 answers

Specifying a set number of points when simulating a LGCP kppm

It seems that there are methods for using a set number of points when simulating some ppm objects (for example, through manipulating the rmhcontrol options), but I don't see a similar option for LGCP. After looking through the documentation and…
1
vote
1 answer

Convert sf to marked ppp

I successfully converted an sf object to ppp using the code below: sf_owin = maptools::as.ppp.SpatialPointsDataFrame(as_Spatial(sf_points__flat)) sf_points__flat looks like this: Simple feature collection with 131 features and 3 fields geometry…
Ed_Gravy
  • 1,841
  • 2
  • 11
  • 34