Code Monkey home page Code Monkey logo

spatstat.model's Introduction

spatstat.model

Parametric statistical modelling of spatial data for the spatstat family

CRAN_Status_Badge GitHub R package version

The original spatstat package has been split into several sub-packages (See spatstat/spatstat)

This package spatstat.model is one of the sub-packages. It contains all the main user-level functions that perform parametric statistical modelling of spatial data, with the exception of data on linear networks.

Most of the functionality is for spatial point patterns in two dimensions. There is a very modest amount of functionality for 3D and higher dimensional patterns and space-time patterns.

Overview

spatstat.model supports

  • parametric modelling (fitting models to point pattern data, model selection, model prediction)
  • formal inference (hypothesis tests, confidence intervals)
  • informal validation (model diagnostics)

Detailed contents

For a full list of functions, see the help file for spatstat.model-package.

Parametric modelling

  • fitting Poisson point process models to point pattern data (ppm)
  • fitting spatial logistic regression models to point pattern data (slrm)
  • fitting Cox point process models to point pattern data (kppm)
  • fitting Neyman-Scott cluster process models to point pattern data (kppm)
  • fitting Gibbs point process models to point pattern data (ppm)
  • fitting determinantal point process models to point pattern data (dppm)
  • fitting recursively partitioned models to point patterns (rppm)
  • class support for fitted models (update, print, summary, predict, plot, simulate, coef, confint, vcov, anova, residuals, fitted, deviance, AIC, logLik, terms, formula, model.matrix)
  • minimum contrast estimation (generic algorithm)
  • simulation of fitted point process models

Formal inference

  • hypothesis tests (quadrat test, Clark-Evans test, Berman test, Diggle-Cressie-Loosmore-Ford test, scan test, studentised permutation test, segregation test, ANOVA tests of fitted models, adjusted composite likelihood ratio test, envelope tests, Dao-Genton test, balanced independent two-stage test)
  • confidence intervals for parameters of a model
  • prediction intervals for point counts

Informal validation

  • residuals
  • leverage
  • influence
  • partial residual plot
  • added variable plot
  • diagnostic plots
  • pseudoscore residual plots
  • model compensators of summary functions
  • Q-Q plots

spatstat.model's People

Contributors

baddstats avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spatstat.model's Issues

Error with envelope.ppm (probably envelopeEngine) for non regular windows

When computing envelopes for an inhomogenous ppm in a rotated window, the current version of envelope.ppm() (spatstat.model v 3.2-8) returns an error. Last year's version (v 3.0-2) performed ok.

For example, this works in both versions:

ex.ppp <- redwood
rwtrend <- density(ex.ppp)
ex.ppm<- ppm(ex.ppp~rwtrend)
ex.env<-envelope(ex.ppm, Kinhom, lambda=ex.ppm, nsim=19)
plot(ex.env, sqrt(./pi)-r~r, legend=FALSE)

This example, with rotated window, works in the old version but not in the current one (it returns the error:
"Error in eval(call, as.list(envir), enclos = callframe) :
object 'X' not found"

ex.ppp <- redwood
newW <- rotate(ex.ppp$window, angle=pi/3, centre="centroid")
ex.ppp <- ex.ppp[newW]
rwtrend <- density(ex.ppp)
ex.ppm<- ppm(ex.ppp~rwtrend)
ex.env<-envelope(ex.ppm, Kinhom, lambda=ex.ppm, nsim=19)
plot(ex.env, sqrt(./pi)-r~r, legend=FALSE)

Test suite error under Debian

Hi,
when I try to upgrade spatstat.model to its latest version 3.2-6 I get a test suite error which can be seen in the full Debian CI log. It starts with

> FULLTEST <- (nchar(Sys.getenv("SPATSTAT_TEST", unset="")) > 0)
> ALWAYS   <- TRUE
> cat(paste("--------- Executing",
+           if(FULLTEST) "** ALL **" else "**RESTRICTED** subset of",
+           "test code -----------\n"))
--------- Executing **RESTRICTED** subset of test code -----------
> #
> # tests/kppm.R
> #
> # $Revision: 1.38 $ $Date: 2023/02/28 04:00:42 $
> #
> # Test functionality of kppm that depends on RandomFields
> # Test update.kppm for old style kppm objects
>
> if(!FULLTEST)
+   spatstat.options(npixel=32, ndummy.min=16)
>
> local({
+
+  fit <- kppm(redwood ~1, "Thomas") # sic
+  fitx <- kppm(redwood ~x, "Thomas", verbose=TRUE)
+  if(FULLTEST) {
+    fitx <- update(fit, ~ . + x)
+    fitM <- update(fit, clusters="MatClust")
+    fitC <- update(fit, cells)
+    fitCx <- update(fit, cells ~ x)
+    #'
+    Wsub <- owin(c(0, 0.5), c(-0.5, 0))
+    Zsub <- (bdist.pixels(Window(redwood)) > 0.1)
+    fitWsub <- kppm(redwood ~1, "Thomas", subset=Wsub)
+    fitZsub <- kppm(redwood ~1, "Thomas", subset=Zsub)
+    fitWsub

Please have a look at the full log to see the complete error message as well as the R packages used when running this test.

Kind regards, Andreas.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.