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

plot.cdftest

Plot a Spatial Distribution Test


Description

Plot the result of a spatial distribution test computed by cdf.test.

Usage

## S3 method for class 'cdftest'
plot(x, ...,
                   style=c("cdf", "PP", "QQ"),
                   lwd=par("lwd"), col=par("col"), lty=par("lty"),
                   lwd0=lwd, col0=2, lty0=2,
                   do.legend)

Arguments

x

Object to be plotted. An object of class "cdftest" produced by a method for cdf.test.

...

extra arguments that will be passed to the plotting function plot.default.

style

Style of plot. See Details.

col,lwd,lty

The width, colour and type of lines used to plot the empirical curve (the empirical distribution, or PP plot or QQ plot).

col0,lwd0,lty0

The width, colour and type of lines used to plot the reference curve (the predicted distribution, or the diagonal).

do.legend

Logical value indicating whether to add an explanatory legend. Applies only when style="cdf".

Details

This is the plot method for the class "cdftest". An object of this class represents the outcome of a spatial distribution test, computed by cdf.test, and based on either the Kolmogorov-Smirnov, Cramer-von Mises or Anderson-Darling test.

If style="cdf" (the default), the plot displays the two cumulative distribution functions that are compared by the test: namely the empirical cumulative distribution function of the covariate at the data points, and the predicted cumulative distribution function of the covariate under the model, both plotted against the value of the covariate. The Kolmogorov-Smirnov test statistic (for example) is the maximum vertical separation between the two curves.

If style="PP" then the P-P plot is drawn. The x coordinates of the plot are cumulative probabilities for the covariate under the model. The y coordinates are cumulative probabilities for the covariate at the data points. The diagonal line y=x is also drawn for reference. The Kolmogorov-Smirnov test statistic is the maximum vertical separation between the P-P plot and the diagonal reference line.

If style="QQ" then the Q-Q plot is drawn. The x coordinates of the plot are quantiles of the covariate under the model. The y coordinates are quantiles of the covariate at the data points. The diagonal line y=x is also drawn for reference. The Kolmogorov-Smirnov test statistic cannot be read off the Q-Q plot.

Value

NULL.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

op <- options(useFancyQuotes=FALSE)

   # synthetic data: nonuniform Poisson process
   X <- rpoispp(function(x,y) { 100 * exp(x) }, win=square(1))

   # fit uniform Poisson process
   fit0 <- ppm(X, ~1)

   # test covariate = x coordinate
   xcoord <- function(x,y) { x }

   # test wrong model
   k <- cdf.test(fit0, xcoord)

   # plot result of test
   plot(k, lwd0=3)

   plot(k, style="PP")

   plot(k, style="QQ")

   options(op)

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.