Learn R Programming

spatstat.linnet (version 3.2-2)

pseudoR2.lppm: Calculate Pseudo-R-Squared for Point Process Model on Linear Network

Description

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

Usage

# S3 method for lppm
pseudoR2(object, ..., keepoffset=TRUE)

Value

A single numeric value.

Arguments

object

Fitted point process model on a linear network. An object of class "lppm".

keepoffset

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

...

Additional arguments passed to deviance.lppm.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

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

This function computes McFadden's pseudo-Rsquared $$ R^2 = 1 - \frac{D}{D_0} $$ where \(D\) is the deviance of the fitted model object, and \(D_0\) 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.

See Also

pseudoR2, deviance.lppm.

Examples

Run this code
  X <- rpoislpp(10, simplenet)
  fit <- lppm(X ~ y)
  pseudoR2(fit)

Run the code above in your browser using DataLab