Learn R Programming

spatstat.model (version 3.4-0)

addapply: Significance Tests or Effect Size for Single Term Additions to a Model

Description

Given a fitted point process model, consider adding new explanatory variables, and apply a significance test (or effect size calculation) for the effect of each new variable.

Usage

addapply(object, 
         action = c("berman.test", "cdf.test", "rhohat", "roc"),
         scope, 
         ..., high = TRUE)

Value

A named list containing the results for each added variable.

The list belongs to the class "anylist"

so it can be printed and plotted in its entirety.

If action="roc" the individual entries are ROC curves belonging to class "fv". If action="rhohat" the individual entries are curves belonging to class "fv" and class "rhohat". If action="berman.test" the individual entries are hypothesis tests of class "htest" and "bermantest". If action="cdf.test" the individual entries are hypothesis tests of class "htest" and "cdftest".

Arguments

object

A fitted point process model (object of class "ppm", "kppm", "dppm", "slrm" or "lppm") specifying the model to be extended.

action

Character string (partially matched) specifying the hypothesis test to be performed, or other calculation.

scope

A formula or a character vector specifying the variable or variables that are to be considered for addition, or a fitted point process model containing all these variables.

high

Argument passed to roc to specify whether the ROC curves should be based on high or low values of the covariates, when action="roc". Either a logical value, or a logical vector of the same length as scope.

...

Other arguments passed to the relevant function roc, rhohat, berman.test or cdf.test. This includes arguments passed to as.mask to control the pixel resolution used for calculation.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Ege Rubak rubak@math.aau.dk and Suman Rakshit Suman.Rakshit@curtin.edu.au.

Details

This function is like add1 in that it considers adding new terms to the model object and measures the change in the model. In this case the change is measured by performing the action. Options are:

action="roc":

the ROC curve for the added covariate is computed using the original model object as a baseline.

action="berman.test":

One of Berman's tests is applied (see berman.test), using the original model object as the null hypothesis, and the extended model as the alternative.

action="cdf.test":

One of the CDF tests is applied (see cdf.test), using the original model object as the null hypothesis, and the extended model as the alternative.

action="rhohat":

taking the original model object as a baseline, the true intensity (ratio of true intensity to baseline intensity) is estimated as a function of the added explanatory variable, using the function rhohat.

Note that addapply(object, "roc", scope) is equivalent to addROC(object, scope).

Either object or scope should be a fitted point process model, and the other argument may be a fitted point process model or a formula. If object is a fitted model then scope may be a character vector of the names of variables to be added.

References

Baddeley, A., Rubak, E., Rakshit, S. and Nair, G. (2025) ROC curves for spatial point patterns and presence-absence data. tools:::Rd_expr_doi("10.48550/arXiv.2506.03414").

See Also

addROC, dropROC, roc.ppm, rhohat, berman.test, cdf.test

Examples

Run this code
  dimyx <- if(interactive()) NULL else 32
  fit0 <- ppm(bei ~ 1, data=bei.extra)
  z <- addapply(fit0, "ber", . ~ grad+elev, dimyx=dimyx)
  z
  plot(z, mar.panel=5)

  ## how to extract p-values from each test
  sapply(z, getElement, name="p.value")

Run the code above in your browser using DataLab