Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pseudoR2

Calculate Pseudo-R-Squared for Point Process Model


Description

Given a fitted point process model, calculate the pseudo-R-squared value, which measures the fraction of variation in the data that is explained by the model.

Usage

pseudoR2(object, ...)

  ## S3 method for class 'ppm'
pseudoR2(object, ..., keepoffset=TRUE)

Arguments

object

Fitted point process model. An object of class "ppm".

keepoffset

Logical value indicating whether to retain offset terms in the model when computing the deviance difference. See Details.

...

Additional arguments passed to deviance.ppm.

Details

The function pseudoR2 is generic, with methods for fitted point process models of class "ppm".

This function computes McFadden's pseudo-Rsquared

R^2 = 1 - D/D0

where D is the deviance of the fitted model object, and D0 is the deviance of the null model. Deviance is defined as twice the negative log-likelihood or log-pseudolikelihood.

The null model is usually obtained by re-fitting the model using the trend formula ~1. However if the original model formula included offset terms, and if keepoffset=TRUE (the default), then the null model formula consists of these offset terms. This ensures that the pseudoR2 value is non-negative.

Value

A single numeric value.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

fit <- ppm(swedishpines ~ x+y)
  pseudoR2(fit)

  xcoord <- as.im(function(x,y) x, Window(swedishpines))
  fut <- ppm(swedishpines ~ offset(xcoord/200) + y)
  pseudoR2(fut)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.