Learn R Programming

spatstat.core (version 2.3-1)

compareFit: Residual Diagnostics for Multiple Fitted Models

Description

Compares several fitted point process models using the same residual diagnostic.

Usage

compareFit(object, Fun, r = NULL, breaks = NULL, ...,
         trend = ~1, interaction = Poisson(), rbord = NULL,
         modelnames = NULL, same = NULL, different = NULL)

Arguments

object

Object or objects to be analysed. Either a fitted point process model (object of class "ppm"), a point pattern (object of class "ppp"), or a list of these objects.

Fun

Diagnostic function to be computed for each model. One of the functions Kcom, Kres, Gcom, Gres, psst, psstA or psstG or a string containing one of these names.

r

Optional. Vector of values of the argument \(r\) at which the diagnostic should be computed. This argument is usually not specified. There is a sensible default.

breaks

Optional alternative to r for advanced use.

Extra arguments passed to Fun.

trend,interaction,rbord

Optional. Arguments passed to ppm to fit a point process model to the data, if object is a point pattern or list of point patterns. See ppm for details. Each of these arguments can be a list, specifying different trend, interaction and/or rbord values to be used to generate different fitted models.

modelnames

Character vector. Short descriptive names for the different models.

same,different

Character strings or character vectors passed to collapse.fv to determine the format of the output.

Value

Function value table (object of class "fv").

Details

This is a convenient way to collect diagnostic information for several different point process models fitted to the same point pattern dataset, or for point process models of the same form fitted to several different datasets, etc.

The first argument, object, is usually a list of fitted point process models (objects of class "ppm"), obtained from the model-fitting function ppm.

For convenience, object can also be a list of point patterns (objects of class "ppp"). In that case, point process models will be fitted to each of the point pattern datasets, by calling ppm using the arguments trend (for the first order trend), interaction (for the interpoint interaction) and rbord (for the erosion distance in the border correction for the pseudolikelihood). See ppm for details of these arguments.

Alternatively object can be a single point pattern (object of class "ppp") and one or more of the arguments trend, interaction or rbord can be a list. In this case, point process models will be fitted to the same point pattern dataset, using each of the model specifications listed.

The diagnostic function Fun will be applied to each of the point process models. The results will be collected into a single function value table. The modelnames are used to label the results from each fitted model.

See Also

ppm, Kcom, Kres, Gcom, Gres, psst, psstA, psstG, collapse.fv

Examples

Run this code
# NOT RUN {
   nd <- 40
   
# }
# NOT RUN {
   ilist <- list(Poisson(), Geyer(7, 2), Strauss(7))
   iname <- c("Poisson", "Geyer", "Strauss")
   
# }
# NOT RUN {
   K <- compareFit(swedishpines, Kcom, interaction=ilist, rbord=9,
            correction="translate",
            same="trans", different="tcom", modelnames=iname, nd=nd)
   K
# }

Run the code above in your browser using DataLab