Spatstat Manual
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 1546
Download | |
Open PDF In Browser | View PDF |
Package ‘spatstat’ January 29, 2018 Version 1.55-0 Date 2018-01-29 Title Spatial Point Pattern Analysis, Model-Fitting, Simulation, Tests Author Adrian Baddeley, Rolf Turner and Ege Rubak , with substantial contributions of code by Kasper Klitgaard Berthelsen; Ottmar Cronie; Yongtao Guan; Ute Hahn; Abdollah Jalilian; Marie-Colette van Lieshout; Greg McSwiggan; Tuomas Rajala; Suman Rakshit; Dominic Schuhmacher; Rasmus Waagepetersen; and Hangsheng Wang. Additional contributions by M. Adepeju; C. Anderson; Q.W. Ang; M. Austenfeld; S. Azaele; M. Baddeley; C. Beale; M. Bell; R. Bernhardt; T. Bendtsen; A. Bevan; B. Biggerstaff; A. Bilgrau; L. Bischof; C. Biscio; R. Bivand; J.M. Blanco Moreno; F. Bonneu; J. Burgos; 1 2 S. Byers; Y.M. Chang; J.B. Chen; I. Chernayavsky; Y.C. Chin; B. Christensen; J.-F. Coeurjolly; K. Colyvas; R. Constantine; R. Corria Ainslie; R. Cotton; M. de la Cruz; P. Dalgaard; M. D'Antuono; S. Das; T. Davies; P.J. Diggle; P. Donnelly; I. Dryden; S. Eglen; A. El-Gabbas; B. Fandohan; O. Flores; E.D. Ford; P. Forbes; S. Frank; J. Franklin; N. Funwi-Gabga; O. Garcia; A. Gault; J. Geldmann; M. Genton; S. Ghalandarayeshi; J. Gilbey; J. Goldstick; P. Grabarnik; C. Graf; U. Hahn; A. Hardegen; M.B. Hansen; M. Hazelton; J. Heikkinen; M. Hering; M. Herrmann; P. Hewson; K. Hingee; K. Hornik; P. Hunziker; J. Hywood; R. Ihaka; C. Icos; A. Jammalamadaka; 3 R. John-Chandran; D. Johnson; M. Khanmohammadi; R. Klaver; P. Kovesi; L. Kozmian-Ledward; M. Kuhn; J. Laake; F. Lavancier; T. Lawrence; R.A. Lamb; J. Lee; G.P. Leser; H.T. Li; G. Limitsios; A. Lister; B. Madin; M. Maechler; J. Marcus; K. Marchikanti; R. Mark; J. Mateu; P. McCullagh; U. Mehlig; F. Mestre; S. Meyer; X.C. Mi; L. De Middeleer; R.K. Milne; E. Miranda; J. Moller; M. Moradi; V. Morera Pujol; E. Mudrak; G.M. Nair; N. Najari; N. Nava; L.S. Nielsen; F. Nunes; J.R. Nyengaard; J. Oehlschlaegel; T. Onkelinx; S. O'Riordan; E. Parilov; J. Picka; N. Picard; M. Porter; S. Protsiv; A. Raftery; S. Rakshit; B. Ramage; P. Ramon; 4 X. Raynaud; N. Read; M. Reiter; I. Renner; T.O. Richardson; B.D. Ripley; E. Rosenbaum; B. Rowlingson; J. Rudokas; J. Rudge; C. Ryan; F. Safavimanesh; A. Sarkka; C. Schank; K. Schladitz; S. Schutte; B.T. Scott; O. Semboli; F. Semecurbe; V. Shcherbakov; G.C. Shen; P. Shi; H.-J. Ship; T.L. Silva; I.-M. Sintorn; Y. Song; M. Spiess; M. Stevenson; K. Stucki; M. Sumner; P. Surovy; B. Taylor; T. Thorarinsdottir; L. Torres; B. Turlach; T. Tvedebrink; K. Ummer; M. Uppala; A. van Burgel; T. Verbeke; M. Vihtakari; A. Villers; F. Vinatier; S. Voss; S. Wagner; H. Wang; H. Wendrock; J. Wild; C. Witthoft; S. Wong; M. Woringer; M.E. Zamboni 5 and A. Zeileis. Maintainer Adrian Baddeley Depends R (>= 3.3.0), spatstat.data (>= 1.2-0), stats, graphics, grDevices, utils, methods, nlme, rpart Imports spatstat.utils (>= 1.8-0), mgcv, Matrix, deldir (>= 0.0-21), abind, tensor, polyclip (>= 1.50), goftest Suggests sm, maptools, gsl, locfit, spatial, rpanel, tkrplot, RandomFields (>= 3.1.24.1), RandomFieldsUtils(>= 0.3.3.1), fftwtools (>= 0.9-8) Description Comprehensive open-source toolbox for analysing Spatial Point Patterns. Focused mainly on two-dimensional point patterns, including multitype/marked points, in any spatial region. Also supports three-dimensional point patterns, space-time point patterns in any number of dimensions, point patterns on a linear network, and patterns of other geometrical objects. Supports spatial covariate data such as pixel images. Contains over 2000 functions for plotting spatial data, exploratory data analysis, modelfitting, simulation, spatial sampling, model diagnostics, and formal inference. Data types include point patterns, line segment patterns, spatial windows, pixel images, tessellations, and linear networks. Exploratory methods include quadrat counts, K-functions and their simulation envelopes, nearest neighbour distance and empty space statistics, Fry plots, pair correlation function, kernel smoothed intensity, relative risk estimation with cross-validated bandwidth selection, mark correlation functions, segregation indices, mark dependence diagnostics, and kernel estimates of covariate effects. Formal hypothesis tests of random pattern (chi-squared, Kolmogorov-Smirnov, Monte Carlo, Diggle-Cressie-Loosmore-Ford, Dao-Genton, twostage Monte Carlo) and tests for covariate effects (Cox-Berman-Waller-Lawson, KolmogorovSmirnov, ANOVA) are also supported. Parametric models can be fitted to point pattern data using the functions ppm(), kppm(), slrm(), dppm() similar to glm(). Types of models include Poisson, Gibbs and Cox point processes, Neyman-Scott cluster processes, and determinantal point processes. Models may involve dependence on covariates, inter-point interaction, cluster formation and dependence on marks. Models are fitted by maximum likelihood, logistic regression, minimum contrast, and composite likelihood methods. A model can be fitted to a list of point patterns (replicated point pattern data) using the function mppm(). The model can include random effects and fixed effects depending on the experimental design, in addition to all the features listed above. Fitted point process models can be simulated, automatically. Formal hypothesis tests of a fitted model are supported (likelihood ratio test, analysis of deviance, Monte Carlo tests) along with basic tools for model selection (stepwise(), AIC()). Tools for validating the fitted model include simulation envelopes, residuals, residual plots and Q-Q plots, leverage and influence diagnostics, partial residuals, and added variable plots. License GPL (>= 2) URL http://www.spatstat.org LazyData true NeedsCompilation yes ByteCompile true BugReports https://github.com/spatstat/spatstat/issues R topics documented: 6 R topics documented: spatstat-package . . . . . adaptive.density . . . . . add.texture . . . . . . . addvar . . . . . . . . . . affine . . . . . . . . . . affine.im . . . . . . . . . affine.linnet . . . . . . . affine.lpp . . . . . . . . affine.owin . . . . . . . affine.ppp . . . . . . . . affine.psp . . . . . . . . affine.tess . . . . . . . . allstats . . . . . . . . . . alltypes . . . . . . . . . angles.psp . . . . . . . . anova.lppm . . . . . . . anova.mppm . . . . . . . anova.ppm . . . . . . . . anova.slrm . . . . . . . . anylist . . . . . . . . . . anyNA.im . . . . . . . . append.psp . . . . . . . applynbd . . . . . . . . area.owin . . . . . . . . areaGain . . . . . . . . . AreaInter . . . . . . . . areaLoss . . . . . . . . . as.box3 . . . . . . . . . as.boxx . . . . . . . . . as.data.frame.envelope . as.data.frame.hyperframe as.data.frame.im . . . . . as.data.frame.owin . . . as.data.frame.ppp . . . . as.data.frame.psp . . . . as.data.frame.tess . . . . as.function.fv . . . . . . as.function.im . . . . . . as.function.leverage.ppm as.function.owin . . . . . as.function.tess . . . . . as.fv . . . . . . . . . . . as.hyperframe . . . . . . as.hyperframe.ppx . . . . as.im . . . . . . . . . . . as.interact . . . . . . . . as.layered . . . . . . . . as.linfun . . . . . . . . . as.linim . . . . . . . . . as.linnet.linim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 49 50 51 54 54 55 57 58 59 61 62 63 64 67 68 70 72 74 75 76 77 78 80 82 83 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 104 105 109 110 112 113 114 R topics documented: as.linnet.psp . . . as.lpp . . . . . . as.mask . . . . . as.mask.psp . . . as.matrix.im . . . as.matrix.owin . . as.owin . . . . . as.polygonal . . . as.ppm . . . . . . as.ppp . . . . . . as.psp . . . . . . as.rectangle . . . as.solist . . . . . as.tess . . . . . . auc . . . . . . . . BadGey . . . . . bc.ppm . . . . . bdist.pixels . . . bdist.points . . . bdist.tiles . . . . beachcolours . . beginner . . . . . begins . . . . . . berman.test . . . bind.fv . . . . . . bits.test . . . . . blur . . . . . . . border . . . . . . bounding.box.xy boundingbox . . boundingcircle . box3 . . . . . . . boxx . . . . . . . branchlabelfun . bugfixes . . . . . bw.diggle . . . . bw.frac . . . . . bw.pcf . . . . . . bw.ppl . . . . . . bw.relrisk . . . . bw.scott . . . . . bw.smoothppp . . bw.stoyan . . . . by.im . . . . . . by.ppp . . . . . . cauchy.estK . . . cauchy.estpcf . . cbind.hyperframe CDF . . . . . . . cdf.test . . . . . . cdf.test.mppm . . centroid.owin . . 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 117 118 120 121 122 123 126 127 129 131 133 134 135 137 138 140 141 142 143 144 145 146 147 149 151 153 154 156 157 158 160 161 162 163 164 165 166 168 170 171 172 174 175 176 177 179 181 182 183 187 189 R topics documented: 8 chop.tess . . . . . circdensity . . . . clarkevans . . . . clarkevans.test . . clickbox . . . . . clickdist . . . . . clickjoin . . . . . clicklpp . . . . . clickpoly . . . . clickppp . . . . . clip.infline . . . . closepairs . . . . closepairs.pp3 . . closetriples . . . closing . . . . . . clusterfield . . . . clusterfit . . . . . clusterkernel . . . clusterradius . . . clusterset . . . . coef.mppm . . . coef.ppm . . . . coef.slrm . . . . collapse.fv . . . . colourmap . . . . colouroutputs . . colourtools . . . commonGrid . . compareFit . . . compatible . . . . compatible.fasp . compatible.fv . . compatible.im . . compileK . . . . complement.owin concatxy . . . . . Concom . . . . . connected . . . . connected.linnet . connected.lpp . . connected.ppp . . contour.im . . . . contour.imlist . . convexhull . . . . convexhull.xy . . convexify . . . . convolve.im . . . coords . . . . . . corners . . . . . . covering . . . . . crossdist . . . . . crossdist.default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 192 193 195 196 197 198 199 200 201 202 203 205 207 208 209 211 213 214 215 217 218 220 221 222 224 225 227 228 230 231 231 232 233 235 236 237 239 241 242 243 244 246 247 248 249 250 251 252 253 254 255 R topics documented: crossdist.lpp . . . . . . crossdist.pp3 . . . . . crossdist.ppp . . . . . crossdist.ppx . . . . . crossdist.psp . . . . . . crossing.linnet . . . . . crossing.psp . . . . . . cut.im . . . . . . . . . cut.lpp . . . . . . . . . cut.ppp . . . . . . . . data.ppm . . . . . . . . dclf.progress . . . . . . dclf.sigtrace . . . . . . dclf.test . . . . . . . . default.dummy . . . . default.expand . . . . . default.rmhcontrol . . delaunay . . . . . . . . delaunayDistance . . . delaunayNetwork . . . deletebranch . . . . . . deltametric . . . . . . density.lpp . . . . . . . density.ppp . . . . . . density.psp . . . . . . density.splitppp . . . . deriv.fv . . . . . . . . detpointprocfamilyfun dfbetas.ppm . . . . . . dg.envelope . . . . . . dg.progress . . . . . . dg.sigtrace . . . . . . . dg.test . . . . . . . . . diagnose.ppm . . . . . diameter . . . . . . . . diameter.box3 . . . . . diameter.boxx . . . . . diameter.linnet . . . . diameter.owin . . . . . DiggleGatesStibbard . DiggleGratton . . . . . dilated.areas . . . . . . dilation . . . . . . . . dim.detpointprocfamily dimhat . . . . . . . . . dirichlet . . . . . . . . dirichletAreas . . . . . dirichletVertices . . . . dirichletWeights . . . . disc . . . . . . . . . . discpartarea . . . . . . discretise . . . . . . . 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 257 258 259 260 261 262 263 264 266 268 269 271 273 276 277 279 280 281 282 283 284 286 288 292 294 295 296 299 300 302 304 307 309 313 314 316 317 318 319 320 321 322 324 324 325 326 327 328 329 330 331 R topics documented: 10 discs . . . . . . . distcdf . . . . . . distfun . . . . . . distfun.lpp . . . . distmap . . . . . distmap.owin . . distmap.ppp . . . distmap.psp . . . divide.linnet . . . dkernel . . . . . dmixpois . . . . domain . . . . . dppapproxkernel dppapproxpcf . . dppBessel . . . . dppCauchy . . . dppeigen . . . . . dppGauss . . . . dppkernel . . . . dppm . . . . . . dppMatern . . . . dppparbounds . . dppPowerExp . . dppspecden . . . dppspecdenrange dummify . . . . . dummy.ppm . . . duplicated.ppp . . edge.Ripley . . . edge.Trans . . . . edges . . . . . . edges2triangles . edges2vees . . . edit.hyperframe . edit.ppp . . . . . eem . . . . . . . effectfun . . . . . ellipse . . . . . . Emark . . . . . . emend . . . . . . emend.ppm . . . endpoints.psp . . envelope . . . . . envelope.envelope envelope.lpp . . . envelope.pp3 . . envelopeArray . . eroded.areas . . . erosion . . . . . . erosionAny . . . eval.fasp . . . . . eval.fv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 334 335 337 338 339 341 342 343 344 345 346 349 350 350 351 352 353 354 354 358 359 359 360 361 362 363 364 365 367 369 370 371 372 373 374 375 377 378 380 381 382 384 393 395 398 401 402 403 404 405 407 R topics documented: eval.im . . . . . . . . eval.linim . . . . . . ewcdf . . . . . . . . exactMPLEstrauss . expand.owin . . . . . Extract.anylist . . . . Extract.fasp . . . . . Extract.fv . . . . . . Extract.hyperframe . Extract.im . . . . . . Extract.influence.ppm Extract.layered . . . Extract.leverage.ppm Extract.linim . . . . Extract.linnet . . . . Extract.listof . . . . . Extract.lpp . . . . . . Extract.msr . . . . . Extract.owin . . . . . Extract.ppp . . . . . Extract.ppx . . . . . Extract.psp . . . . . Extract.quad . . . . . Extract.solist . . . . Extract.splitppp . . . Extract.tess . . . . . F3est . . . . . . . . . fardist . . . . . . . . fasp.object . . . . . . Fest . . . . . . . . . Fiksel . . . . . . . . Finhom . . . . . . . fitin.ppm . . . . . . . fitted.lppm . . . . . . fitted.mppm . . . . . fitted.ppm . . . . . . fitted.slrm . . . . . . fixef.mppm . . . . . flipxy . . . . . . . . FmultiInhom . . . . foo . . . . . . . . . . formula.fv . . . . . . formula.ppm . . . . . fourierbasis . . . . . Frame . . . . . . . . fryplot . . . . . . . . funxy . . . . . . . . fv . . . . . . . . . . fv.object . . . . . . . fvnames . . . . . . . G3est . . . . . . . . gauss.hermite . . . . 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 410 412 413 414 415 416 417 419 420 423 424 426 427 428 429 430 431 432 433 436 437 439 440 441 442 443 445 446 447 451 453 455 456 457 459 461 462 463 464 465 466 467 468 469 470 472 473 476 477 478 480 R topics documented: 12 Gcom . . . . . . Gcross . . . . . . Gdot . . . . . . . Gest . . . . . . . Geyer . . . . . . Gfox . . . . . . . Ginhom . . . . . Gmulti . . . . . . GmultiInhom . . Gres . . . . . . . gridcentres . . . . gridweights . . . grow.boxx . . . . grow.rectangle . . Hardcore . . . . harmonic . . . . harmonise . . . . harmonise.fv . . harmonise.im . . harmonise.msr . . harmonise.owin . has.close . . . . . headtail . . . . . Hest . . . . . . . hextess . . . . . . HierHard . . . . hierpair.family . . HierStrauss . . . HierStraussHard . hist.funxy . . . . hist.im . . . . . . hopskel . . . . . Hybrid . . . . . . hybrid.family . . hyperframe . . . identify.ppp . . . identify.psp . . . idw . . . . . . . Iest . . . . . . . . im . . . . . . . . im.apply . . . . . im.object . . . . imcov . . . . . . improve.kppm . . incircle . . . . . increment.fv . . . infline . . . . . . influence.ppm . . inforder.family . insertVertices . . inside.boxx . . . inside.owin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 484 487 490 493 494 496 498 500 502 503 504 505 506 507 509 510 511 512 513 514 515 517 518 520 522 523 524 525 527 528 529 531 532 533 534 535 536 538 540 542 543 544 545 547 548 549 550 552 552 554 555 R topics documented: integral.im . . . . . . integral.linim . . . . integral.msr . . . . . intensity . . . . . . . intensity.dppm . . . . intensity.lpp . . . . . intensity.ppm . . . . intensity.ppp . . . . . intensity.ppx . . . . . intensity.psp . . . . . intensity.quadratcount interp.colourmap . . interp.im . . . . . . . intersect.owin . . . . intersect.tess . . . . . invoke.symbolmap . iplot . . . . . . . . . ippm . . . . . . . . . is.connected . . . . . is.connected.ppp . . is.convex . . . . . . is.dppm . . . . . . . is.empty . . . . . . . is.hybrid . . . . . . . is.im . . . . . . . . . is.lpp . . . . . . . . . is.marked . . . . . . is.marked.ppm . . . . is.marked.ppp . . . . is.multitype . . . . . is.multitype.ppm . . is.multitype.ppp . . . is.owin . . . . . . . . is.ppm . . . . . . . . is.ppp . . . . . . . . is.rectangle . . . . . is.stationary . . . . . is.subset.owin . . . . istat . . . . . . . . . Jcross . . . . . . . . Jdot . . . . . . . . . Jest . . . . . . . . . Jinhom . . . . . . . . Jmulti . . . . . . . . K3est . . . . . . . . kaplan.meier . . . . . Kcom . . . . . . . . Kcross . . . . . . . . Kcross.inhom . . . . Kdot . . . . . . . . . Kdot.inhom . . . . . kernel.factor . . . . . 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 557 558 560 561 561 562 564 565 566 567 568 569 570 572 573 574 576 578 579 580 581 581 582 584 584 585 586 587 588 589 590 591 592 593 593 594 596 597 598 600 603 606 608 610 611 613 616 618 622 625 628 R topics documented: 14 kernel.moment . . . kernel.squint . . . . . Kest . . . . . . . . . Kest.fft . . . . . . . Kinhom . . . . . . . km.rs . . . . . . . . Kmark . . . . . . . . Kmeasure . . . . . . Kmodel . . . . . . . Kmodel.dppm . . . . Kmodel.kppm . . . . Kmodel.ppm . . . . Kmulti . . . . . . . . Kmulti.inhom . . . . kppm . . . . . . . . Kres . . . . . . . . . Kscaled . . . . . . . Ksector . . . . . . . LambertW . . . . . . laslett . . . . . . . . latest.news . . . . . . layered . . . . . . . . layerplotargs . . . . layout.boxes . . . . . Lcross . . . . . . . . Lcross.inhom . . . . Ldot . . . . . . . . . Ldot.inhom . . . . . lengths.psp . . . . . LennardJones . . . . Lest . . . . . . . . . levelset . . . . . . . leverage.ppm . . . . lgcp.estK . . . . . . lgcp.estpcf . . . . . . lineardirichlet . . . . lineardisc . . . . . . linearK . . . . . . . linearKcross . . . . . linearKcross.inhom . linearKdot . . . . . . linearKdot.inhom . . linearKinhom . . . . linearmarkconnect . . linearmarkequal . . . linearpcf . . . . . . . linearpcfcross . . . . linearpcfcross.inhom linearpcfdot . . . . . linearpcfdot.inhom . linearpcfinhom . . . linequad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629 630 631 635 636 641 642 644 647 648 649 650 651 654 657 662 664 667 668 669 671 672 673 674 675 677 678 680 681 682 684 685 686 688 691 694 695 696 697 699 700 702 703 705 707 708 709 711 712 714 715 717 R topics documented: linfun . . . . . . Linhom . . . . . linim . . . . . . . linnet . . . . . . lintess . . . . . . lixellate . . . . . localK . . . . . . localKinhom . . localpcf . . . . . logLik.dppm . . . logLik.kppm . . . logLik.mppm . . logLik.ppm . . . logLik.slrm . . . lohboot . . . . . lpp . . . . . . . . lppm . . . . . . . lurking . . . . . . lurking.mppm . . lut . . . . . . . . markconnect . . . markcorr . . . . . markcrosscorr . . marks . . . . . . marks.psp . . . . marks.tess . . . . markstat . . . . . marktable . . . . markvario . . . . matchingdist . . . matclust.estK . . matclust.estpcf . Math.im . . . . . Math.imlist . . . Math.linim . . . matrixpower . . . maxnndist . . . . mean.im . . . . . mean.linim . . . measureVariation mergeLevels . . . methods.box3 . . methods.boxx . . methods.dppm . . methods.fii . . . methods.funxy . methods.kppm . . methods.layered . methods.linfun . methods.linim . . methods.linnet . . methods.lpp . . . 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 719 720 722 723 724 726 728 730 732 733 735 737 739 740 742 744 745 749 751 752 754 758 760 762 763 764 766 767 769 770 772 775 776 778 780 781 782 783 784 785 786 788 789 790 791 792 793 795 796 798 800 R topics documented: 16 methods.lppm . . . . . methods.objsurf . . . . methods.pp3 . . . . . . methods.ppx . . . . . . methods.rho2hat . . . . methods.rhohat . . . . methods.slrm . . . . . methods.ssf . . . . . . methods.unitname . . . methods.zclustermodel midpoints.psp . . . . . mincontrast . . . . . . MinkowskiSum . . . . miplot . . . . . . . . . model.depends . . . . model.frame.ppm . . . model.images . . . . . model.matrix.mppm . . model.matrix.ppm . . . model.matrix.slrm . . . mppm . . . . . . . . . msr . . . . . . . . . . MultiHard . . . . . . . multiplicity.ppp . . . . MultiStrauss . . . . . . MultiStraussHard . . . nearest.raster.point . . nearestsegment . . . . nestsplit . . . . . . . . nnclean . . . . . . . . nncorr . . . . . . . . . nncross . . . . . . . . nncross.lpp . . . . . . nncross.pp3 . . . . . . nndensity.ppp . . . . . nndist . . . . . . . . . nndist.lpp . . . . . . . nndist.pp3 . . . . . . . nndist.ppx . . . . . . . nndist.psp . . . . . . . nnfromvertex . . . . . nnfun . . . . . . . . . nnfun.lpp . . . . . . . nnmap . . . . . . . . . nnmark . . . . . . . . nnorient . . . . . . . . nnwhich . . . . . . . . nnwhich.lpp . . . . . . nnwhich.pp3 . . . . . . nnwhich.ppx . . . . . . nobjects . . . . . . . . npfun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801 803 804 805 806 807 809 810 812 813 814 815 817 818 820 821 823 825 826 828 829 832 834 835 837 838 840 841 842 843 845 848 850 852 855 856 858 860 861 863 864 865 866 867 869 871 872 875 876 877 878 879 R topics documented: npoints . . . . . nsegments . . . nvertices . . . . objsurf . . . . . opening . . . . Ops.msr . . . . Ord . . . . . . ord.family . . . OrdThresh . . . overlap.owin . . owin . . . . . . owin.object . . padimage . . . pairdist . . . . pairdist.default pairdist.lpp . . pairdist.pp3 . . pairdist.ppp . . pairdist.ppx . . pairdist.psp . . pairorient . . . PairPiece . . . pairs.im . . . . pairs.linim . . . pairsat.family . Pairwise . . . . pairwise.family panel.contour . parameters . . . parres . . . . . pcf . . . . . . . pcf.fasp . . . . pcf.fv . . . . . pcf.ppp . . . . pcf3est . . . . . pcfcross . . . . pcfcross.inhom pcfdot . . . . . pcfdot.inhom . pcfinhom . . . pcfmulti . . . . Penttinen . . . perimeter . . . periodify . . . . persp.im . . . . perspPoints . . pixelcentres . . pixellate . . . . pixellate.owin . pixellate.ppp . . pixellate.psp . . pixelquad . . . 17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880 881 882 883 884 885 886 888 888 889 890 893 894 895 896 897 898 899 900 901 902 904 905 907 908 909 910 911 912 913 916 917 919 921 924 926 928 930 932 934 936 938 939 940 942 944 945 946 947 948 950 951 R topics documented: 18 plot.anylist . . . . plot.bermantest . . plot.cdftest . . . . plot.colourmap . . plot.dppm . . . . . plot.envelope . . . plot.fasp . . . . . . plot.fv . . . . . . . plot.hyperframe . . plot.im . . . . . . . plot.imlist . . . . . plot.influence.ppm plot.kppm . . . . . plot.laslett . . . . . plot.layered . . . . plot.leverage.ppm . plot.linim . . . . . plot.linnet . . . . . plot.lintess . . . . . plot.listof . . . . . plot.lpp . . . . . . plot.lppm . . . . . plot.mppm . . . . . plot.msr . . . . . . plot.onearrow . . . plot.owin . . . . . plot.plotppm . . . . plot.pp3 . . . . . . plot.ppm . . . . . . plot.ppp . . . . . . plot.psp . . . . . . plot.quad . . . . . plot.quadratcount . plot.quadrattest . . plot.rppm . . . . . plot.scan.test . . . plot.slrm . . . . . . plot.solist . . . . . plot.splitppp . . . . plot.ssf . . . . . . . plot.symbolmap . . plot.tess . . . . . . plot.textstring . . . plot.texturemap . . plot.yardstick . . . points.lpp . . . . . pointsOnLines . . . Poisson . . . . . . polynom . . . . . . pool . . . . . . . . pool.anylist . . . . pool.envelope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952 . 955 . 957 . 958 . 960 . 961 . 962 . 964 . 967 . 969 . 974 . 975 . 976 . 978 . 979 . 980 . 982 . 984 . 985 . 986 . 989 . 990 . 991 . 992 . 994 . 995 . 998 . 999 . 1001 . 1003 . 1007 . 1009 . 1010 . 1012 . 1013 . 1014 . 1015 . 1016 . 1019 . 1020 . 1021 . 1023 . 1024 . 1025 . 1026 . 1027 . 1028 . 1029 . 1031 . 1032 . 1032 . 1033 R topics documented: pool.fasp . . . . . . pool.fv . . . . . . . pool.quadrattest . . pool.rat . . . . . . pp3 . . . . . . . . ppm . . . . . . . . ppm.object . . . . ppm.ppp . . . . . . ppmInfluence . . . ppp . . . . . . . . ppp.object . . . . . pppdist . . . . . . . pppmatching . . . pppmatching.object PPversion . . . . . ppx . . . . . . . . predict.dppm . . . predict.kppm . . . predict.lppm . . . . predict.mppm . . . predict.ppm . . . . predict.rppm . . . . predict.slrm . . . . print.im . . . . . . print.owin . . . . . print.ppm . . . . . print.ppp . . . . . . print.psp . . . . . . print.quad . . . . . profilepl . . . . . . progressreport . . . project2segment . . project2set . . . . . prune.rppm . . . . pseudoR2 . . . . . psib . . . . . . . . psp . . . . . . . . . psp.object . . . . . psst . . . . . . . . psstA . . . . . . . psstG . . . . . . . qqplot.ppm . . . . quad.object . . . . quad.ppm . . . . . quadrat.test . . . . quadrat.test.mppm . quadrat.test.splitppp quadratcount . . . quadratresample . . quadrats . . . . . . quadscheme . . . . quadscheme.logi . 19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1035 . 1036 . 1037 . 1038 . 1039 . 1040 . 1046 . 1048 . 1058 . 1060 . 1063 . 1065 . 1068 . 1069 . 1071 . 1072 . 1073 . 1074 . 1075 . 1076 . 1078 . 1083 . 1084 . 1085 . 1086 . 1087 . 1088 . 1089 . 1090 . 1091 . 1093 . 1095 . 1096 . 1097 . 1098 . 1099 . 1100 . 1101 . 1102 . 1104 . 1107 . 1109 . 1113 . 1114 . 1116 . 1119 . 1121 . 1122 . 1125 . 1126 . 1127 . 1129 R topics documented: 20 quantess . . . . . quantile.density . quantile.ewcdf . . quantile.im . . . quasirandom . . . rags . . . . . . . ragsAreaInter . . ragsMultiHard . . ranef.mppm . . . range.fv . . . . . raster.x . . . . . . rat . . . . . . . . rCauchy . . . . . rcell . . . . . . . rcellnumber . . . rDGS . . . . . . rDiggleGratton . rdpp . . . . . . . reach . . . . . . . reach.dppm . . . reduced.sample . reflect . . . . . . regularpolygon . relevel.im . . . . reload.or.compute relrisk . . . . . . relrisk.ppm . . . relrisk.ppp . . . . Replace.im . . . Replace.linim . . requireversion . . rescale . . . . . . rescale.im . . . . rescale.owin . . . rescale.ppp . . . rescale.psp . . . . rescue.rectangle . residuals.dppm . residuals.kppm . residuals.mppm . residuals.ppm . . rex . . . . . . . . rGaussPoisson . . rgbim . . . . . . rHardcore . . . . rho2hat . . . . . rhohat . . . . . . ripras . . . . . . rjitter . . . . . . rknn . . . . . . . rlabel . . . . . . rLGCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131 . 1133 . 1134 . 1135 . 1136 . 1137 . 1138 . 1140 . 1141 . 1142 . 1143 . 1144 . 1145 . 1147 . 1149 . 1150 . 1151 . 1153 . 1154 . 1156 . 1157 . 1158 . 1159 . 1160 . 1161 . 1162 . 1163 . 1165 . 1168 . 1170 . 1171 . 1172 . 1173 . 1174 . 1176 . 1177 . 1178 . 1179 . 1180 . 1181 . 1182 . 1185 . 1186 . 1187 . 1188 . 1190 . 1191 . 1195 . 1197 . 1198 . 1199 . 1200 R topics documented: rlinegrid . . . . . rlpp . . . . . . . rMatClust . . . . rMaternI . . . . . rMaternII . . . . rmh . . . . . . . rmh.default . . . rmh.ppm . . . . . rmhcontrol . . . . rmhexpand . . . rmhmodel . . . . rmhmodel.default rmhmodel.list . . rmhmodel.ppm . rmhstart . . . . . rMosaicField . . rMosaicSet . . . rmpoint . . . . . rmpoispp . . . . rNeymanScott . . rnoise . . . . . . roc . . . . . . . . rose . . . . . . . rotate . . . . . . rotate.im . . . . . rotate.infline . . . rotate.owin . . . rotate.ppp . . . . rotate.psp . . . . rotmean . . . . . round.ppp . . . . rounding . . . . . rPenttinen . . . . rpoint . . . . . . rpoisline . . . . . rpoislinetess . . . rpoislpp . . . . . rpoispp . . . . . rpoispp3 . . . . . rpoisppOnLines . rpoisppx . . . . . rPoissonCluster . rppm . . . . . . . rQuasi . . . . . . rshift . . . . . . . rshift.ppp . . . . rshift.psp . . . . rshift.splitppp . . rSSI . . . . . . . rstrat . . . . . . . rStrauss . . . . . rStraussHard . . 21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1202 . 1203 . 1204 . 1207 . 1208 . 1209 . 1210 . 1220 . 1223 . 1227 . 1229 . 1230 . 1237 . 1239 . 1241 . 1242 . 1243 . 1244 . 1248 . 1251 . 1254 . 1255 . 1256 . 1258 . 1259 . 1260 . 1261 . 1262 . 1263 . 1264 . 1266 . 1267 . 1268 . 1270 . 1271 . 1272 . 1273 . 1274 . 1276 . 1277 . 1279 . 1280 . 1282 . 1283 . 1284 . 1285 . 1287 . 1289 . 1290 . 1292 . 1293 . 1295 R topics documented: 22 rsyst . . . . . . . . rtemper . . . . . . rthin . . . . . . . . rThomas . . . . . . run.simplepanel . . runifdisc . . . . . . runiflpp . . . . . . runifpoint . . . . . runifpoint3 . . . . runifpointOnLines . runifpointx . . . . rVarGamma . . . . SatPiece . . . . . . Saturated . . . . . scalardilate . . . . scaletointerval . . . scan.test . . . . . . scanLRTS . . . . . scanpp . . . . . . . sdr . . . . . . . . . sdrPredict . . . . . segregation.test . . selfcrossing.psp . . selfcut.psp . . . . . sessionLibs . . . . setcov . . . . . . . sharpen . . . . . . shift . . . . . . . . shift.im . . . . . . shift.owin . . . . . shift.ppp . . . . . . shift.psp . . . . . . sidelengths.owin . simplepanel . . . . simplify.owin . . . simulate.dppm . . . simulate.kppm . . . simulate.lppm . . . simulate.mppm . . simulate.ppm . . . simulate.slrm . . . slrm . . . . . . . . Smooth . . . . . . Smooth.fv . . . . . Smooth.msr . . . . Smooth.ppp . . . . Smooth.ssf . . . . Smoothfun.ppp . . Softcore . . . . . . solapply . . . . . . solist . . . . . . . . solutionset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1296 . 1297 . 1299 . 1300 . 1302 . 1305 . 1306 . 1307 . 1308 . 1309 . 1310 . 1311 . 1313 . 1315 . 1316 . 1317 . 1318 . 1320 . 1322 . 1323 . 1326 . 1327 . 1328 . 1329 . 1330 . 1331 . 1332 . 1333 . 1334 . 1335 . 1336 . 1337 . 1338 . 1339 . 1342 . 1343 . 1345 . 1347 . 1348 . 1349 . 1351 . 1352 . 1354 . 1355 . 1356 . 1358 . 1360 . 1361 . 1362 . 1364 . 1365 . 1366 R topics documented: spatdim . . . . . spatialcdf . . . . spatstat.options . split.hyperframe . split.im . . . . . split.msr . . . . . split.ppp . . . . . split.ppx . . . . . spokes . . . . . . square . . . . . . ssf . . . . . . . . stieltjes . . . . . stienen . . . . . . stratrand . . . . . Strauss . . . . . . StraussHard . . . studpermu.test . . subfits . . . . . . subset.hyperframe subset.ppp . . . . subspaceDistance suffstat . . . . . . summary.anylist . summary.im . . . summary.kppm . summary.listof . summary.owin . . summary.ppm . . summary.ppp . . summary.psp . . summary.quad . . summary.solist . summary.splitppp sumouter . . . . superimpose . . . superimpose.lpp . symbolmap . . . tess . . . . . . . test.crossing.psp . text.ppp . . . . . texturemap . . . textureplot . . . . thinNetwork . . . thomas.estK . . . thomas.estpcf . . tile.areas . . . . . tile.lengths . . . . tileindex . . . . . tilenames . . . . tiles . . . . . . . tiles.empty . . . . timed . . . . . . 23 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1368 . 1369 . 1370 . 1374 . 1375 . 1376 . 1378 . 1380 . 1382 . 1383 . 1384 . 1385 . 1386 . 1387 . 1389 . 1390 . 1392 . 1394 . 1395 . 1396 . 1398 . 1399 . 1401 . 1402 . 1403 . 1404 . 1405 . 1406 . 1407 . 1408 . 1409 . 1410 . 1411 . 1412 . 1413 . 1416 . 1417 . 1419 . 1421 . 1422 . 1423 . 1424 . 1425 . 1427 . 1429 . 1431 . 1432 . 1433 . 1434 . 1435 . 1436 . 1437 R topics documented: 24 timeTaken . . . . . . . . . transect.im . . . . . . . . . transmat . . . . . . . . . . treebranchlabels . . . . . . treeprune . . . . . . . . . triangulate.owin . . . . . . trim.rectangle . . . . . . . triplet.family . . . . . . . Triplets . . . . . . . . . . Tstat . . . . . . . . . . . . tweak.colourmap . . . . . union.quad . . . . . . . . unique.ppp . . . . . . . . unitname . . . . . . . . . unmark . . . . . . . . . . unnormdensity . . . . . . unstack.msr . . . . . . . . unstack.ppp . . . . . . . . update.detpointprocfamily update.interact . . . . . . . update.kppm . . . . . . . . update.ppm . . . . . . . . update.rmhcontrol . . . . . update.symbolmap . . . . valid . . . . . . . . . . . . valid.detpointprocfamily . valid.ppm . . . . . . . . . varblock . . . . . . . . . . varcount . . . . . . . . . . vargamma.estK . . . . . . vargamma.estpcf . . . . . vcov.kppm . . . . . . . . . vcov.mppm . . . . . . . . vcov.ppm . . . . . . . . . vcov.slrm . . . . . . . . . vertices . . . . . . . . . . volume . . . . . . . . . . weighted.median . . . . . where.max . . . . . . . . . whichhalfplane . . . . . . whist . . . . . . . . . . . . will.expand . . . . . . . . Window . . . . . . . . . . WindowOnly . . . . . . . with.fv . . . . . . . . . . . with.hyperframe . . . . . . with.msr . . . . . . . . . . with.ssf . . . . . . . . . . yardstick . . . . . . . . . . zapsmall.im . . . . . . . . zclustermodel . . . . . . . [.ssf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1438 . 1439 . 1440 . 1441 . 1442 . 1444 . 1445 . 1446 . 1446 . 1448 . 1449 . 1450 . 1451 . 1452 . 1454 . 1455 . 1456 . 1457 . 1458 . 1459 . 1460 . 1461 . 1463 . 1464 . 1465 . 1466 . 1467 . 1468 . 1470 . 1471 . 1473 . 1476 . 1477 . 1479 . 1482 . 1483 . 1484 . 1485 . 1486 . 1487 . 1488 . 1489 . 1490 . 1491 . 1493 . 1495 . 1496 . 1498 . 1499 . 1500 . 1501 . 1502 spatstat-package 25 Index 1503 spatstat-package The Spatstat Package Description This is a summary of the features of spatstat, a package in R for the statistical analysis of spatial point patterns. Details spatstat is a package for the statistical analysis of spatial data. Its main focus is the analysis of spatial patterns of points in two-dimensional space. The points may carry auxiliary data (‘marks’), and the spatial region in which the points were recorded may have arbitrary shape. The package is designed to support a complete statistical analysis of spatial data. It supports • creation, manipulation and plotting of point patterns; • exploratory data analysis; • spatial random sampling; • simulation of point process models; • parametric model-fitting; • non-parametric smoothing and regression; • formal inference (hypothesis tests, confidence intervals); • model diagnostics. Apart from two-dimensional point patterns and point processes, spatstat also supports point patterns in three dimensions, point patterns in multidimensional space-time, point patterns on a linear network, patterns of line segments in two dimensions, and spatial tessellations and random sets in two dimensions. The package can fit several types of point process models to a point pattern dataset: • Poisson point process models (by Berman-Turner approximate maximum likelihood or by spatial logistic regression) • Gibbs/Markov point process models (by Baddeley-Turner approximate maximum pseudolikelihood, Coeurjolly-Rubak logistic likelihood, or Huang-Ogata approximate maximum likelihood) • Cox/cluster point process models (by Waagepetersen’s two-step fitting procedure and minimum contrast, composite likelihood, or Palm likelihood) • determinantal point process models (by Waagepetersen’s two-step fitting procedure and minimum contrast, composite likelihood, or Palm likelihood) The models may include spatial trend, dependence on covariates, and complicated interpoint interactions. Models are specified by a formula in the R language, and are fitted using a function analogous to lm and glm. Fitted models can be printed, plotted, predicted, simulated and so on. 26 spatstat-package Getting Started For a quick introduction to spatstat, read the package vignette Getting started with spatstat installed with spatstat. To read that document, you can either • visit cran.r-project.org/web/packages/spatstat and click on Getting Started with Spatstat • start R, type library(spatstat) and vignette('getstart') • start R, type help.start() to open the help browser, and navigate to Packages > spatstat > Vignettes. Once you have installed spatstat, start R and type library(spatstat). Then type beginner for a beginner’s introduction, or demo(spatstat) for a demonstration of the package’s capabilities. For a complete course on spatstat, and on statistical analysis of spatial point patterns, read the book by Baddeley, Rubak and Turner (2015). Other recommended books on spatial point process methods are Diggle (2014), Gelfand et al (2010) and Illian et al (2008). The spatstat package includes over 50 datasets, which can be useful when learning the package. Type demo(data) to see plots of all datasets available in the package. Type vignette('datasets') for detailed background information on these datasets, and plots of each dataset. For information on converting your data into spatstat format, read Chapter 3 of Baddeley, Rubak and Turner (2015). This chapter is available free online, as one of the sample chapters at the book companion website, spatstat.github.io/book. For information about handling data in shapefiles, see Chapter 3, or the Vignette Handling shapefiles in the spatstat package, installed with spatstat, accessible as vignette('shapefiles'). Updates New versions of spatstat are released every 8 weeks. Users are advised to update their installation of spatstat regularly. Type latest.news to read the news documentation about changes to the current installed version of spatstat. See the Vignette Summary of recent updates, installed with spatstat, which describes the main changes to spatstat since the book (Baddeley, Rubak and Turner, 2015) was published. It is accessible as vignette('updates'). Type news(package="spatstat") to read news documentation about all previous versions of the package. FUNCTIONS AND DATASETS Following is a summary of the main functions and datasets in the spatstat package. Alternatively an alphabetical list of all functions and datasets is available by typing library(help=spatstat). For further information on any of these, type help(name) or ?name where name is the name of the function or dataset. CONTENTS: I. II. III. IV. V. VI. VII. Creating and manipulating data Exploratory Data Analysis Model fitting (Cox and cluster models) Model fitting (Poisson and Gibbs models) Model fitting (determinantal point processes) Model fitting (spatial logistic regression) Simulation spatstat-package 27 VIII. IX. Tests and diagnostics Documentation I. CREATING AND MANIPULATING DATA Types of spatial data: The main types of spatial data supported by spatstat are: ppp owin im psp tess pp3 ppx lpp point pattern window (spatial region) pixel image line segment pattern tessellation three-dimensional point pattern point pattern in any number of dimensions point pattern on a linear network To create a point pattern: ppp as.ppp clickppp marks<-, %mark% create a point pattern from (x, y) and window information ppp(x, y, xlim, ylim) for rectangular window ppp(x, y, poly) for polygonal window ppp(x, y, mask) for binary image window convert other types of data to a ppp object interactively add points to a plot attach/reassign marks to a point pattern To simulate a random point pattern: runifpoint rpoint rmpoint rpoispp rmpoispp runifdisc rstrat rsyst rjitter rMaternI rMaternII rSSI rStrauss rHardcore rStraussHard rDiggleGratton rDGS rPenttinen rNeymanScott rPoissonCluster rMatClust generate n independent uniform random points generate n independent random points generate n independent multitype random points simulate the (in)homogeneous Poisson point process simulate the (in)homogeneous multitype Poisson point process generate n independent uniform random points in disc stratified random sample of points systematic random sample of points apply random displacements to points in a pattern simulate the Matérn Model I inhibition process simulate the Matérn Model II inhibition process simulate Simple Sequential Inhibition process simulate Strauss process (perfect simulation) simulate Hard Core process (perfect simulation) simulate Strauss-hard core process (perfect simulation) simulate Diggle-Gratton process (perfect simulation) simulate Diggle-Gates-Stibbard process (perfect simulation) simulate Penttinen process (perfect simulation) simulate a general Neyman-Scott process simulate a general Poisson cluster process simulate the Matérn Cluster process 28 spatstat-package rThomas rGaussPoisson rCauchy rVarGamma rthin rcell rmh simulate.ppm runifpointOnLines rpoisppOnLines simulate the Thomas process simulate the Gauss-Poisson cluster process simulate Neyman-Scott Cauchy cluster process simulate Neyman-Scott Variance Gamma cluster process random thinning simulate the Baddeley-Silverman cell process simulate Gibbs point process using Metropolis-Hastings simulate Gibbs point process using Metropolis-Hastings generate n random points along specified line segments generate Poisson random points along specified line segments To randomly change an existing point pattern: rshift rjitter rthin rlabel quadratresample random shifting of points apply random displacements to points in a pattern random thinning random (re)labelling of a multitype point pattern block resampling Standard point pattern datasets: Datasets in spatstat are lazy-loaded, so you can simply type the name of the dataset to use it; there is no need to type data(amacrine) etc. Type demo(data) to see a display of all the datasets installed with the package. Type vignette('datasets') for a document giving an overview of all datasets, including background information, and plots. amacrine anemones ants bdspots bei betacells bramblecanes bronzefilter cells chicago chorley clmfires copper dendrite demohyper demopat finpines flu gordon gorillas hamster humberside hyytiala japanesepines lansing Austin Hughes’ rabbit amacrine cells Upton-Fingleton sea anemones data Harkness-Isham ant nests data Breakdown spots in microelectrodes Tropical rainforest trees Waessle et al. cat retinal ganglia data Bramble Canes data Bronze Filter Section data Crick-Ripley biological cells data Chicago crimes Chorley-Ribble cancer data Castilla-La Mancha forest fires Berman-Huntington copper deposits data Dendritic spines Synthetic point patterns Synthetic point pattern Finnish Pines data Influenza virus proteins People in Gordon Square, London Gorilla nest sites Aherne’s hamster tumour data North Humberside childhood leukaemia data Mixed forest in Hyytiälä, Finland Japanese Pines data Lansing Woods data spatstat-package longleaf mucosa murchison nbfires nztrees osteo paracou ponderosa pyramidal redwood redwoodfull residualspaper shapley simdat spiders sporophores spruces swedishpines urkiola waka waterstriders 29 Longleaf Pines data Cells in gastric mucosa Murchison gold deposits New Brunswick fires data Mark-Esler-Ripley trees data Osteocyte lacunae (3D, replicated) Kimboto trees in Paracou, French Guiana Getis-Franklin ponderosa pine trees data Pyramidal neurons from 31 brains Strauss-Ripley redwood saplings data Strauss redwood saplings data (full set) Data from Baddeley et al (2005) Galaxies in an astronomical survey Simulated point pattern (inhomogeneous, with interaction) Spider webs on mortar lines of brick wall Mycorrhizal fungi around a tree Spruce trees in Saxonia Strand-Ripley Swedish pines data Urkiola Woods data Trees in Waka national park Insects on water surface To manipulate a point pattern: plot.ppp iplot edit.ppp [.ppp subset.ppp superimpose by.ppp cut.ppp split.ppp unmark npoints coords marks rotate shift flipxy reflect periodify affine scalardilate density.ppp Smooth.ppp nnmark sharpen.ppp identify.ppp unique.ppp duplicated.ppp connected.ppp plot a point pattern (e.g. plot(X)) plot a point pattern interactively interactive text editor extract or replace a subset of a point pattern pp[subset] or pp[subwindow] extract subset of point pattern satisfying a condition combine several point patterns apply a function to sub-patterns of a point pattern classify the points in a point pattern divide pattern into sub-patterns remove marks count the number of points extract coordinates, change coordinates extract marks, change marks or attach marks rotate pattern translate pattern swap x and y coordinates reflect in the origin make several translated copies apply affine transformation apply scalar dilation kernel estimation of point pattern intensity kernel smoothing of marks of point pattern mark value of nearest data point data sharpening interactively identify points remove duplicate points determine which points are duplicates find clumps of points 30 spatstat-package dirichlet delaunay delaunayDistance convexhull discretise pixellate.ppp as.im.ppp compute Dirichlet-Voronoi tessellation compute Delaunay triangulation graph distance in Delaunay triangulation compute convex hull discretise coordinates approximate point pattern by pixel image approximate point pattern by pixel image See spatstat.options to control plotting behaviour. To create a window: An object of class "owin" describes a spatial region (a window of observation). owin Window Frame as.owin square disc ellipse ripras convexhull letterR clickpoly clickbox Create a window object owin(xlim, ylim) for rectangular window owin(poly) for polygonal window owin(mask) for binary image window Extract window of another object Extract the containing rectangle (’frame’) of another object Convert other data to a window object make a square window make a circular window make an elliptical window Ripley-Rasson estimator of window, given only the points compute convex hull of something polygonal window in the shape of the R logo interactively draw a polygonal window interactively draw a rectangle To manipulate a window: plot.owin boundingbox erosion dilation closing opening border complement.owin simplify.owin rotate flipxy shift periodify affine as.data.frame.owin plot a window. plot(W) Find a tight bounding box for the window erode window by a distance r dilate window by a distance r close window by a distance r open window by a distance r difference between window and its erosion/dilation invert (swap inside and outside) approximate a window by a simple polygon rotate window swap x and y coordinates translate window make several translated copies apply affine transformation convert window to data frame Digital approximations: as.mask as.im.owin Make a discrete pixel approximation of a given window convert window to pixel image spatstat-package pixellate.owin commonGrid nearest.raster.point raster.x raster.y raster.xy as.polygonal 31 convert window to pixel image find common pixel grid for windows map continuous coordinates to raster locations raster x coordinates raster y coordinates raster x and y coordinates convert pixel mask to polygonal window See spatstat.options to control the approximation Geometrical computations with windows: edges intersect.owin union.owin setminus.owin inside.owin area.owin perimeter diameter.owin incircle inradius connected.owin eroded.areas dilated.areas bdist.points bdist.pixels bdist.tiles distmap.owin distfun.owin centroid.owin is.subset.owin is.convex convexhull triangulate.owin as.mask as.polygonal is.rectangle is.polygonal is.mask setcov pixelcentres clickdist extract boundary edges intersection of two windows union of two windows set subtraction of two windows determine whether a point is inside a window compute area compute perimeter length compute diameter find largest circle inside a window radius of incircle find connected components of window compute areas of eroded windows compute areas of dilated windows compute distances from data points to window boundary compute distances from all pixels to window boundary boundary distance for each tile in tessellation distance transform image distance transform compute centroid (centre of mass) of window determine whether one window contains another determine whether a window is convex compute convex hull decompose into triangles pixel approximation of window polygonal approximation of window test whether window is a rectangle test whether window is polygonal test whether window is a mask spatial covariance function of window extract centres of pixels in mask measure distance between two points clicked by user Pixel images: An object of class "im" represents a pixel image. Such objects are returned by some of the functions in spatstat including Kmeasure, setcov and density.ppp. im as.im pixellate as.matrix.im as.data.frame.im as.function.im create a pixel image convert other data to a pixel image convert other data to a pixel image convert pixel image to matrix convert pixel image to data frame convert pixel image to function 32 spatstat-package plot.im contour.im persp.im rgbim hsvim [.im [<-.im rotate.im shift.im affine.im X summary(X) hist.im mean.im integral.im quantile.im cut.im is.im interp.im blur Smooth.im connected.im compatible.im harmonise.im commonGrid eval.im scaletointerval zapsmall.im levelset solutionset imcov convolve.im transect.im pixelcentres transmat rnoise plot a pixel image on screen as a digital image draw contours of a pixel image draw perspective plot of a pixel image create colour-valued pixel image create colour-valued pixel image extract a subset of a pixel image replace a subset of a pixel image rotate pixel image apply vector shift to pixel image apply affine transformation to image print very basic information about image X summary of image X histogram of image mean pixel value of image integral of pixel values quantiles of image convert numeric image to factor image test whether an object is a pixel image interpolate a pixel image apply Gaussian blur to image apply Gaussian blur to image find connected components test whether two images have compatible dimensions make images compatible find a common pixel grid for images evaluate any expression involving images rescale pixel values set very small pixel values to zero level set of an image region where an expression is true spatial covariance function of image spatial convolution of images line transect of image extract centres of pixels convert matrix of pixel values to a different indexing convention random pixel noise Line segment patterns An object of class "psp" represents a pattern of straight line segments. psp as.psp edges is.psp plot.psp print.psp summary.psp [.psp as.data.frame.psp marks.psp marks<-.psp create a line segment pattern convert other data into a line segment pattern extract edges of a window determine whether a dataset has class "psp" plot a line segment pattern print basic information print summary information extract a subset of a line segment pattern convert line segment pattern to data frame extract marks of line segments assign new marks to line segments spatstat-package 33 unmark.psp midpoints.psp endpoints.psp lengths.psp angles.psp superimpose flipxy rotate.psp shift.psp periodify affine.psp pixellate.psp as.mask.psp distmap.psp distfun.psp density.psp selfcrossing.psp selfcut.psp crossing.psp nncross nearestsegment project2segment pointsOnLines rpoisline rlinegrid delete marks from line segments compute the midpoints of line segments extract the endpoints of line segments compute the lengths of line segments compute the orientation angles of line segments combine several line segment patterns swap x and y coordinates rotate a line segment pattern shift a line segment pattern make several shifted copies apply an affine transformation approximate line segment pattern by pixel image approximate line segment pattern by binary mask compute the distance map of a line segment pattern compute the distance map of a line segment pattern kernel smoothing of line segments find crossing points between line segments cut segments where they cross find crossing points between two line segment patterns find distance to nearest line segment from a given point find line segment closest to a given point find location along a line segment closest to a given point generate points evenly spaced along line segment generate a realisation of the Poisson line process inside a window generate a random array of parallel lines through a window Tessellations An object of class "tess" represents a tessellation. tess quadrats hextess quantess as.tess plot.tess tiles [.tess [<-.tess intersect.tess chop.tess dirichlet delaunay rpoislinetess tile.areas bdist.tiles create a tessellation create a tessellation of rectangles create a tessellation of hexagons quantile tessellation convert other data to a tessellation plot a tessellation extract all the tiles of a tessellation extract some tiles of a tessellation change some tiles of a tessellation intersect two tessellations or restrict a tessellation to a window subdivide a tessellation by a line compute Dirichlet-Voronoi tessellation of points compute Delaunay triangulation of points generate tessellation using Poisson line process area of each tile in tessellation boundary distance for each tile in tessellation Three-dimensional point patterns An object of class "pp3" represents a three-dimensional point pattern in a rectangular box. The box is represented by an object of class "box3". pp3 create a 3-D point pattern 34 spatstat-package plot.pp3 coords as.hyperframe subset.pp3 unitname.pp3 npoints runifpoint3 rpoispp3 envelope.pp3 box3 as.box3 unitname.box3 diameter.box3 volume.box3 shortside.box3 eroded.volumes plot a 3-D point pattern extract coordinates extract coordinates extract subset of 3-D point pattern name of unit of length count the number of points generate uniform random points in 3-D generate Poisson random points in 3-D generate simulation envelopes for 3-D pattern create a 3-D rectangular box convert data to 3-D rectangular box name of unit of length diameter of box volume of box shortest side of box volumes of erosions of box Multi-dimensional space-time point patterns An object of class "ppx" represents a point pattern in multi-dimensional space and/or time. ppx coords as.hyperframe subset.ppx unitname.ppx npoints runifpointx rpoisppx boxx diameter.boxx volume.boxx shortside.boxx eroded.volumes.boxx create a multidimensional space-time point pattern extract coordinates extract coordinates extract subset name of unit of length count the number of points generate uniform random points generate Poisson random points define multidimensional box diameter of box volume of box shortest side of box volumes of erosions of box Point patterns on a linear network An object of class "linnet" represents a linear network (for example, a road network). linnet clickjoin iplot.linnet simplenet lineardisc delaunayNetwork dirichletNetwork methods.linnet vertices.linnet pixellate.linnet create a linear network interactively join vertices in network interactively plot network simple example of network disc in a linear network network of Delaunay triangulation network of Dirichlet edges methods for linnet objects nodes of network approximate by pixel image An object of class "lpp" represents a point pattern on a linear network (for example, road accidents on a road network). spatstat-package 35 lpp methods.lpp subset.lpp rpoislpp runiflpp chicago dendrite spiders create a point pattern on a linear network methods for lpp objects method for subset simulate Poisson points on linear network simulate random points on a linear network Chicago crime data Dendritic spines data Spider webs on mortar lines of brick wall Hyperframes A hyperframe is like a data frame, except that the entries may be objects of any kind. hyperframe as.hyperframe plot.hyperframe with.hyperframe cbind.hyperframe rbind.hyperframe as.data.frame.hyperframe subset.hyperframe head.hyperframe tail.hyperframe create a hyperframe convert data to hyperframe plot hyperframe evaluate expression using each row of hyperframe combine hyperframes by columns combine hyperframes by rows convert hyperframe to data frame method for subset first few rows of hyperframe last few rows of hyperframe Layered objects A layered object represents data that should be plotted in successive layers, for example, a background and a foreground. layered plot.layered [.layered create layered object plot layered object extract subset of layered object Colour maps A colour map is a mechanism for associating colours with data. It can be regarded as a function, mapping data to colours. Using a colourmap object in a plot command ensures that the mapping from numbers to colours is the same in different plots. colourmap plot.colourmap tweak.colourmap interp.colourmap beachcolourmap create a colour map plot the colour map only alter individual colour values make a smooth transition between colours one special colour map II. EXPLORATORY DATA ANALYSIS Inspection of data: summary(X) X any(duplicated(X)) istat(X) View(X) print useful summary of point pattern X print basic description of point pattern X check for duplicated points in pattern X Interactive exploratory analysis spreadsheet-style viewer 36 spatstat-package Classical exploratory tools: clarkevans fryplot miplot Clark and Evans aggregation index Fry plot Morisita Index plot Smoothing: density.ppp relrisk Smooth.ppp bw.diggle bw.ppl bw.scott bw.relrisk bw.smoothppp bw.frac bw.stoyan kernel smoothed density/intensity kernel estimate of relative risk spatial interpolation of marks cross-validated bandwidth selection for density.ppp likelihood cross-validated bandwidth selection for density.ppp Scott’s rule of thumb for density estimation cross-validated bandwidth selection for relrisk cross-validated bandwidth selection for Smooth.ppp bandwidth selection using window geometry Stoyan’s rule of thumb for bandwidth for pcf Modern exploratory tools: clusterset nnclean sharpen.ppp rhohat rho2hat spatialcdf roc Allard-Fraley feature detection Byers-Raftery feature detection Choi-Hall data sharpening Kernel estimate of covariate effect Kernel estimate of effect of two covariates Spatial cumulative distribution function Receiver operating characteristic curve Summary statistics for a point pattern: Type demo(sumfun) for a demonstration of many of the summary statistics. intensity quadratcount intensity.quadratcount Fest Gest Jest Kest Lest Tstat allstats pcf Kinhom Linhom pcfinhom Finhom Ginhom Jinhom localL localK localpcf Mean intensity Quadrat counts Mean intensity in quadrats empty space function F nearest neighbour distribution function G J-function J = (1 − G)/(1 − F ) Ripley’s K-function Besag L-function Third order T -function all four functions F , G, J, K pair correlation function K for inhomogeneous point patterns L for inhomogeneous point patterns pair correlation for inhomogeneous patterns F for inhomogeneous point patterns G for inhomogeneous point patterns J for inhomogeneous point patterns Getis-Franklin neighbourhood density function neighbourhood K-function local pair correlation function spatstat-package localKinhom localLinhom localpcfinhom Ksector Kscaled Kest.fft Kmeasure envelope varblock lohboot 37 local K for inhomogeneous point patterns local L for inhomogeneous point patterns local pair correlation for inhomogeneous patterns Directional K-function locally scaled K-function fast K-function using FFT for large datasets reduced second moment measure simulation envelopes for a summary function variances and confidence intervals for a summary function bootstrap for a summary function Related facilities: plot.fv eval.fv harmonise.fv eval.fasp with.fv Smooth.fv deriv.fv pool.fv nndist nnwhich pairdist crossdist nncross exactdt distmap distfun nnmap nnfun density.ppp Smooth.ppp relrisk sharpen.ppp rknn plot a summary function evaluate any expression involving summary functions make functions compatible evaluate any expression involving an array of functions evaluate an expression for a summary function apply smoothing to a summary function calculate derivative of a summary function pool several estimates of a summary function nearest neighbour distances find nearest neighbours distances between all pairs of points distances between points in two patterns nearest neighbours between two point patterns distance from any location to nearest data point distance map image distance map function nearest point image nearest point function kernel smoothed density spatial interpolation of marks kernel estimate of relative risk data sharpening theoretical distribution of nearest neighbour distance Summary statistics for a multitype point pattern: A multitype point pattern is represented by an object X of class "ppp" such that marks(X) is a factor. relrisk scan.test Gcross,Gdot,Gmulti Kcross,Kdot, Kmulti Lcross,Ldot Jcross,Jdot,Jmulti pcfcross pcfdot pcfmulti markconnect alltypes kernel estimation of relative risk spatial scan test of elevated risk multitype nearest neighbour distributions Gij , Gi• multitype K-functions Kij , Ki• multitype L-functions Lij , Li• multitype J-functions Jij , Ji• multitype pair correlation function gij multitype pair correlation function gi• general pair correlation function marked connection function pij estimates of the above for all i, j pairs 38 spatstat-package Iest Kcross.inhom,Kdot.inhom Lcross.inhom,Ldot.inhom pcfcross.inhom,pcfdot.inhom multitype I-function inhomogeneous counterparts of Kcross, Kdot inhomogeneous counterparts of Lcross, Ldot inhomogeneous counterparts of pcfcross, pcfdot Summary statistics for a marked point pattern: A marked point pattern is represented by an object X of class "ppp" with a component X$marks. The entries in the vector X$marks may be numeric, complex, string or any other atomic type. For numeric marks, there are the following functions: markmean markvar markcorr markcrosscorr markvario Kmark Emark Vmark nnmean nnvario smoothed local average of marks smoothed local variance of marks mark correlation function mark cross-correlation function mark variogram mark-weighted K function mark independence diagnostic E(r) mark independence diagnostic V (r) nearest neighbour mean index nearest neighbour mark variance index For marks of any type, there are the following: Gmulti Kmulti Jmulti multitype nearest neighbour distribution multitype K-function multitype J-function Alternatively use cut.ppp to convert a marked point pattern to a multitype point pattern. Programming tools: applynbd markstat marktable pppdist apply function to every neighbourhood in a point pattern apply function to the marks of neighbours in a point pattern tabulate the marks of neighbours in a point pattern find the optimal match between two point patterns Summary statistics for a point pattern on a linear network: These are for point patterns on a linear network (class lpp). For unmarked patterns: linearK linearKinhom linearpcf linearpcfinhom K function on linear network inhomogeneous K function on linear network pair correlation function on linear network inhomogeneous pair correlation on linear network For multitype patterns: linearKcross linearKdot linearKcross.inhom linearKdot.inhom linearmarkconnect K function between two types of points K function from one type to any type Inhomogeneous version of linearKcross Inhomogeneous version of linearKdot Mark connection function on linear network spatstat-package 39 linearmarkequal linearpcfcross linearpcfdot linearpcfcross.inhom linearpcfdot.inhom Mark equality function on linear network Pair correlation between two types of points Pair correlation from one type to any type Inhomogeneous version of linearpcfcross Inhomogeneous version of linearpcfdot Related facilities: pairdist.lpp crossdist.lpp nndist.lpp nncross.lpp nnwhich.lpp nnfun.lpp density.lpp distfun.lpp envelope.lpp rpoislpp runiflpp distances between pairs distances between pairs nearest neighbour distances nearest neighbour distances find nearest neighbours find nearest data point kernel smoothing estimator of intensity distance transform simulation envelopes simulate Poisson points on linear network simulate random points on a linear network It is also possible to fit point process models to lpp objects. See Section IV. Summary statistics for a three-dimensional point pattern: These are for 3-dimensional point pattern objects (class pp3). F3est G3est K3est pcf3est empty space function F nearest neighbour function G K-function pair correlation function Related facilities: envelope.pp3 pairdist.pp3 crossdist.pp3 nndist.pp3 nnwhich.pp3 nncross.pp3 simulation envelopes distances between all pairs of points distances between points in two patterns nearest neighbour distances find nearest neighbours find nearest neighbours in another pattern Computations for multi-dimensional point pattern: These are for multi-dimensional space-time point pattern objects (class ppx). pairdist.ppx crossdist.ppx nndist.ppx nnwhich.ppx distances between all pairs of points distances between points in two patterns nearest neighbour distances find nearest neighbours Summary statistics for random sets: These work for point patterns (class ppp), line segment patterns (class psp) or windows (class owin). Hest spherical contact distribution H 40 spatstat-package Gfox Jfox Foxall G-function Foxall J-function III. MODEL FITTING (COX AND CLUSTER MODELS) Cluster process models (with homogeneous or inhomogeneous intensity) and Cox processes can be fitted by the function kppm. Its result is an object of class "kppm". The fitted model can be printed, plotted, predicted, simulated and updated. kppm plot.kppm summary.kppm fitted.kppm predict.kppm update.kppm improve.kppm simulate.kppm vcov.kppm coef.kppm formula.kppm parameters clusterfield clusterradius Kmodel.kppm pcfmodel.kppm Fit model Plot the fitted model Summarise the fitted model Compute fitted intensity Compute fitted intensity Update the model Refine the estimate of trend Generate simulated realisations Variance-covariance matrix of coefficients Extract trend coefficients Extract trend formula Extract all model parameters Compute offspring density Radius of support of offspring density K function of fitted model Pair correlation of fitted model For model selection, you can also use the generic functions step, drop1 and AIC on fitted point process models. The theoretical models can also be simulated, for any choice of parameter values, using rThomas, rMatClust, rCauchy, rVarGamma, and rLGCP. Lower-level fitting functions include: lgcp.estK lgcp.estpcf thomas.estK thomas.estpcf matclust.estK matclust.estpcf cauchy.estK cauchy.estpcf vargamma.estK vargamma.estpcf mincontrast fit a log-Gaussian Cox process model fit a log-Gaussian Cox process model fit the Thomas process model fit the Thomas process model fit the Matern Cluster process model fit the Matern Cluster process model fit a Neyman-Scott Cauchy cluster process fit a Neyman-Scott Cauchy cluster process fit a Neyman-Scott Variance Gamma process fit a Neyman-Scott Variance Gamma process low-level algorithm for fitting models by the method of minimum contrast IV. MODEL FITTING (POISSON AND GIBBS MODELS) Types of models Poisson point processes are the simplest models for point patterns. A Poisson model assumes that the points are stochastically independent. It may allow the points to have a non-uniform spatial density. The special case of a Poisson process with a uniform spatial density is often called Complete Spatial Randomness. spatstat-package 41 Poisson point processes are included in the more general class of Gibbs point process models. In a Gibbs model, there is interaction or dependence between points. Many different types of interaction can be specified. For a detailed explanation of how to fit Poisson or Gibbs point process models to point pattern data using spatstat, see Baddeley and Turner (2005b) or Baddeley (2008). To fit a Poisson or Gibbs point process model: Model fitting in spatstat is performed mainly by the function ppm. Its result is an object of class "ppm". Here are some examples, where X is a point pattern (class "ppp"): command ppm(X) ppm(X ~ 1) ppm(X ~ x) ppm(X ~ 1, Strauss(0.1)) ppm(X ~ x, Strauss(0.1)) model Complete Spatial Randomness Complete Spatial Randomness Poisson process with intensity loglinear in x coordinate Stationary Strauss process Strauss process with conditional intensity loglinear in x It is also possible to fit models that depend on other covariates. Manipulating the fitted model: plot.ppm predict.ppm coef.ppm parameters formula.ppm intensity.ppm Kmodel.ppm pcfmodel.ppm fitted.ppm residuals.ppm update.ppm vcov.ppm rmh.ppm simulate.ppm print.ppm summary.ppm effectfun logLik.ppm anova.ppm model.frame.ppm model.images model.depends as.interact fitin is.hybrid valid.ppm project.ppm Plot the fitted model Compute the spatial trend and conditional intensity of the fitted point process model Extract the fitted model coefficients Extract all model parameters Extract the trend formula Compute fitted intensity K function of fitted model pair correlation of fitted model Compute fitted conditional intensity at quadrature points Compute point process residuals at quadrature points Update the fit Variance-covariance matrix of estimates Simulate from fitted model Simulate from fitted model Print basic information about a fitted model Summarise a fitted model Compute the fitted effect of one covariate log-likelihood or log-pseudolikelihood Analysis of deviance Extract data frame used to fit model Extract spatial data used to fit model Identify variables in the model Interpoint interaction component of model Extract fitted interpoint interaction Determine whether the model is a hybrid Check the model is a valid point process Ensure the model is a valid point process 42 spatstat-package For model selection, you can also use the generic functions step, drop1 and AIC on fitted point process models. See spatstat.options to control plotting of fitted model. To specify a point process model: The first order “trend” of the model is determined by an R language formula. The formula specifies the form of the logarithm of the trend. X ~ 1 X ~ x X ~ polynom(x,y,3) X ~ harmonic(x,y,2) X ~ Z No trend (stationary) Loglinear trend λ(x, y) = exp(α + βx) where x, y are Cartesian coordinates Log-cubic polynomial trend Log-harmonic polynomial trend Loglinear function of covariate Z λ(x, y) = exp(α + βZ(x, y)) The higher order (“interaction”) components are described by an object of class "interact". Such objects are created by: Poisson() AreaInter() BadGey() Concom() DiggleGratton() DiggleGatesStibbard() Fiksel() Geyer() Hardcore() HierHard() HierStrauss() HierStraussHard() Hybrid() LennardJones() MultiHard() MultiStrauss() MultiStraussHard() OrdThresh() Ord() PairPiece() Pairwise() Penttinen() SatPiece() Saturated() Softcore() Strauss() StraussHard() Triplets() the Poisson point process Area-interaction process multiscale Geyer process connected component interaction Diggle-Gratton potential Diggle-Gates-Stibbard potential Fiksel pairwise interaction process Geyer’s saturation process Hard core process Hierarchical multiype hard core process Hierarchical multiype Strauss process Hierarchical multiype Strauss-hard core process Hybrid of several interactions Lennard-Jones potential multitype hard core process multitype Strauss process multitype Strauss/hard core process Ord process, threshold potential Ord model, user-supplied potential pairwise interaction, piecewise constant pairwise interaction, user-supplied potential Penttinen pairwise interaction Saturated pair model, piecewise constant potential Saturated pair model, user-supplied potential pairwise interaction, soft core potential Strauss process Strauss/hard core point process Geyer triplets process Note that it is also possible to combine several such interactions using Hybrid. Finer control over model fitting: A quadrature scheme is represented by an object of class "quad". To create a quadrature scheme, typically use quadscheme. spatstat-package 43 quadscheme default quadrature scheme using rectangular cells or Dirichlet cells quadrature scheme based on image pixels create an object of class "quad" pixelquad quad To inspect a quadrature scheme: plot(Q) print(Q) summary(Q) plot quadrature scheme Q print basic information about quadrature scheme Q summary of quadrature scheme Q A quadrature scheme consists of data points, dummy points, and weights. To generate dummy points: default.dummy gridcentres rstrat spokes corners default pattern of dummy points dummy points in a rectangular grid stratified random dummy pattern radial pattern of dummy points dummy points at corners of the window To compute weights: gridweights dirichletWeights quadrature weights by the grid-counting rule quadrature weights are Dirichlet tile areas Simulation and goodness-of-fit for fitted models: rmh.ppm simulate.ppm envelope simulate realisations of a fitted model simulate realisations of a fitted model compute simulation envelopes for a fitted model Point process models on a linear network: An object of class "lpp" represents a pattern of points on a linear network. Point process models can also be fitted to these objects. Currently only Poisson models can be fitted. lppm anova.lppm envelope.lppm fitted.lppm predict.lppm linim plot.linim eval.linim linfun methods.linfun point process model on linear network analysis of deviance for point process model on linear network simulation envelopes for point process model on linear network fitted intensity values model prediction on linear network pixel image on linear network plot a pixel image on linear network evaluate expression involving images function defined on linear network conversion facilities V. MODEL FITTING (DETERMINANTAL POINT PROCESS MODELS) Code for fitting determinantal point process models has recently been added to spatstat. 44 spatstat-package For information, see the help file for dppm. VI. MODEL FITTING (SPATIAL LOGISTIC REGRESSION) Logistic regression Pixel-based spatial logistic regression is an alternative technique for analysing spatial point patterns that is widely used in Geographical Information Systems. It is approximately equivalent to fitting a Poisson point process model. In pixel-based logistic regression, the spatial domain is divided into small pixels, the presence or absence of a data point in each pixel is recorded, and logistic regression is used to model the presence/absence indicators as a function of any covariates. Facilities for performing spatial logistic regression are provided in spatstat for comparison purposes. Fitting a spatial logistic regression Spatial logistic regression is performed by the function slrm. Its result is an object of class "slrm". There are many methods for this class, including methods for print, fitted, predict, simulate, anova, coef, logLik, terms, update, formula and vcov. For example, if X is a point pattern (class "ppp"): command slrm(X ~ 1) slrm(X ~ x) slrm(X ~ Z) model Complete Spatial Randomness Poisson process with intensity loglinear in x coordinate Poisson process with intensity loglinear in covariate Z Manipulating a fitted spatial logistic regression anova.slrm coef.slrm vcov.slrm fitted.slrm logLik.slrm plot.slrm predict.slrm simulate.slrm Analysis of deviance Extract fitted coefficients Variance-covariance matrix of fitted coefficients Compute fitted probabilities or intensity Evaluate loglikelihood of fitted model Plot fitted probabilities or intensity Compute predicted probabilities or intensity with new data Simulate model There are many other undocumented methods for this class, including methods for print, update, formula and terms. Stepwise model selection is possible using step or stepAIC. VII. SIMULATION There are many ways to generate a random point pattern, line segment pattern, pixel image or tessellation in spatstat. Random point patterns: runifpoint rpoint rmpoint rpoispp generate n independent uniform random points generate n independent random points generate n independent multitype random points simulate the (in)homogeneous Poisson point process spatstat-package 45 rmpoispp runifdisc rstrat rsyst rMaternI rMaternII rSSI rHardcore rStrauss rStraussHard rDiggleGratton rDGS rPenttinen rNeymanScott rMatClust rThomas rLGCP rGaussPoisson rCauchy rVarGamma rcell runifpointOnLines rpoisppOnLines simulate the (in)homogeneous multitype Poisson point process generate n independent uniform random points in disc stratified random sample of points systematic random sample (grid) of points simulate the Matérn Model I inhibition process simulate the Matérn Model II inhibition process simulate Simple Sequential Inhibition process simulate hard core process (perfect simulation) simulate Strauss process (perfect simulation) simulate Strauss-hard core process (perfect simulation) simulate Diggle-Gratton process (perfect simulation) simulate Diggle-Gates-Stibbard process (perfect simulation) simulate Penttinen process (perfect simulation) simulate a general Neyman-Scott process simulate the Matérn Cluster process simulate the Thomas process simulate the log-Gaussian Cox process simulate the Gauss-Poisson cluster process simulate Neyman-Scott process with Cauchy clusters simulate Neyman-Scott process with Variance Gamma clusters simulate the Baddeley-Silverman cell process generate n random points along specified line segments generate Poisson random points along specified line segments Resampling a point pattern: quadratresample rjitter rshift rthin block resampling apply random displacements to points in a pattern random shifting of (subsets of) points random thinning See also varblock for estimating the variance of a summary statistic by block resampling, and lohboot for another bootstrap technique. Fitted point process models: If you have fitted a point process model to a point pattern dataset, the fitted model can be simulated. Cluster process models are fitted by the function kppm yielding an object of class "kppm". To generate one or more simulated realisations of this fitted model, use simulate.kppm. Gibbs point process models are fitted by the function ppm yielding an object of class "ppm". To generate a simulated realisation of this fitted model, use rmh. To generate one or more simulated realisations of the fitted model, use simulate.ppm. Other random patterns: rlinegrid rpoisline rpoislinetess rMosaicSet rMosaicField generate a random array of parallel lines through a window simulate the Poisson line process within a window generate random tessellation using Poisson line process generate random set by selecting some tiles of a tessellation generate random pixel image by assigning random values in each tile of a tessellation Simulation-based inference envelope critical envelope for Monte Carlo test of goodness-of-fit 46 spatstat-package qqplot.ppm scan.test studpermu.test segregation.test diagnostic plot for interpoint interaction spatial scan statistic/test studentised permutation test test of segregation of types VIII. TESTS AND DIAGNOSTICS Hypothesis tests: quadrat.test clarkevans.test cdf.test berman.test envelope scan.test dclf.test mad.test anova.ppm χ2 goodness-of-fit test on quadrat counts Clark and Evans test Spatial distribution goodness-of-fit test Berman’s goodness-of-fit tests critical envelope for Monte Carlo test of goodness-of-fit spatial scan statistic/test Diggle-Cressie-Loosmore-Ford test Mean Absolute Deviation test Analysis of Deviance for point process models More recently-developed tests: dg.test bits.test dclf.progress mad.progress Dao-Genton test Balanced independent two-stage test Progress plot for DCLF test Progress plot for MAD test Sensitivity diagnostics: Classical measures of model sensitivity such as leverage and influence have been adapted to point process models. leverage.ppm influence.ppm dfbetas.ppm Leverage for point process model Influence for point process model Parameter influence Diagnostics for covariate effect: Classical diagnostics for covariate effects have been adapted to point process models. parres addvar rhohat rho2hat Partial residual plot Added variable plot Kernel estimate of covariate effect Kernel estimate of covariate effect (bivariate) Residual diagnostics: Residuals for a fitted point process model, and diagnostic plots based on the residuals, were introduced in Baddeley et al (2005) and Baddeley, Rubak and Møller (2011). Type demo(diagnose) for a demonstration of the diagnostics features. diagnose.ppm qqplot.ppm diagnostic plots for spatial trend diagnostic Q-Q plot for interpoint interaction spatstat-package 47 residualspaper Kcom Gcom Kres Gres psst psstA psstG compareFit examples from Baddeley et al (2005) model compensator of K function model compensator of G function score residual of K function score residual of G function pseudoscore residual of summary function pseudoscore residual of empty space function pseudoscore residual of G function compare compensators of several fitted models Resampling and randomisation procedures You can build your own tests based on randomisation and resampling using the following capabilities: quadratresample rjitter rshift rthin block resampling apply random displacements to points in a pattern random shifting of (subsets of) points random thinning IX. DOCUMENTATION The online manual entries are quite detailed and should be consulted first for information about a particular function. The book Baddeley, Rubak and Turner (2015) is a complete course on analysing spatial point patterns, with full details about spatstat. Older material (which is now out-of-date but is freely available) includes Baddeley and Turner (2005a), a brief overview of the package in its early development; Baddeley and Turner (2005b), a more detailed explanation of how to fit point process models to data; and Baddeley (2010), a complete set of notes from a 2-day workshop on the use of spatstat. Type citation("spatstat") to get a list of these references. Licence This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package. Acknowledgements Kasper Klitgaard Berthelsen, Ottmar Cronie, Yongtao Guan, Ute Hahn, Abdollah Jalilian, MarieColette van Lieshout, Greg McSwiggan, Tuomas Rajala, Suman Rakshit, Dominic Schuhmacher, Rasmus Waagepetersen and Hangsheng Wang made substantial contributions of code. Additional contributions and suggestions from Monsuru Adepeju, Corey Anderson, Ang Qi Wei, Marcel Austenfeld, Sandro Azaele, Malissa Baddeley, Guy Bayegnak, Colin Beale, Melanie Bell, Thomas Bendtsen, Ricardo Bernhardt, Andrew Bevan, Brad Biggerstaff, Anders Bilgrau, Leanne Bischof, Christophe Biscio, Roger Bivand, Jose M. Blanco Moreno, Florent Bonneu, Julian Burgos, Simon Byers, Ya-Mei Chang, Jianbao Chen, Igor Chernayavsky, Y.C. Chin, Bjarke Christensen, Jean-Francois Coeurjolly, Kim Colyvas, Rochelle Constantine, Robin Corria Ainslie, Richard Cotton, Marcelino de la Cruz, Peter Dalgaard, Mario D’Antuono, Sourav Das, Tilman Davies, Peter Diggle, Patrick Donnelly, Ian Dryden, Stephen Eglen, Ahmed El-Gabbas, Belarmain Fandohan, Olivier Flores, David Ford, Peter Forbes, Shane Frank, Janet Franklin, Funwi-Gabga Neba, Oscar Garcia, Agnes Gault, Jonas Geldmann, Marc Genton, Shaaban Ghalandarayeshi, Julian Gilbey, 48 spatstat-package Jason Goldstick, Pavel Grabarnik, C. Graf, Ute Hahn, Andrew Hardegen, Martin Bøgsted Hansen, Martin Hazelton, Juha Heikkinen, Mandy Hering, Markus Herrmann, Paul Hewson, Kassel Hingee, Kurt Hornik, Philipp Hunziker, Jack Hywood, Ross Ihaka, C̆enk Içös, Aruna Jammalamadaka, Robert John-Chandran, Devin Johnson, Mahdieh Khanmohammadi, Bob Klaver, Lily KozmianLedward, Peter Kovesi, Mike Kuhn, Jeff Laake, Frederic Lavancier, Tom Lawrence, Robert Lamb, Jonathan Lee, George Leser, Li Haitao, George Limitsios, Andrew Lister, Ben Madin, Martin Maechler, Kiran Marchikanti, Jeff Marcus, Robert Mark, Peter McCullagh, Monia Mahling, Jorge Mateu Mahiques, Ulf Mehlig, Frederico Mestre, Sebastian Wastl Meyer, Mi Xiangcheng, Lore De Middeleer, Robin Milne, Enrique Miranda, Jesper Møller, Mehdi Moradi, Virginia Morera Pujol, Erika Mudrak, Gopalan Nair, Nader Najari, Nicoletta Nava, Linda Stougaard Nielsen, Felipe Nunes, Jens Randel Nyengaard, Jens Oehlschlägel, Thierry Onkelinx, Sean O’Riordan, Evgeni Parilov, Jeff Picka, Nicolas Picard, Mike Porter, Sergiy Protsiv, Adrian Raftery, Suman Rakshit, Ben Ramage, Pablo Ramon, Xavier Raynaud, Nicholas Read, Matt Reiter, Ian Renner, Tom Richardson, Brian Ripley, Ted Rosenbaum, Barry Rowlingson, Jason Rudokas, John Rudge, Christopher Ryan, Farzaneh Safavimanesh, Aila Särkkä, Cody Schank, Katja Schladitz, Sebastian Schutte, Bryan Scott, Olivia Semboli, François Sémécurbe, Vadim Shcherbakov, Shen Guochun, Shi Peijian, Harold-Jeffrey Ship, Tammy L Silva, Ida-Maria Sintorn, Yong Song, Malte Spiess, Mark Stevenson, Kaspar Stucki, Michael Sumner, P. Surovy, Ben Taylor, Thordis Linda Thorarinsdottir, Leigh Torres, Berwin Turlach, Torben Tvedebrink, Kevin Ummer, Medha Uppala, Andrew van Burgel, Tobias Verbeke, Mikko Vihtakari, Alexendre Villers, Fabrice Vinatier, Sasha Voss, Sven Wagner, Hao Wang, H. Wendrock, Jan Wild, Carl G. Witthoft, Selene Wong, Maxime Woringer, Mike Zamboni and Achim Zeileis. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . References Baddeley, A. (2010) Analysing spatial point patterns in R. Workshop notes, Version 4.1. Online technical publication, CSIRO. https://research.csiro.au/software/wp-content/uploads/ sites/6/2015/02/Rspatialcourse_CMIS_PDF-Standard.pdf Baddeley, A., Rubak, E. and Turner, R. (2015) Spatial Point Patterns: Methodology and Applications with R. Chapman and Hall/CRC Press. Baddeley, A. and Turner, R. (2005a) Spatstat: an R package for analyzing spatial point patterns. Journal of Statistical Software 12:6, 1–42. URL: www.jstatsoft.org, ISSN: 1548-7660. Baddeley, A. and Turner, R. (2005b) Modelling spatial point patterns in R. In: A. Baddeley, P. Gregori, J. Mateu, R. Stoica, and D. Stoyan, editors, Case Studies in Spatial Point Pattern Modelling, Lecture Notes in Statistics number 185. Pages 23–74. Springer-Verlag, New York, 2006. ISBN: 0-387-28311-0. Baddeley, A., Turner, R., Møller, J. and Hazelton, M. (2005) Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67, 617–666. Baddeley, A., Rubak, E. and Møller, J. (2011) Score, pseudo-score and residual diagnostics for spatial point process models. Statistical Science 26, 613–646. Baddeley, A., Turner, R., Mateu, J. and Bevan, A. (2013) Hybrids of Gibbs point process models and their implementation. Journal of Statistical Software 55:11, 1–43. http://www.jstatsoft. org/v55/i11/ Diggle, P.J. (2003) Statistical analysis of spatial point patterns, Second edition. Arnold. Diggle, P.J. (2014) Statistical Analysis of Spatial and Spatio-Temporal Point Patterns, Third edition. Chapman and Hall/CRC. adaptive.density 49 Gelfand, A.E., Diggle, P.J., Fuentes, M. and Guttorp, P., editors (2010) Handbook of Spatial Statistics. CRC Press. Huang, F. and Ogata, Y. (1999) Improvements of the maximum pseudo-likelihood estimators in various spatial statistical models. Journal of Computational and Graphical Statistics 8, 510–530. Illian, J., Penttinen, A., Stoyan, H. and Stoyan, D. (2008) Statistical Analysis and Modelling of Spatial Point Patterns. Wiley. Waagepetersen, R. An estimating function approach to inference for inhomogeneous Neyman-Scott processes. Biometrics 63 (2007) 252–258. adaptive.density Intensity Estimate of Point Pattern Using Tessellation Description Computes an adaptive estimate of the intensity function of a point pattern. Usage adaptive.density(X, f = 0.1, ..., nrep = 1, verbose=TRUE) Arguments X Point pattern dataset (object of class "ppp"). f Fraction (between 0 and 1 inclusive) of the data points that will be removed from the data and used to determine a tessellation for the intensity estimate. ... Arguments passed to as.im determining the pixel resolution of the result. nrep Number of independent repetitions of the randomised procedure. verbose Logical value indicating whether to print progress reports. Details This function is an alternative to density.ppp. It computes an estimate of the intensity function of a point pattern dataset. The result is a pixel image giving the estimated intensity, If f=1, the Voronoi estimate (Barr and Schoenberg, 2010) is computed: the point pattern X is used to construct a Voronoi/Dirichlet tessellation (see dirichlet); the areas of the Dirichlet tiles are computed; the estimated intensity in each tile is the reciprocal of the tile area. If f=0, the intensity estimate at every location is equal to the average intensity (number of points divided by window area). If f is strictly between 0 and 1, the dataset X is randomly split into two patterns A and B containing a fraction f and 1-f, respectively, of the original data. The subpattern A is used to construct a Dirichlet tessellation, while the subpattern B is retained for counting. For each tile of the Dirichlet tessellation, we count the number of points of B falling in the tile, and divide by the area of the same tile, to obtain an estimate of the intensity of the pattern B in the tile. This estimate is divided by 1-f to obtain an estimate of the intensity of X in the tile. The result is a pixel image of intensity estimates which are constant on each tile of the tessellation. If nrep is greater than 1, this randomised procedure is repeated nrep times, and the results are averaged. This technique has been used by Ogata et al. (2003), Ogata (2004) and Baddeley (2007). 50 add.texture Value A pixel image (object of class "im") whose values are estimates of the intensity of X. Author(s) Adrian Baddeley and Rolf Turner References Baddeley, A. (2007) Validation of statistical models for spatial point patterns. In J.G. Babu and E.D. Feigelson (eds.) SCMA IV: Statistical Challenges in Modern Astronomy IV, volume 317 of Astronomical Society of the Pacific Conference Series, San Francisco, California USA, 2007. Pages 22–38. Barr, C., and Schoenberg, F.P. (2010). On the Voronoi estimator for the intensity of an inhomogeneous planar Poisson process. Biometrika 97 (4), 977–984. Ogata, Y. (2004) Space-time model for regional seismicity and detection of crustal stress changes. Journal of Geophysical Research, 109, 2004. Ogata, Y., Katsura, K. and Tanemura, M. (2003). Modelling heterogeneous space-time occurrences of earthquakes and its residual analysis. Applied Statistics 52 499–509. See Also density.ppp, dirichlet, im.object. Examples plot(adaptive.density(nztrees, 1), main="Voronoi estimate") nr <- if(interactive()) 100 else 5 plot(adaptive.density(nztrees, nrep=nr), main="Adaptive estimate") add.texture Fill Plot With Texture Description Draws a simple texture inside a region on the plot. Usage add.texture(W, texture = 4, spacing = NULL, ...) Arguments W Window (object of class "owin") inside which the texture should be drawn. texture Integer from 1 to 8 identifying the type of texture. See Details. spacing Spacing between elements of the texture, in units of the current plot. ... Further arguments controlling the plot colour, line width etc. addvar 51 Details The chosen texture, confined to the window W, will be added to the current plot. The available textures are: texture=1: Small crosses arranged in a square grid. texture=2: Parallel vertical lines. texture=3: Parallel horizontal lines. texture=4: Parallel diagonal lines at 45 degrees from the horizontal. texture=5: Parallel diagonal lines at 135 degrees from the horizontal. texture=6: Grid of horizontal and vertical lines. texture=7: Grid of diagonal lines at 45 and 135 degrees from the horizontal. texture=8: Grid of hexagons. Author(s) Adrian Baddeley and Rolf Turner See Also owin, plot.owin, textureplot, texturemap. Examples W <- Window(chorley) plot(W, main="") add.texture(W, 7) addvar Added Variable Plot for Point Process Model Description Computes the coordinates for an Added Variable Plot for a fitted point process model. Usage addvar(model, covariate, ..., subregion=NULL, bw="nrd0", adjust=1, from=NULL, to=NULL, n=512, bw.input = c("points", "quad"), bw.restrict = FALSE, covname, crosscheck=FALSE) 52 addvar Arguments model Fitted point process model (object of class "ppm"). covariate The covariate to be added to the model. Either a pixel image, a function(x,y), or a character string giving the name of a covariate that was supplied when the model was fitted. subregion Optional. A window (object of class "owin") specifying a subset of the spatial domain of the data. The calculation will be confined to the data in this subregion. bw Smoothing bandwidth or bandwidth rule (passed to density.default). adjust Smoothing bandwidth adjustment factor (passed to density.default). n, from, to Arguments passed to density.default to control the number and range of values at which the function will be estimated. ... Additional arguments passed to density.default. bw.input Character string specifying the input data used for automatic bandwidth selection. bw.restrict Logical value, specifying whether bandwidth selection is performed using data from the entire spatial domain or from the subregion. covname Optional. Character string to use as the name of the covariate. crosscheck For developers only. Logical value indicating whether to perform cross-checks on the validity of the calculation. Details This command generates the plot coordinates for an Added Variable Plot for a spatial point process model. Added Variable Plots (Cox, 1958, sec 4.5; Wang, 1985) are commonly used in linear models and generalized linear models, to decide whether a model with response y and predictors x would be improved by including another predictor z. In a (generalised) linear model with response y and predictors x, the Added Variable Plot for a new covariate z is a plot of the smoothed Pearson residuals from the original model against the scaled residuals from a weighted linear regression of z on x. If this plot has nonzero slope, then the new covariate z is needed. For general advice see Cook and Weisberg(1999); Harrell (2001). Essentially the same technique can be used for a spatial point process model (Baddeley et al, 2012). The argument model should be a fitted spatial point process model (object of class "ppm"). The argument covariate identifies the covariate that is to be considered for addition to the model. It should be either a pixel image (object of class "im") or a function(x,y) giving the values of the covariate at any spatial location. Alternatively covariate may be a character string, giving the name of a covariate that was supplied (in the covariates argument to ppm) when the model was fitted, but was not used in the model. The result of addvar(model, covariate) is an object belonging to the classes "addvar" and "fv". Plot this object to generate the added variable plot. Note that the plot method shows the pointwise significance bands for a test of the null model, i.e. the null hypothesis that the new covariate has no effect. The smoothing bandwidth is controlled by the arguments bw, adjust, bw.input and bw.restrict. If bw is a numeric value, then the bandwidth is taken to be adjust * bw. If bw is a string representing a bandwidth selection rule (recognised by density.default) then the bandwidth is selected by this rule. addvar 53 The data used for automatic bandwidth selection are specified by bw.input and bw.restrict. If bw.input="points" (the default) then bandwidth selection is based on the covariate values at the points of the original point pattern dataset to which the model was fitted. If bw.input="quad" then bandwidth selection is based on the covariate values at every quadrature point used to fit the model. If bw.restrict=TRUE then the bandwidth selection is performed using only data from inside the subregion. Value An object of class "addvar" containing the coordinates for the added variable plot. There is a plot method. Slow computation In a large dataset, computation can be very slow if the default settings are used, because the smoothing bandwidth is selected automatically. To avoid this, specify a numerical value for the bandwidth bw. One strategy is to use a coarser subset of the data to select bw automatically. The selected bandwidth can be read off the print output for addvar. Internal data The return value has an attribute "spatial" which contains the internal data: the computed values of the residuals, and of all relevant covariates, at each quadrature point of the model. It is an object of class "ppp" with a data frame of marks. Author(s) Adrian Baddeley , Rolf Turner , Ya-Mei Chang and Yong Song. References Baddeley, A., Chang, Y.-M., Song, Y. and Turner, R. (2013) Residual diagnostics for covariate effects in spatial point process models. Journal of Computational and Graphical Statistics, 22, 886–905. Cook, R.D. and Weisberg, S. (1999) Applied regression, including computing and graphics. New York: Wiley. Cox, D.R. (1958) Planning of Experiments. New York: Wiley. Harrell, F. (2001) Regression Modeling Strategies. New York: Springer. Wang, P. (1985) Adding a variable in generalized linear models. Technometrics 27, 273–276. See Also parres, rhohat, rho2hat. Examples X <- rpoispp(function(x,y){exp(3+3*x)}) model <- ppm(X, ~y) adv <- addvar(model, "x") plot(adv) adv <- addvar(model, "x", subregion=square(0.5)) 54 affine.im affine Apply Affine Transformation Description Applies any affine transformation of the plane (linear transformation plus vector shift) to a plane geometrical object, such as a point pattern or a window. Usage affine(X, ...) Arguments X Any suitable dataset representing a two-dimensional object, such as a point pattern (object of class "ppp"), a line segment pattern (object of class "psp"), a window (object of class "owin") or a pixel image (object of class "im"). ... Arguments determining the affine transformation. Details This is generic. Methods are provided for point patterns (affine.ppp) and windows (affine.owin). Value Another object of the same type, representing the result of applying the affine transformation. Author(s) Adrian Baddeley and Rolf Turner See Also affine.ppp, affine.psp, affine.owin, affine.im, flipxy, reflect, rotate, shift affine.im Apply Affine Transformation To Pixel Image Description Applies any affine transformation of the plane (linear transformation plus vector shift) to a pixel image. Usage ## S3 method for class 'im' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) affine.linnet 55 Arguments X Pixel image (object of class "im"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. ... Optional arguments passed to as.mask controlling the pixel resolution of the transformed image. Details The image is subjected first to the linear transformation represented by mat (multiplying on the left by mat), and then the result is translated by the vector vec. The argument mat must be a nonsingular 2 × 2 matrix. This is a method for the generic function affine. Value Another pixel image (of class "im") representing the result of applying the affine transformation. Author(s) Adrian Baddeley and Rolf Turner See Also affine, affine.ppp, affine.psp, affine.owin, rotate, shift Examples X <- setcov(owin()) stretch <- diag(c(2,3)) Y <- affine(X, mat=stretch) shear <- matrix(c(1,0,0.6,1),ncol=2, nrow=2) Z <- affine(X, mat=shear) affine.linnet Apply Geometrical Transformations to a Linear Network Description Apply geometrical transformations to a linear network. 56 affine.linnet Usage ## S3 method for class 'linnet' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) ## S3 method for class 'linnet' shift(X, vec=c(0,0), ..., origin=NULL) ## S3 method for class 'linnet' rotate(X, angle=pi/2, ..., centre=NULL) ## S3 method for class 'linnet' scalardilate(X, f, ...) ## S3 method for class 'linnet' rescale(X, s, unitname) Arguments X Linear network (object of class "linnet"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. angle Rotation angle in radians. f Scalar dilation factor. s Unit conversion factor: the new units are s times the old units. ... Arguments passed to other methods. origin Character string determining a location that will be shifted to the origin. Options are "centroid", "midpoint" and "bottomleft". Partially matched. centre Centre of rotation. Either a vector of length 2, or a character string (partially matched to "centroid", "midpoint" or "bottomleft"). The default is the coordinate origin c(0,0). unitname Optional. New name for the unit of length. A value acceptable to the function unitname<- Details These functions are methods for the generic functions affine, shift, rotate, rescale and scalardilate applicable to objects of class "linnet". All of these functions perform geometrical transformations on the object X, except for rescale, which simply rescales the units of length. Value Another linear network (of class "linnet") representing the result of applying the geometrical transformation. Author(s) Adrian Baddeley and Rolf Turner affine.lpp 57 See Also linnet and as.linnet. Generic functions affine, shift, rotate, scalardilate, rescale. Examples U <- rotate(simplenet, pi) stretch <- diag(c(2,3)) Y <- affine(simplenet, mat=stretch) shear <- matrix(c(1,0,0.6,1),ncol=2, nrow=2) Z <- affine(simplenet, mat=shear, vec=c(0, 1)) affine.lpp Apply Geometrical Transformations to Point Pattern on a Linear Network Description Apply geometrical transformations to a point pattern on a linear network. Usage ## S3 method for class 'lpp' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) ## S3 method for class 'lpp' shift(X, vec=c(0,0), ..., origin=NULL) ## S3 method for class 'lpp' rotate(X, angle=pi/2, ..., centre=NULL) ## S3 method for class 'lpp' scalardilate(X, f, ...) ## S3 method for class 'lpp' rescale(X, s, unitname) Arguments X Point pattern on a linear network (object of class "lpp"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. angle Rotation angle in radians. f Scalar dilation factor. s Unit conversion factor: the new units are s times the old units. ... Arguments passed to other methods. origin Character string determining a location that will be shifted to the origin. Options are "centroid", "midpoint" and "bottomleft". Partially matched. 58 affine.owin centre Centre of rotation. Either a vector of length 2, or a character string (partially matched to "centroid", "midpoint" or "bottomleft"). The default is the coordinate origin c(0,0). unitname Optional. New name for the unit of length. A value acceptable to the function unitname<- Details These functions are methods for the generic functions affine, shift, rotate, rescale and scalardilate applicable to objects of class "lpp". All of these functions perform geometrical transformations on the object X, except for rescale, which simply rescales the units of length. Value Another point pattern on a linear network (object of class "lpp") representing the result of applying the geometrical transformation. Author(s) Adrian Baddeley and Rolf Turner See Also lpp. Generic functions affine, shift, rotate, scalardilate, rescale. Examples X <- rpoislpp(2, simplenet) U <- rotate(X, pi) stretch <- diag(c(2,3)) Y <- affine(X, mat=stretch) shear <- matrix(c(1,0,0.6,1),ncol=2, nrow=2) Z <- affine(X, mat=shear, vec=c(0, 1)) affine.owin Apply Affine Transformation To Window Description Applies any affine transformation of the plane (linear transformation plus vector shift) to a window. Usage ## S3 method for class 'owin' affine(X, mat=diag(c(1,1)), vec=c(0,0), ..., rescue=TRUE) affine.ppp 59 Arguments X Window (object of class "owin"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. rescue Logical. If TRUE, the transformed window will be processed by rescue.rectangle. ... Optional arguments passed to as.mask controlling the pixel resolution of the transformed window, if X is a binary pixel mask. Details The window is subjected first to the linear transformation represented by mat (multiplying on the left by mat), and then the result is translated by the vector vec. The argument mat must be a nonsingular 2 × 2 matrix. This is a method for the generic function affine. Value Another window (of class "owin") representing the result of applying the affine transformation. Author(s) Adrian Baddeley and Rolf Turner See Also affine, affine.ppp, affine.psp, affine.im, rotate, shift Examples # shear transformation shear <- matrix(c(1,0,0.6,1),ncol=2) X <- affine(owin(), shear) ## Not run: plot(X) ## End(Not run) data(letterR) affine(letterR, shear, c(0, 0.5)) affine(as.mask(letterR), shear, c(0, 0.5)) affine.ppp Apply Affine Transformation To Point Pattern Description Applies any affine transformation of the plane (linear transformation plus vector shift) to a point pattern. 60 affine.ppp Usage ## S3 method for class 'ppp' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) Arguments X Point pattern (object of class "ppp"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. ... Arguments passed to affine.owin affecting the handling of the observation window, if it is a binary pixel mask. Details The point pattern, and its window, are subjected first to the linear transformation represented by mat (multiplying on the left by mat), and are then translated by the vector vec. The argument mat must be a nonsingular 2 × 2 matrix. This is a method for the generic function affine. Value Another point pattern (of class "ppp") representing the result of applying the affine transformation. Author(s) Adrian Baddeley and Rolf Turner See Also affine, affine.owin, affine.psp, affine.im, flipxy, rotate, shift Examples data(cells) # shear transformation X <- affine(cells, matrix(c(1,0,0.6,1),ncol=2)) ## Not run: plot(X) # rescale y coordinates by factor 1.3 plot(affine(cells, diag(c(1,1.3)))) ## End(Not run) affine.psp affine.psp 61 Apply Affine Transformation To Line Segment Pattern Description Applies any affine transformation of the plane (linear transformation plus vector shift) to a line segment pattern. Usage ## S3 method for class 'psp' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) Arguments X Line Segment pattern (object of class "psp"). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. ... Arguments passed to affine.owin affecting the handling of the observation window, if it is a binary pixel mask. Details The line segment pattern, and its window, are subjected first to the linear transformation represented by mat (multiplying on the left by mat), and are then translated by the vector vec. The argument mat must be a nonsingular 2 × 2 matrix. This is a method for the generic function affine. Value Another line segment pattern (of class "psp") representing the result of applying the affine transformation. Author(s) Adrian Baddeley and Rolf Turner See Also affine, affine.owin, affine.ppp, affine.im, flipxy, rotate, shift Examples oldpar <- par(mfrow=c(2,1)) X <- psp(runif(10), runif(10), runif(10), runif(10), window=owin()) plot(X, main="original") # shear transformation Y <- affine(X, matrix(c(1,0,0.6,1),ncol=2)) plot(Y, main="transformed") par(oldpar) 62 affine.tess # # rescale y coordinates by factor 0.2 affine(X, diag(c(1,0.2))) affine.tess Apply Geometrical Transformation To Tessellation Description Apply various geometrical transformations of the plane to each tile in a tessellation. Usage ## S3 method for class 'tess' reflect(X) ## S3 method for class 'tess' shift(X, ...) ## S3 method for class 'tess' rotate(X, angle=pi/2, ..., centre=NULL) ## S3 method for class 'tess' scalardilate(X, f, ...) ## S3 method for class 'tess' affine(X, mat=diag(c(1,1)), vec=c(0,0), ...) Arguments X Tessellation (object of class "tess"). angle Rotation angle in radians (positive values represent anticlockwise rotations). mat Matrix representing a linear transformation. vec Vector of length 2 representing a translation. f Positive number giving scale factor. ... Arguments passed to other methods. centre Centre of rotation. Either a vector of length 2, or a character string (partially matched to "centroid", "midpoint" or "bottomleft"). The default is the coordinate origin c(0,0). Details These are method for the generic functions reflect, shift, rotate, scalardilate, affine for tessellations (objects of class "tess"). The individual tiles of the tessellation, and the window containing the tessellation, are all subjected to the same geometrical transformation. The transformations are performed by the corresponding method for windows (class "owin") or images (class "im") depending on the type of tessellation. If the argument origin is used in shift.tess it is interpreted as applying to the window containing the tessellation. Then all tiles are shifted by the same vector. allstats 63 Value Another tessellation (of class "tess") representing the result of applying the geometrical transformation. Author(s) Adrian Baddeley and Rolf Turner See Also Generic functions reflect, shift, rotate, scalardilate, affine. Methods for windows: reflect.default, shift.owin, rotate.owin, scalardilate.owin, affine.owin. Methods for images: reflect.im, shift.im, rotate.im, scalardilate.im, affine.im. Examples live <- interactive() if(live) { H <- hextess(letterR, 0.2) plot(H) plot(reflect(H)) plot(rotate(H, pi/3)) } else H <- hextess(letterR, 0.6) # shear transformation shear <- matrix(c(1,0,0.6,1),2,2) sH <- affine(H, shear) if(live) plot(sH) allstats Calculate four standard summary functions of a point pattern. Description Calculates the F , G, J, and K summary functions for an unmarked point pattern. Returns them as a function array (of class "fasp", see fasp.object). Usage allstats(pp, ..., dataname=NULL, verb=FALSE) Arguments pp The observed point pattern, for which summary function estimates are required. An object of class "ppp". It must not be marked. ... Optional arguments passed to the summary functions Fest, Gest, Jest and Kest. dataname A character string giving an optional (alternative) name for the point pattern. verb A logical value meaning “verbose”. If TRUE, progress reports are printed during calculation. 64 alltypes Details This computes four standard summary statistics for a point pattern: the empty space function F (r), nearest neighbour distance distribution function G(r), van Lieshout-Baddeley function J(r) and Ripley’s function K(r). The real work is done by Fest, Gest, Jest and Kest respectively. Consult the help files for these functions for further information about the statistical interpretation of F , G, J and K. If verb is TRUE, then “progress reports” (just indications of completion) are printed out when the calculations are finished for each of the four function types. The overall title of the array of four functions (for plotting by plot.fasp) will be formed from the argument dataname. If this is not given, it defaults to the expression for pp given in the call to allstats. Value A list of length 4 containing the F , G, J and K functions respectively. The list can be plotted directly using plot (which dispatches to plot.solist). Each list entry retains the format of the output of the relevant estimating routine Fest, Gest, Jest or Kest. Thus each entry in the list is a function value table (object of class "fv", see fv.object). The default formulae for plotting these functions are cbind(km,theo) ~ r for F, G, and J, and cbind(trans,theo) ~ r for K. Author(s) Adrian Baddeley and Rolf Turner See Also plot.solist, plot.fv, fv.object, Fest, Gest, Jest, Kest Examples data(swedishpines) a <- allstats(swedishpines,dataname="Swedish Pines") ## Not run: plot(a) plot(a, subset=list("r<=15","r<=15","r<=15","r<=50")) ## End(Not run) alltypes Calculate Summary Statistic for All Types in a Multitype Point Pattern Description Given a marked point pattern, this computes the estimates of a selected summary function (F ,G, J, K etc) of the pattern, for all possible combinations of marks, and returns these functions in an array. alltypes 65 Usage alltypes(X, fun="K", ..., dataname=NULL,verb=FALSE,envelope=FALSE,reuse=TRUE) Arguments X The observed point pattern, for which summary function estimates are required. An object of class "ppp" or "lpp". fun The summary function. Either an R function, or a character string indicating the summary function required. Options for strings are "F", "G", "J", "K", "L", "pcf", "Gcross", "Jcross", "Kcross", "Lcross", "Gdot", "Jdot", "Kdot", "Ldot". ... Arguments passed to the summary function (and to the function envelope if appropriate) dataname Character string giving an optional (alternative) name to the point pattern, different from what is given in the call. This name, if supplied, may be used by plot.fasp() in forming the title of the plot. If not supplied it defaults to the parsing of the argument supplied as X in the call. verb Logical value. If verb is true then terse “progress reports” (just the values of the mark indices) are printed out when the calculations for that combination of marks are completed. envelope Logical value. If envelope is true, then simulation envelopes of the summary function will also be computed. See Details. reuse Logical value indicating whether the envelopes in each panel should be based on the same set of simulated patterns (reuse=TRUE) or on different, independent sets of simulated patterns (reuse=FALSE). Details This routine is a convenient way to analyse the dependence between types in a multitype point pattern. It computes the estimates of a selected summary function of the pattern, for all possible combinations of marks. It returns these functions in an array (an object of class "fasp") amenable to plotting by plot.fasp(). The argument fun specifies the summary function that will be evaluated for each type of point, or for each pair of types. It may be either an R function or a character string. Suppose that the points have possible types 1, 2, . . . , m and let Xi denote the pattern of points of type i only. If fun="F" then this routine calculates, for each possible type i, an estimate of the Empty Space Function Fi (r) of Xi . See Fest for explanation of the empty space function. The estimate is computed by applying Fest to Xi with the optional arguments .... If fun is "Gcross", "Jcross", "Kcross" or "Lcross", the routine calculates, for each pair of types (i, j), an estimate of the “i-toj” cross-type function Gij (r), Jij (r), Kij (r) or Lij (r) respectively describing the dependence between Xi and Xj . See Gcross, Jcross, Kcross or Lcross respectively for explanation of these functions. The estimate is computed by applying the relevant function (Gcross etc) to X using each possible value of the arguments i,j, together with the optional arguments .... If fun is "pcf" the routine calculates the cross-type pair correlation function pcfcross between each pair of types. 66 alltypes If fun is "Gdot", "Jdot", "Kdot" or "Ldot", the routine calculates, for each type i, an estimate of the “i-to-any” dot-type function Gi• (r), Ji• (r) or Ki• (r) or Li• (r) respectively describing the dependence between Xi and X. See Gdot, Jdot, Kdot or Ldot respectively for explanation of these functions. The estimate is computed by applying the relevant function (Gdot etc) to X using each possible value of the argument i, together with the optional arguments .... The letters "G", "J", "K" and "L" are interpreted as abbreviations for Gcross, Jcross, Kcross and Lcross respectively, assuming the point pattern is marked. If the point pattern is unmarked, the appropriate function Fest, Jest, Kest or Lest is invoked instead. If envelope=TRUE, then as well as computing the value of the summary function for each combination of types, the algorithm also computes simulation envelopes of the summary function for each combination of types. The arguments ... are passed to the function envelope to control the number of simulations, the random process generating the simulations, the construction of envelopes, and so on. Value A function array (an object of class "fasp", see fasp.object). This can be plotted using plot.fasp. If the pattern is not marked, the resulting “array” has dimensions 1 × 1. Otherwise the following is true: If fun="F", the function array has dimensions m × 1 where m is the number of different marks in the point pattern. The entry at position [i,1] in this array is the result of applying Fest to the points of type i only. If fun is "Gdot", "Jdot", "Kdot" or "Ldot", the function array again has dimensions m × 1. The entry at position [i,1] in this array is the result of Gdot(X, i), Jdot(X, i) Kdot(X, i) or Ldot(X, i) respectively. If fun is "Gcross", "Jcross", "Kcross" or "Lcross" (or their abbreviations "G", "J", "K" or "L"), the function array has dimensions m × m. The [i,j] entry of the function array (for i 6= j) is the result of applying the function Gcross, Jcross, Kcross orLcross to the pair of types (i,j). The diagonal [i,i] entry of the function array is the result of applying the univariate function Gest, Jest, Kest or Lest to the points of type i only. If envelope=FALSE, then each function entry fns[[i]] retains the format of the output of the relevant estimating routine Fest, Gest, Jest, Kest, Lest, Gcross, Jcross ,Kcross, Lcross, Gdot, Jdot, Kdot or Ldot The default formulae for plotting these functions are cbind(km,theo) ~ r for F, G, and J functions, and cbind(trans,theo) ~ r for K and L functions. If envelope=TRUE, then each function entry fns[[i]] has the same format as the output of the envelope command. Note Sizeable amounts of memory may be needed during the calculation. Author(s) Adrian Baddeley and Rolf Turner . See Also plot.fasp, fasp.object, Fest, Gest, Jest, Kest, Lest, Gcross, Jcross, Kcross, Lcross, Gdot, Jdot, Kdot, envelope. angles.psp 67 Examples # bramblecanes (3 marks). bram <- bramblecanes bF <- alltypes(bram,"F",verb=TRUE) plot(bF) if(interactive()) { plot(alltypes(bram,"G")) plot(alltypes(bram,"Gdot")) } # Swedishpines (unmarked). swed <- swedishpines plot(alltypes(swed,"K")) plot(alltypes(amacrine, "pcf"), ylim=c(0,1.3)) # A setting where you might REALLY want to use dataname: ## Not run: xxx <- alltypes(ppp(Melvin$x,Melvin$y, window=as.owin(c(5,20,15,50)),marks=clyde), fun="F",verb=TRUE,dataname="Melvin") ## End(Not run) # envelopes bKE <- alltypes(bram,"K",envelope=TRUE,nsim=19) ## Not run: bFE <- alltypes(bram,"F",envelope=TRUE,nsim=19,global=TRUE) ## End(Not run) # extract one entry as.fv(bKE[1,1]) angles.psp Orientation Angles of Line Segments Description Computes the orientation angle of each line segment in a line segment pattern. Usage angles.psp(x, directed=FALSE) Arguments x A line segment pattern (object of class "psp"). directed Logical flag. See details. 68 anova.lppm Details For each line segment, the angle of inclination to the x-axis (in radians) is computed, and the angles are returned as a numeric vector. If directed=TRUE, the directed angle of orientation is computed. The angle respects the sense of direction from (x0,y0) to (x1,y1). The values returned are angles in the full range from −π to π. The angle is computed as atan2(y1-y0,x1-x0). See atan2. If directed=FALSE, the undirected angle of orientation is computed. Angles differing by π are regarded as equivalent. The values returned are angles in the range from 0 to π. These angles are computed by first computing the directed angle, then adding π to any negative angles. Value Numeric vector. Author(s) Adrian Baddeley and Rolf Turner See Also summary.psp, midpoints.psp, lengths.psp Examples a <- psp(runif(10), runif(10), runif(10), runif(10), window=owin()) b <- angles.psp(a) anova.lppm ANOVA for Fitted Point Process Models on Linear Network Description Performs analysis of deviance for two or more fitted point process models on a linear network. Usage ## S3 method for class 'lppm' anova(object, ..., test=NULL) Arguments object A fitted point process model on a linear network (object of class "lppm"). ... One or more fitted point process models on the same linear network. test Character string, partially matching one of "Chisq", "F" or "Cp". anova.lppm 69 Details This is a method for anova for fitted point process models on a linear network (objects of class "lppm", usually generated by the model-fitting function lppm). If the fitted models are all Poisson point processes, then this function performs an Analysis of Deviance of the fitted models. The output shows the deviance differences (i.e. 2 times log likelihood ratio), the difference in degrees of freedom, and (if test="Chi") the two-sided p-values for the chisquared tests. Their interpretation is very similar to that in anova.glm. If some of the fitted models are not Poisson point processes, then the deviance difference is replaced by the adjusted composite likelihood ratio (Pace et al, 2011; Baddeley et al, 2014). Value An object of class "anova", or NULL. Errors and warnings models not nested: There may be an error message that the models are not “nested”. For an Analysis of Deviance the models must be nested, i.e. one model must be a special case of the other. For example the point process model with formula ~x is a special case of the model with formula ~x+y, so these models are nested. However the two point process models with formulae ~x and ~y are not nested. If you get this error message and you believe that the models should be nested, the problem may be the inability of R to recognise that the two formulae are nested. Try modifying the formulae to make their relationship more obvious. different sizes of dataset: There may be an error message from anova.glmlist that “models were not all fitted to the same size of dataset”. This generally occurs when the point process models are fitted on different linear networks. Author(s) Adrian Baddeley References Ang, Q.W. (2010) Statistical methodology for events on a network. Master’s thesis, School of Mathematics and Statistics, University of Western Australia. Ang, Q.W., Baddeley, A. and Nair, G. (2012) Geometrically corrected second-order analysis of events on a linear network, with applications to ecology and criminology. Scandinavian Journal of Statistics 39, 591–617. Baddeley, A., Turner, R. and Rubak, E. (2015) Adjusted composite likelihood ratio test for Gibbs point processes. Journal of Statistical Computation and Simulation 86 (5) 922–941. DOI: 10.1080/00949655.2015.10445 McSwiggan, G., Nair, M.G. and Baddeley, A. (2012) Fitting Poisson point process models to events on a linear network. Manuscript in preparation. Pace, L., Salvan, A. and Sartori, N. (2011) Adjusting composite likelihood ratio statistics. Statistica Sinica 21, 129–148. See Also lppm 70 anova.mppm Examples X <- runiflpp(10, simplenet) mod0 <- lppm(X ~1) modx <- lppm(X ~x) anova(mod0, modx, test="Chi") anova.mppm ANOVA for Fitted Point Process Models for Replicated Patterns Description Performs analysis of deviance for one or more point process models fitted to replicated point pattern data. Usage ## S3 method for class 'mppm' anova(object, ..., test=NULL, adjust=TRUE, fine=FALSE, warn=TRUE) Arguments object Object of class "mppm" representing a point process model that was fitted to replicated point patterns. ... Optional. Additional objects of class "mppm". test Type of hypothesis test to perform. A character string, partially matching one of "Chisq", "LRT", "Rao", "score", "F" or "Cp", or NULL indicating that no test should be performed. adjust Logical value indicating whether to correct the pseudolikelihood ratio when some of the models are not Poisson processes. fine Logical value passed to vcov.ppm indicating whether to use a quick estimate (fine=FALSE, the default) or a slower, more accurate estimate (fine=TRUE) of the variance of the fitted coefficients of each model. Relevant only when some of the models are not Poisson and adjust=TRUE. warn Logical value indicating whether to issue warnings if problems arise. Details This is a method for anova for comparing several fitted point process models of class "mppm", usually generated by the model-fitting function mppm). If the fitted models are all Poisson point processes, then this function performs an Analysis of Deviance of the fitted models. The output shows the deviance differences (i.e. 2 times log likelihood ratio), the difference in degrees of freedom, and (if test="Chi") the two-sided p-values for the chisquared tests. Their interpretation is very similar to that in anova.glm. If some of the fitted models are not Poisson point processes, the ‘deviance’ differences in this table are ’pseudo-deviances’ equal to 2 times the differences in the maximised values of the log pseudolikelihood (see ppm). It is not valid to compare these values to the chi-squared distribution. In this case, if adjust=TRUE (the default), the pseudo-deviances will be adjusted using the method anova.mppm 71 of Pace et al (2011) and Baddeley, Turner and Rubak (2015) so that the chi-squared test is valid. It is strongly advisable to perform this adjustment. The argument test determines which hypothesis test, if any, will be performed to compare the models. The argument test should be a character string, partially matching one of "Chisq", "F" or "Cp", or NULL. The first option "Chisq" gives the likelihood ratio test based on the asymptotic chi-squared distribution of the deviance difference. The meaning of the other options is explained in anova.glm. For random effects models, only "Chisq" is available, and again gives the likelihood ratio test. Value An object of class "anova", or NULL. Error messages An error message that reports system is computationally singular indicates that the determinant of the Fisher information matrix of one of the models was either too large or too small for reliable numerical calculation. See vcov.ppm for suggestions on how to handle this. Author(s) Adrian Baddeley, Ida-Maria Sintorn and Leanne Bischoff. Implemented by Adrian Baddeley and Ege Rubak . References Baddeley, A., Rubak, E. and Turner, R. (2015) Spatial Point Patterns: Methodology and Applications with R. London: Chapman and Hall/CRC Press. Baddeley, A., Turner, R. and Rubak, E. (2015) Adjusted composite likelihood ratio test for Gibbs point processes. Journal of Statistical Computation and Simulation 86 (5) 922–941. DOI: 10.1080/00949655.2015.10445 Pace, L., Salvan, A. and Sartori, N. (2011) Adjusting composite likelihood ratio statistics. Statistica Sinica 21, 129–148. See Also mppm Examples H <- hyperframe(X=waterstriders) mod0 <- mppm(X~1, data=H, Poisson()) modx <- mppm(X~x, data=H, Poisson()) anova(mod0, modx, test="Chi") mod0S <- mppm(X~1, data=H, Strauss(2)) modxS <- mppm(X~x, data=H, Strauss(2)) anova(mod0S, modxS, test="Chi") 72 anova.ppm anova.ppm ANOVA for Fitted Point Process Models Description Performs analysis of deviance for one or more fitted point process models. Usage ## S3 method for class 'ppm' anova(object, ..., test=NULL, adjust=TRUE, warn=TRUE, fine=FALSE) Arguments object A fitted point process model (object of class "ppm"). ... Optional. Additional objects of class "ppm". test Character string, partially matching one of "Chisq", "LRT", "Rao", "score", "F" or "Cp", or NULL indicating that no test should be performed. adjust Logical value indicating whether to correct the pseudolikelihood ratio when some of the models are not Poisson processes. warn Logical value indicating whether to issue warnings if problems arise. fine Logical value, passed to vcov.ppm, indicating whether to use a quick estimate (fine=FALSE, the default) or a slower, more accurate estimate (fine=TRUE) of variance terms. Relevant only when some of the models are not Poisson and adjust=TRUE. Details This is a method for anova for fitted point process models (objects of class "ppm", usually generated by the model-fitting function ppm). If the fitted models are all Poisson point processes, then by default, this function performs an Analysis of Deviance of the fitted models. The output shows the deviance differences (i.e. 2 times log likelihood ratio), the difference in degrees of freedom, and (if test="Chi" or test="LRT") the twosided p-values for the chi-squared tests. Their interpretation is very similar to that in anova.glm. If test="Rao" or test="score", the score test (Rao, 1948) is performed instead. If some of the fitted models are not Poisson point processes, the ‘deviance’ differences in this table are ’pseudo-deviances’ equal to 2 times the differences in the maximised values of the log pseudolikelihood (see ppm). It is not valid to compare these values to the chi-squared distribution. In this case, if adjust=TRUE (the default), the pseudo-deviances will be adjusted using the method of Pace et al (2011) and Baddeley et al (2015) so that the chi-squared test is valid. It is strongly advisable to perform this adjustment. Value An object of class "anova", or NULL. anova.ppm 73 Errors and warnings models not nested: There may be an error message that the models are not “nested”. For an Analysis of Deviance the models must be nested, i.e. one model must be a special case of the other. For example the point process model with formula ~x is a special case of the model with formula ~x+y, so these models are nested. However the two point process models with formulae ~x and ~y are not nested. If you get this error message and you believe that the models should be nested, the problem may be the inability of R to recognise that the two formulae are nested. Try modifying the formulae to make their relationship more obvious. different sizes of dataset: There may be an error message from anova.glmlist that “models were not all fitted to the same size of dataset”. This implies that the models were fitted using different quadrature schemes (see quadscheme) and/or with different edge corrections or different values of the border edge correction distance rbord. To ensure that models are comparable, check the following: • the models must all have been fitted to the same point pattern dataset, in the same window. • all models must have been fitted by the same fitting method as specified by the argument method in ppm. • If some of the models depend on covariates, then they should all have been fitted using the same list of covariates, and using allcovar=TRUE to ensure that the same quadrature scheme is used. • all models must have been fitted using the same edge correction as specified by the arguments correction and rbord. If you did not specify the value of rbord, then it may have taken a different value for different models. The default value of rbord is equal to zero for a Poisson model, and otherwise equals the reach (interaction distance) of the interaction term (see reach). To ensure that the models are comparable, set rbord to equal the maximum reach of the interactions that you are fitting. Error messages An error message that reports system is computationally singular indicates that the determinant of the Fisher information matrix of one of the models was either too large or too small for reliable numerical calculation. See vcov.ppm for suggestions on how to handle this. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . References Baddeley, A., Turner, R. and Rubak, E. (2015) Adjusted composite likelihood ratio test for Gibbs point processes. Journal of Statistical Computation and Simulation 86 (5) 922–941. DOI: 10.1080/00949655.2015.10445 Pace, L., Salvan, A. and Sartori, N. (2011) Adjusting composite likelihood ratio statistics. Statistica Sinica 21, 129–148. Rao, C.R. (1948) Large sample tests of statistical hypotheses concerning several parameters with applications to problems of estimation. Proceedings of the Cambridge Philosophical Society 44, 50–57. See Also ppm, vcov.ppm 74 anova.slrm Examples mod0 <- ppm(swedishpines ~1) modx <- ppm(swedishpines ~x) # Likelihood ratio test anova(mod0, modx, test="Chi") # Score test anova(mod0, modx, test="Rao") # Single argument modxy <- ppm(swedishpines ~x + y) anova(modxy, test="Chi") # Adjusted composite likelihood ratio test modP <- ppm(swedishpines ~1, rbord=9) modS <- ppm(swedishpines ~1, Strauss(9)) anova(modP, modS, test="Chi") anova.slrm Analysis of Deviance for Spatial Logistic Regression Models Description Performs Analysis of Deviance for two or more fitted Spatial Logistic Regression models. Usage ## S3 method for class 'slrm' anova(object, ..., test = NULL) Arguments object a fitted spatial logistic regression model. An object of class "slrm". ... additional objects of the same type (optional). test a character string, (partially) matching one of "Chisq", "F" or "Cp", indicating the reference distribution that should be used to compute p-values. Details This is a method for anova for fitted spatial logistic regression models (objects of class "slrm", usually obtained from the function slrm). The output shows the deviance differences (i.e. 2 times log likelihood ratio), the difference in degrees of freedom, and (if test="Chi") the two-sided p-values for the chi-squared tests. Their interpretation is very similar to that in anova.glm. Value An object of class "anova", inheriting from class "data.frame", representing the analysis of deviance table. anylist 75 Author(s) Adrian Baddeley and Rolf Turner See Also slrm Examples X <- rpoispp(42) fit0 <- slrm(X ~ 1) fit1 <- slrm(X ~ x+y) anova(fit0, fit1, test="Chi") anylist List of Objects Description Make a list of objects of any type. Usage anylist(...) as.anylist(x) Arguments ... Any number of arguments of any type. x A list. Details An object of class "anylist" is a list of objects that the user intends to treat in a similar fashion. For example it may be desired to plot each of the objects side-by-side: this can be done using the function plot.anylist. The objects can belong to any class; they may or may not all belong to the same class. In the spatstat package, various functions produce an object of class "anylist". Value A list, belonging to the class "anylist", containing the original objects. Author(s) Adrian Baddeley Rolf Turner and Ege Rubak 76 anyNA.im See Also solist, as.solist, anylapply. Examples anylist(cells, intensity(cells), Kest(cells)) anyNA.im Check Whether Image Contains NA Values Description Checks whether any pixel values in a pixel image are NA (meaning that the pixel lies outside the domain of definition of the image). Usage ## S3 method for class 'im' anyNA(x, recursive = FALSE) Arguments x A pixel image (object of class "im"). recursive Ignored. Details The function anyNA is generic: anyNA(x) is a faster alternative to any(is.na(x)). This function anyNA.im is a method for the generic anyNA defined for pixel images. It returns the value TRUE if any of the pixel values in x are NA, and and otherwise returns FALSE. Value A single logical value. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also im.object Examples anyNA(as.im(letterR)) append.psp 77 append.psp Combine Two Line Segment Patterns Description Combine two line segment patterns into a single pattern. Usage append.psp(A, B) Arguments A,B Line segment patterns (objects of class "psp"). Details This function is used to superimpose two line segment patterns A and B. The two patterns must have identical windows. If one pattern has marks, then the other must also have marks of the same type. It the marks are data frames then the number of columns of these data frames, and the names of the columns must be identical. (To combine two point patterns, see superimpose). Value Another line segment pattern (object of class "psp"). Author(s) Adrian Baddeley and Rolf Turner See Also psp, as.psp, superimpose, Examples X <- psp(runif(20), runif(20), runif(20), runif(20), window=owin()) Y <- psp(runif(5), runif(5), runif(5), runif(5), window=owin()) append.psp(X,Y) 78 applynbd applynbd Apply Function to Every Neighbourhood in a Point Pattern Description Visit each point in a point pattern, find the neighbouring points, and apply a given function to them. Usage applynbd(X, FUN, N=NULL, R=NULL, criterion=NULL, exclude=FALSE, ...) Arguments X Point pattern. An object of class "ppp", or data which can be converted into this format by as.ppp. FUN Function to be applied to each neighbourhood. The arguments of FUN are described under Details. N Integer. If this argument is present, the neighbourhood of a point of X is defined to consist of the N points of X which are closest to it. R Nonnegative numeric value. If this argument is present, the neighbourhood of a point of X is defined to consist of all points of X which lie within a distance R of it. criterion Function. If this argument is present, the neighbourhood of a point of X is determined by evaluating this function. See under Details. exclude Logical. If TRUE then the point currently being visited is excluded from its own neighbourhood. ... extra arguments passed to the function FUN. They must be given in the form name=value. Details This is an analogue of apply for point patterns. It visits each point in the point pattern X, determines which points of X are “neighbours” of the current point, applies the function FUN to this neighbourhood, and collects the values returned by FUN. The definition of “neighbours” depends on the arguments N, R and criterion. Also the argument exclude determines whether the current point is excluded from its own neighbourhood. • If N is given, then the neighbours of the current point are the N points of X which are closest to the current point (including the current point itself unless exclude=TRUE). • If R is given, then the neighbourhood of the current point consists of all points of X which lie closer than a distance R from the current point. • If criterion is given, then it must be a function with two arguments dist and drank which will be vectors of equal length. The interpretation is that dist[i] will be the distance of a point from the current point, and drank[i] will be the rank of that distance (the three points closest to the current point will have rank 1, 2 and 3). This function must return a logical vector of the same length as dist and drank whose i-th entry is TRUE if the corresponding point should be included in the neighbourhood. See the examples below. applynbd 79 • If more than one of the arguments N, R and criterion is given, the neighbourhood is defined as the intersection of the neighbourhoods specified by these arguments. For example if N=3 and R=5 then the neighbourhood is formed by finding the 3 nearest neighbours of current point, and retaining only those neighbours which lie closer than 5 units from the current point. When applynbd is executed, each point of X is visited, and the following happens for each point: • the neighbourhood of the current point is determined according to the chosen rule, and stored as a point pattern Y; • the function FUN is called as: FUN(Y=Y, current=current, dists=dists, dranks=dranks, ...) where current is the location of the current point (in a format explained below), dists is a vector of distances from the current point to each of the points in Y, dranks is a vector of the ranks of these distances with respect to the full point pattern X, and ... are the arguments passed from the call to applynbd; • The result of the call to FUN is stored. The results of each call to FUN are collected and returned according to the usual rules for apply and its relatives. See the Value section of this help file. The format of the argument current is as follows. If X is an unmarked point pattern, then current is a vector of length 2 containing the coordinates of the current point. If X is marked, then current is a point pattern containing exactly one point, so that current$x is its x-coordinate and current$marks is its mark value. In either case, the coordinates of the current point can be referred to as current$x and current$y. Note that FUN will be called exactly as described above, with each argument named explicitly. Care is required when writing the function FUN to ensure that the arguments will match up. See the Examples. See markstat for a common use of this function. To simply tabulate the marks in every R-neighbourhood, use marktable. Value Similar to the result of apply. If each call to FUN returns a single numeric value, the result is a vector of dimension npoints(X), the number of points in X. If each call to FUN returns a vector of the same length m, then the result is a matrix of dimensions c(m,n); note the transposition of the indices, as usual for the family of apply functions. If the calls to FUN return vectors of different lengths, the result is a list of length npoints(X). Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also ppp.object, apply, markstat, marktable Examples redwood # count the number of points within radius 0.2 of each point of X nneighbours <- applynbd(redwood, R=0.2, function(Y, ...){npoints(Y)-1}) 80 area.owin # equivalent to: nneighbours <- applynbd(redwood, R=0.2, function(Y, ...){npoints(Y)}, exclude=TRUE) # compute the distance to the second nearest neighbour of each point secondnndist <- applynbd(redwood, N = 2, function(dists, ...){max(dists)}, exclude=TRUE) # marked point pattern trees <- longleaf # compute the median of the marks of all neighbours of a point # (see also 'markstat') dbh.med <- applynbd(trees, R=90, exclude=TRUE, function(Y, ...) { median(marks(Y))}) # ANIMATION explaining the definition of the K function # (arguments `fullpicture' and 'rad' are passed to FUN) if(interactive()) { showoffK <- function(Y, current, dists, dranks, fullpicture,rad) { plot(fullpicture, main="") points(Y, cex=2) ux <- current[["x"]] uy <- current[["y"]] points(ux, uy, pch="+",cex=3) theta <- seq(0,2*pi,length=100) polygon(ux + rad * cos(theta), uy+rad*sin(theta)) text(ux + rad/3, uy + rad/2,npoints(Y),cex=3) if(interactive()) Sys.sleep(if(runif(1) < 0.1) 1.5 else 0.3) return(npoints(Y)) } applynbd(redwood, R=0.2, showoffK, fullpicture=redwood, rad=0.2, exclude=TRUE) # animation explaining the definition of the G function showoffG <- function(Y, current, dists, dranks, fullpicture) { plot(fullpicture, main="") points(Y, cex=2) u <- current points(u[1],u[2],pch="+",cex=3) v <- c(Y$x[1],Y$y[1]) segments(u[1],u[2],v[1],v[2],lwd=2) w <- (u + v)/2 nnd <- dists[1] text(w[1],w[2],round(nnd,3),cex=2) if(interactive()) Sys.sleep(if(runif(1) < 0.1) 1.5 else 0.3) return(nnd) } applynbd(cells, N=1, showoffG, exclude=TRUE, fullpicture=cells) } area.owin Area of a Window area.owin 81 Description Computes the area of a window Usage area(w) ## S3 method for class 'owin' area(w) ## Default S3 method: area(w) ## S3 method for class 'owin' volume(x) Arguments w A window, whose area will be computed. This should be an object of class owin, or can be given in any format acceptable to as.owin(). x Object of class owin Details If the window w is of type "rectangle" or "polygonal", the area of this rectangular window is computed by analytic geometry. If w is of type "mask" the area of the discrete raster approximation of the window is computed by summing the binary image values and adjusting for pixel size. The function volume.owin is identical to area.owin except for the argument name. It is a method for the generic function volume. Value A numerical value giving the area of the window. Author(s) Adrian Baddeley and Rolf Turner See Also perimeter, diameter.owin, owin.object, as.owin Examples w <- unit.square() area(w) # returns 1.00000 k <- 6 theta <- 2 * pi * (0:(k-1))/k co <- cos(theta) si <- sin(theta) 82 areaGain mas <- owin(c(-1,1), c(-1,1), poly=list(x=co, y=si)) area(mas) # returns approx area of k-gon mas <- as.mask(square(2), eps=0.01) X <- raster.x(mas) Y <- raster.y(mas) mas$m <- ((X - 1)^2 + (Y - 1)^2 <= 1) area(mas) # returns 3.14 approx areaGain Difference of Disc Areas Description Computes the area of that part of a disc that is not covered by other discs. Usage areaGain(u, X, r, ..., W=as.owin(X), exact=FALSE, ngrid=spatstat.options("ngrid.disc")) Arguments u Coordinates of the centre of the disc of interest. A vector of length 2. Alternatively, a point pattern (object of class "ppp"). X Locations of the centres of other discs. A point pattern (object of class "ppp"). r Disc radius, or vector of disc radii. ... Arguments passed to distmap to determine the pixel resolution, when exact=FALSE. W Window (object of class "owin") in which the area should be computed. exact Choice of algorithm. If exact=TRUE, areas are computed exactly using analytic geometry. If exact=FALSE then a faster algorithm is used to compute a discrete approximation to the areas. ngrid Integer. Number of points in the square grid used to compute the discrete approximation, when exact=FALSE. Details This function computes the area of that part of the disc of radius r centred at the location u that is not covered by any of the discs of radius r centred at the points of the pattern X. This area is important in some calculations related to the area-interaction model AreaInter. If u is a point pattern and r is a vector, the result is a matrix, with one row for each point in u and one column for each entry of r. The [i,j] entry in the matrix is the area of that part of the disc of radius r[j] centred at the location u[i] that is not covered by any of the discs of radius r[j] centred at the points of the pattern X. If W is not NULL, then the areas are computed only inside the window W. AreaInter 83 Value A matrix with one row for each point in u and one column for each value in r. Author(s) Adrian Baddeley and Rolf Turner See Also AreaInter, areaLoss Examples data(cells) u <- c(0.5,0.5) areaGain(u, cells, 0.1) AreaInter The Area Interaction Point Process Model Description Creates an instance of the Area Interaction point process model (Widom-Rowlinson penetrable spheres model) which can then be fitted to point pattern data. Usage AreaInter(r) Arguments r The radius of the discs in the area interaction process Details This function defines the interpoint interaction structure of a point process called the WidomRowlinson penetrable sphere model or area-interaction process. It can be used to fit this model to point pattern data. The function ppm(), which fits point process models to point pattern data, requires an argument of class "interact" describing the interpoint interaction structure of the model to be fitted. The appropriate description of the area interaction structure is yielded by the function AreaInter(). See the examples below. In standard form, the area-interaction process (Widom and Rowlinson, 1970; Baddeley and Van Lieshout, 1995) with disc radius r, intensity parameter κ and interaction parameter γ is a point process with probability density f (x1 , . . . , xn ) = ακn(x) γ −A(x) for a point pattern x, where x1 , . . . , xn represent the points of the pattern, n(x) is the number of points in the pattern, and A(x) is the area of the region formed by the union of discs of radius r centred at the points x1 , . . . , xn . Here α is a normalising constant. 84 AreaInter The interaction parameter γ can be any positive number. If γ = 1 then the model reduces to a Poisson process with intensity κ. If γ < 1 then the process is regular, while if γ > 1 the process is clustered. Thus, an area interaction process can be used to model either clustered or regular point patterns. Two points interact if the distance between them is less than 2r. The standard form of the model, shown above, is a little complicated to interpret in practical ap2 plications. For example, each isolated point of the pattern x contributes a factor κγ −πr to the probability density. In spatstat, the model is parametrised in a different form, which is easier to interpret. In canonical scale-free form, the probability density is rewritten as f (x1 , . . . , xn ) = αβ n(x) η −C(x) where β is the new intensity parameter, η is the new interaction parameter, and C(x) = B(x)−n(x) is the interaction potential. Here A(x) B(x) = πr2 is the normalised area (so that the discs have unit area). In this formulation, each isolated point of the pattern contributes a factor β to the probability density (so the first order trend is β). The quantity C(x) is a true interaction potential, in the sense that C(x) = 0 if the point pattern x does not contain any points that lie close together (closer than 2r units apart). When a new point u is added to an existing point pattern x, the rescaled potential −C(x) increases by a value between 0 and 1. The increase is zero if u is not close to any point of x. The increase is 1 if the disc of radius r centred at u is completely contained in the union of discs of radius r centred at the data points xi . Thus, the increase in potential is a measure of how close the new point u is to the existing pattern x. Addition of the point u contributes a factor βη δ to the probability density, where δ is the increase in potential. The old parameters κ, γ of the standard form are related to the new parameters β, η of the canonical scale-free form, by 2 β = κγ −πr = κ/η and η = γ πr 2 provided γ and κ are positive and finite. In the canonical scale-free form, the parameter η can take any nonnegative value. The value η = 1 again corresponds to a Poisson process, with intensity β. If η < 1 then the process is regular, while if η > 1 the process is clustered. The value η = 0 corresponds to a hard core process with hard core radius r (interaction distance 2r). The nonstationary area interaction process is similar except that the contribution of each individual point xi is a function β(xi ) of location, rather than a constant beta. Note the only argument of AreaInter() is the disc radius r. When r is fixed, the model becomes an exponential family. The canonical parameters log(β) and log(η) are estimated by ppm(), not fixed in AreaInter(). Value An object of class "interact" describing the interpoint interaction structure of the area-interaction process with disc radius r. AreaInter 85 Warnings The interaction distance of this process is equal to 2 * r. Two discs of radius r overlap if their centres are closer than 2 * r units apart. The estimate of the interaction parameter η is unreliable if the interaction radius r is too small or too large. In these situations the model is approximately Poisson so that η is unidentifiable. As a rule of thumb, one can inspect the empty space function of the data, computed by Fest. The value F (r) of the empty space function at the interaction radius r should be between 0.2 and 0.8. Author(s) Adrian Baddeley and Rolf Turner References Baddeley, A.J. and Van Lieshout, M.N.M. (1995). Area-interaction point processes. Annals of the Institute of Statistical Mathematics 47 (1995) 601–619. Widom, B. and Rowlinson, J.S. (1970). New model for the study of liquid-vapor phase transitions. The Journal of Chemical Physics 52 (1970) 1670–1684. See Also ppm, pairwise.family, ppm.object ragsAreaInter and rmh for simulation of area-interaction models. Examples # prints a sensible description of itself AreaInter(r=0.1) # Note the reach is twice the radius reach(AreaInter(r=1)) # Fit the stationary area interaction process to Swedish Pines data data(swedishpines) ppm(swedishpines, ~1, AreaInter(r=7)) # Fit the stationary area interaction process to `cells' data(cells) ppm(cells, ~1, AreaInter(r=0.06)) # eta=0 indicates hard core process. # Fit a nonstationary area interaction with log-cubic polynomial trend ## Not run: ppm(swedishpines, ~polynom(x/10,y/10,3), AreaInter(r=7)) ## End(Not run) 86 areaLoss areaLoss Difference of Disc Areas Description Computes the area of that part of a disc that is not covered by other discs. Usage areaLoss(X, r, ..., W=as.owin(X), subset=NULL, exact=FALSE, ngrid=spatstat.options("ngrid.disc")) Arguments X Locations of the centres of discs. A point pattern (object of class "ppp"). r Disc radius, or vector of disc radii. ... Ignored. W Optional. Window (object of class "owin") inside which the area should be calculated. subset Optional. Index identifying a subset of the points of X for which the area difference should be computed. exact Choice of algorithm. If exact=TRUE, areas are computed exactly using analytic geometry. If exact=FALSE then a faster algorithm is used to compute a discrete approximation to the areas. ngrid Integer. Number of points in the square grid used to compute the discrete approximation, when exact=FALSE. Details This function computes, for each point X[i] in X and for each radius r, the area of that part of the disc of radius r centred at the location X[i] that is not covered by any of the other discs of radius r centred at the points X[j] for j not equal to i. This area is important in some calculations related to the area-interaction model AreaInter. The result is a matrix, with one row for each point in X and one column for each entry of r. Value A matrix with one row for each point in X (or X[subset]) and one column for each value in r. Author(s) Adrian Baddeley and Rolf Turner See Also AreaInter, areaGain, dilated.areas as.box3 87 Examples data(cells) areaLoss(cells, 0.1) as.box3 Convert Data to Three-Dimensional Box Description Interprets data as the dimensions of a three-dimensional box. Usage as.box3(...) Arguments ... Data that can be interpreted as giving the dimensions of a three-dimensional box. See Details. Details This function converts data in various formats to an object of class "box3" representing a threedimensional box (see box3). The arguments ... may be • an object of class "box3" • arguments acceptable to box3 • a numeric vector of length 6, interpreted as c(xrange[1],xrange[2],yrange[1],yrange[2],zrange[1],zrange • an object of class "pp3" representing a three-dimensional point pattern contained in a box. Value Object of class "box3". Author(s) Adrian Baddeley and Rolf Turner See Also box3, pp3 Examples X <- c(0,10,0,10,0,5) as.box3(X) X <- pp3(runif(42),runif(42),runif(42), box3(c(0,1))) as.box3(X) 88 as.boxx as.boxx Convert Data to Multi-Dimensional Box Description Interprets data as the dimensions of a multi-dimensional box. Usage as.boxx(..., warn.owin = TRUE) Arguments ... Data that can be interpreted as giving the dimensions of a multi-dimensional box. See Details. warn.owin Logical value indicating whether to print a warning if a non-rectangular window (object of class "owin") is supplied. Details Either a single argument should be provided which is one of the following: • an object of class "boxx" • an object of class "box3" • an object of class "owin" • a numeric vector of even length, specifying the corners of the box. See Examples or a list of arguments acceptable to boxx. Value A "boxx" object. Author(s) Adrian Baddeley Rolf Turner and Ege Rubak Examples # Convert unit square to two dimensional box. W <- owin() as.boxx(W) # Make three dimensional box [0,1]x[0,1]x[0,1] from numeric vector as.boxx(c(0,1,0,1,0,1)) as.data.frame.envelope 89 as.data.frame.envelope Coerce Envelope to Data Frame Description Converts an envelope object to a data frame. Usage ## S3 method for class 'envelope' as.data.frame(x, ..., simfuns=FALSE) Arguments x Envelope object (class "envelope"). ... Ignored. simfuns Logical value indicating whether the result should include the values of the simulated functions that were used to build the envelope. Details This is a method for the generic function as.data.frame for the class of envelopes (see envelope. The result is a data frame with columns containing the values of the function argument (usually named r), the function estimate for the original point pattern data (obs), the upper and lower envelope limits (hi and lo), and possibly additional columns. If simfuns=TRUE, the result also includes columns of values of the simulated functions that were used to compute the envelope. This is possible only when the envelope was computed with the argument savefuns=TRUE in the call to envelope. Value A data frame. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . Examples E <- envelope(cells, nsim=5, savefuns=TRUE) tail(as.data.frame(E)) tail(as.data.frame(E, simfuns=TRUE)) 90 as.data.frame.hyperframe as.data.frame.hyperframe Coerce Hyperframe to Data Frame Description Converts a hyperframe to a data frame. Usage ## S3 method for class 'hyperframe' as.data.frame(x, row.names = NULL, optional = FALSE, ..., discard=TRUE, warn=TRUE) Arguments x Hyperframe (object of class "hyperframe"). row.names Optional character vector of row names. optional Argument passed to as.data.frame controlling what happens to row names. ... Ignored. discard Logical. Whether to discard columns of the hyperframe that do not contain atomic data. See Details. warn Logical. Whether to issue a warning when columns are discarded. Details This is a method for the generic function as.data.frame for the class of hyperframes (see hyperframe. If discard=TRUE, any columns of the hyperframe that do not contain atomic data will be removed (and a warning will be issued if warn=TRUE). If discard=FALSE, then such columns are converted to strings indicating what class of data they originally contained. Value A data frame. Author(s) Adrian Baddeley and Rolf Turner Examples h <- hyperframe(X=1:3, Y=letters[1:3], f=list(sin, cos, tan)) as.data.frame(h, discard=TRUE, warn=FALSE) as.data.frame(h, discard=FALSE) as.data.frame.im as.data.frame.im 91 Convert Pixel Image to Data Frame Description Convert a pixel image to a data frame Usage ## S3 method for class 'im' as.data.frame(x, ...) Arguments x A pixel image (object of class "im"). ... Further arguments passed to as.data.frame.default to determine the row names and other features. Details This function takes the pixel image x and returns a data frame with three columns containing the pixel coordinates and the pixel values. The data frame entries are automatically sorted in increasing order of the x coordinate (and in increasing order of y within x). Value A data frame. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . Examples # artificial image Z <- setcov(square(1)) Y <- as.data.frame(Z) head(Y) 92 as.data.frame.owin as.data.frame.owin Convert Window to Data Frame Description Converts a window object to a data frame. Usage ## S3 method for class 'owin' as.data.frame(x, ..., drop=TRUE) Arguments x Window (object of class "owin"). ... Further arguments passed to as.data.frame.default to determine the row names and other features. drop Logical value indicating whether to discard pixels that are outside the window, when x is a binary mask. Details This function returns a data frame specifying the coordinates of the window. If x is a binary mask window, the result is a data frame with columns x and y containing the spatial coordinates of each pixel. If drop=TRUE (the default), only pixels inside the window are retained. If drop=FALSE, all pixels are retained, and the data frame has an extra column inside containing the logical value of each pixel (TRUE for pixels inside the window, FALSE for outside). If x is a rectangle or a polygonal window, the result is a data frame with columns x and y containing the spatial coordinates of the vertices of the window. If the boundary consists of several polygons, the data frame has additional columns id, identifying which polygon is being traced, and sign, indicating whether the polygon is an outer or inner boundary (sign=1 and sign=-1 respectively). Value A data frame with columns named x and y, and possibly other columns. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also as.data.frame.im as.data.frame.ppp 93 Examples as.data.frame(square(1)) holey <- owin(poly=list( list(x=c(0,10,0), y=c(0,0,10)), list(x=c(2,2,4,4), y=c(2,4,4,2)))) as.data.frame(holey) as.data.frame.ppp Coerce Point Pattern to a Data Frame Description Extracts the coordinates of the points in a point pattern, and their marks if any, and returns them in a data frame. Usage ## S3 method for class 'ppp' as.data.frame(x, row.names = NULL, ...) Arguments x Point pattern (object of class "ppp"). row.names Optional character vector of row names. ... Ignored. Details This is a method for the generic function as.data.frame for the class "ppp" of point patterns. It extracts the coordinates of the points in the point pattern, and returns them as columns named x and y in a data frame. If the points were marked, the marks are returned as a column named marks with the same type as in the point pattern dataset. Value A data frame. Author(s) Adrian Baddeley and Rolf Turner Examples data(amacrine) df <- as.data.frame(amacrine) df[1:5,] 94 as.data.frame.psp as.data.frame.psp Coerce Line Segment Pattern to a Data Frame Description Extracts the coordinates of the endpoints in a line segment pattern, and their marks if any, and returns them in a data frame. Usage ## S3 method for class 'psp' as.data.frame(x, row.names = NULL, ...) Arguments x Line segment pattern (object of class "psp"). row.names Optional character vector of row names. ... Ignored. Details This is a method for the generic function as.data.frame for the class "psp" of line segment patterns. It extracts the coordinates of the endpoints of the line segments, and returns them as columns named x0, y0, x1 and y1 in a data frame. If the line segments were marked, the marks are appended as an extra column or columns to the data frame which is returned. If the marks are a vector then a single column named marks is appended. in the data frame, with the same type as in the line segment pattern dataset. If the marks are a data frame, then the columns of this data frame are appended (retaining their names). Value A data frame with 4 or 5 columns. Author(s) Adrian Baddeley and Rolf Turner Examples data(copper) df <- as.data.frame(copper$Lines) as.data.frame.tess 95 as.data.frame.tess Convert Tessellation to Data Frame Description Converts a spatial tessellation object to a data frame. Usage ## S3 method for class 'tess' as.data.frame(x, ...) Arguments x Tessellation (object of class "tess"). ... Further arguments passed to as.data.frame.owin or as.data.frame.im and ultimately to as.data.frame.default to determine the row names and other features. Details This function converts the tessellation x to a data frame. If x is a pixel image tessellation (a pixel image with factor values specifying the tile membership of each pixel) then this pixel image is converted to a data frame by as.data.frame.im. The result is a data frame with columns x and y giving the pixel coordinates, and Tile identifying the tile containing the pixel. If x is a tessellation consisting of a rectangular grid of tiles or a list of polygonal tiles, then each tile is converted to a data frame by as.data.frame.owin, and these data frames are joined together, yielding a single large data frame containing columns x, y giving the coordinates of vertices of the polygons, and Tile identifying the tile. Value A data frame with columns named x, y, Tile, and possibly other columns. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also as.data.frame.owin, as.data.frame.im Examples Z <- as.data.frame(dirichlet(cells)) head(Z, 10) 96 as.function.fv as.function.fv Convert Function Value Table to Function Description Converts an object of class "fv" to an R language function. Usage ## S3 method for class 'fv' as.function(x, ..., value=".y", extrapolate=FALSE) ## S3 method for class 'rhohat' as.function(x, ..., value=".y", extrapolate=TRUE) Arguments x Object of class "fv" or "rhohat". ... Ignored. value Optional. Character string or character vector selecting one or more of the columns of x for use as the function value. See Details. extrapolate Logical, indicating whether to extrapolate the function outside the domain of x. See Details. Details A function value table (object of class "fv") is a convenient way of storing and plotting several different estimates of the same function. Objects of this class are returned by many commands in spatstat, such as Kest which returns an estimate of Ripley’s K-function for a point pattern dataset. Sometimes it is useful to convert the function value table to a function in the R language. This is done by as.function.fv. It converts an object x of class "fv" to an R function f. If f <- as.function(x) then f is an R function that accepts a numeric argument and returns a corresponding value for the summary function by linear interpolation between the values in the table x. Argument values lying outside the range of the table yield an NA value (if extrapolate=FALSE) or the function value at the nearest endpoint of the range (if extrapolate = TRUE). To apply different rules to the left and right extremes, use extrapolate=c(TRUE,FALSE) and so on. Typically the table x contains several columns of function values corresponding to different edge corrections. Auxiliary information for the table identifies one of these columns as the recommended value. By default, the values of the function f <- as.function(x) are taken from this column of recommended values. This default can be changed using the argument value, which can be a character string or character vector of names of columns of x. Alternatively value can be one of the abbreviations used by fvnames. If value specifies a single column of the table, then the result is a function f(r) with a single numeric argument r (with the same name as the orginal argument of the function table). If value specifies several columns of the table, then the result is a function f(r,what) where r is the numeric argument and what is a character string identifying the column of values to be used. as.function.im 97 The formal arguments of the resulting function are f(r, what=value), which means that in a call to this function f, the permissible values of what are the entries of the original vector value; the default value of what is the first entry of value. The command as.function.fv is a method for the generic command as.function. Value A function(r) or function(r,what) where r is the name of the original argument of the function table. Author(s) Adrian Baddeley and Rolf Turner See Also fv, fv.object, fvnames, plot.fv, Kest Examples K <- Kest(cells) f <- as.function(K) f f(0.1) g <- as.function(K, value=c("iso", "trans")) g g(0.1, "trans") as.function.im Convert Pixel Image to Function of Coordinates Description Converts a pixel image to a function of the x and y coordinates. Usage ## S3 method for class 'im' as.function(x, ...) Arguments x Pixel image (object of class "im"). ... Ignored. Details This command converts a pixel image (object of class "im") to a function(x,y) where the arguments x and y are (vectors of) spatial coordinates. This function returns the pixel values at the specified locations. 98 as.function.leverage.ppm Value A function in the R language, also belonging to the class "funxy". Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also [.im Examples d <- density(cells) f <- as.function(d) f(0.1, 0.3) as.function.leverage.ppm Convert Leverage Object to Function of Coordinates Description Converts an object of class "leverage.ppm" to a function of the x and y coordinates. Usage ## S3 method for class 'leverage.ppm' as.function(x, ...) Arguments x Object of class "leverage.ppm" produced by leverage.ppm. ... Ignored. Details An object of class "leverage.ppm" represents the leverage function of a fitted point process model. This command converts the object to a function(x,y) where the arguments x and y are (vectors of) spatial coordinates. This function returns the leverage values at the specified locations (calculated by referring to the nearest location where the leverage has been computed). Value A function in the R language, also belonging to the class "funxy". Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . as.function.owin 99 See Also as.im.leverage.ppm Examples X <- rpoispp(function(x,y) { exp(3+3*x) }) fit <- ppm(X ~x+y) lev <- leverage(fit) f <- as.function(lev) f(0.2, 0.3) y <- f(X) # evaluate at (x,y) coordinates # evaluate at a point pattern as.function.owin Convert Window to Indicator Function Description Converts a spatial window to a function of the x and y coordinates returning the value 1 inside the window and 0 outside. Usage ## S3 method for class 'owin' as.function(x, ...) Arguments x Pixel image (object of class "owin"). ... Ignored. Details This command converts a spatial window (object of class "owin") to a function(x,y) where the arguments x and y are (vectors of) spatial coordinates. This is the indicator function of the window: it returns the value 1 for locations inside the window, and returns 0 for values outside the window. Value A function in the R language. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also as.im.owin 100 as.function.tess Examples W <- Window(humberside) f <- as.function(W) f(5000, 4500) f(123456, 78910) X <- runifpoint(5, Frame(humberside)) f(X) as.function.tess Convert a Tessellation to a Function Description Convert a tessellation into a function of the x and y coordinates. The default function values are factor levels specifying which tile of the tessellation contains the point (x, y). Usage ## S3 method for class 'tess' as.function(x,...,values=NULL) Arguments x A tessellation (object of class "tess"). values Optional. A vector giving the values of the function for each tile of x. ... Ignored. Details This command converts a tessellation (object of class "tess") to a function(x,y) where the arguments x and y are (vectors of) spatial coordinates. The corresponding function values are factor levels identifying which tile of the tessellation contains each point. Values are NA if the corresponding point lies outside the tessellation. If the argument values is given, then it determines the value of the function in each tile of x. Value A function in the R language, also belonging to the class "funxy". Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also tileindex for the low-level calculation of tile index. cut.ppp and split.ppp to divide up the points of a point pattern according to a tessellation. as.fv 101 Examples X <- runifpoint(7) V <- dirichlet(X) f <- as.function(V) f(0.1, 0.4) plot(f) as.fv Convert Data To Class fv Description Converts data into a function table (an object of class "fv"). Usage as.fv(x) ## S3 method for class 'fv' as.fv(x) ## S3 method for class 'data.frame' as.fv(x) ## S3 method for class 'matrix' as.fv(x) ## S3 method for class 'fasp' as.fv(x) ## S3 method for class 'minconfit' as.fv(x) ## S3 method for class 'dppm' as.fv(x) ## S3 method for class 'kppm' as.fv(x) ## S3 method for class 'bw.optim' as.fv(x) Arguments x Data which will be converted into a function table Details This command converts data x, that could be interpreted as the values of a function, into a function value table (object of the class "fv" as described in fv.object). This object can then be plotted easily using plot.fv. The dataset x may be any of the following: 102 as.hyperframe • an object of class "fv"; • a matrix or data frame with at least two columns; • an object of class "fasp", representing an array of "fv" objects. • an object of class "minconfit", giving the results of a minimum contrast fit by the command mincontrast. The • an object of class "kppm", representing a fitted Cox or cluster point process model, obtained from the model-fitting command kppm; • an object of class "dppm", representing a fitted determinantal point process model, obtained from the model-fitting command dppm; • an object of class "bw.optim", representing an optimal choice of smoothing bandwidth by a cross-validation method, obtained from commands like bw.diggle. The function as.fv is generic, with methods for each of the classes listed above. The behaviour is as follows: • If x is an object of class "fv", it is returned unchanged. • If x is a matrix or data frame, the first column is interpreted as the function argument, and subsequent columns are interpreted as values of the function computed by different methods. • If x is an object of class "fasp" representing an array of "fv" objects, these are combined into a single "fv" object. • If x is an object of class "minconfit", or an object of class "kppm" or "dppm", the result is a function table containing the observed summary function and the best fit summary function. • If x is an object of class "bw.optim", the result is a function table of the optimisation criterion as a function of the smoothing bandwidth. Value An object of class "fv" (see fv.object). Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak Examples r <- seq(0, 1, length=101) x <- data.frame(r=r, y=r^2) as.fv(x) as.hyperframe Convert Data to Hyperframe Description Converts data from any suitable format into a hyperframe. as.hyperframe 103 Usage as.hyperframe(x, ...) ## Default S3 method: as.hyperframe(x, ...) ## S3 method for class 'data.frame' as.hyperframe(x, ..., stringsAsFactors=FALSE) ## S3 method for class 'hyperframe' as.hyperframe(x, ...) ## S3 method for class 'listof' as.hyperframe(x, ...) ## S3 method for class 'anylist' as.hyperframe(x, ...) Arguments x Data in some other format. ... Optional arguments passed to hyperframe. stringsAsFactors Logical. If TRUE, any column of the data frame x that contains character strings will be converted to a factor. If FALSE, no such conversion will occur. Details A hyperframe is like a data frame, except that its entries can be objects of any kind. The generic function as.hyperframe converts any suitable kind of data into a hyperframe. There are methods for the classes data.frame, listof, anylist and a default method, all of which convert data that is like a hyperframe into a hyperframe object. (The method for the class listof and anylist converts a list of objects, of arbitrary type, into a hyperframe with one column.) These methods do not discard any information. There are also methods for other classes (see as.hyperframe.ppx) which extract the coordinates from a spatial dataset. These methods do discard some information. Value An object of class "hyperframe" created by hyperframe. Conversion of Strings to Factors Note that as.hyperframe.default will convert a character vector to a factor. It behaves like as.data.frame. However as.hyperframe.data.frame does not convert strings to factors; it respects the structure of the data frame x. The behaviour can be changed using the argument stringsAsFactors. 104 as.hyperframe.ppx Author(s) Adrian Baddeley and Rolf Turner See Also hyperframe, as.hyperframe.ppx Examples df <- data.frame(x=runif(4),y=letters[1:4]) as.hyperframe(df) sims <- list() for(i in 1:3) sims[[i]] <- rpoispp(42) as.hyperframe(as.listof(sims)) as.hyperframe(as.solist(sims)) as.hyperframe.ppx Extract coordinates and marks of multidimensional point pattern Description Given any kind of spatial or space-time point pattern, extract the coordinates and marks of the points. Usage ## S3 method for class 'ppx' as.hyperframe(x, ...) ## S3 method for class 'ppx' as.data.frame(x, ...) ## S3 method for class 'ppx' as.matrix(x, ...) Arguments x A general multidimensional space-time point pattern (object of class "ppx"). ... Ignored. Details An object of class "ppx" (see ppx) represents a marked point pattern in multidimensional space and/or time. There may be any number of spatial coordinates, any number of temporal coordinates, and any number of mark variables. The individual marks may be atomic (numeric values, factor values, etc) or objects of any kind. The function as.hyperframe.ppx extracts the coordinates and the marks as a "hyperframe" (see hyperframe) with one row of data for each point in the pattern. This is a method for the generic function as.hyperframe. as.im 105 The function as.data.frame.ppx discards those mark variables which are not atomic values, and extracts the coordinates and the remaining marks as a data.frame with one row of data for each point in the pattern. This is a method for the generic function as.data.frame. Finally as.matrix(x) is equivalent to as.matrix(as.data.frame(x)) for an object of class "ppx". Be warned that, if there are any columns of non-numeric data (i.e. if there are mark variables that are factors), the result will be a matrix of character values. Value A hyperframe, data.frame or matrix as appropriate. Author(s) Adrian Baddeley and Rolf Turner See Also ppx, hyperframe, as.hyperframe. Examples df <- data.frame(x=runif(4),y=runif(4),t=runif(4)) X <- ppx(data=df, coord.type=c("s","s","t")) as.data.frame(X) val <- runif(4) E <- lapply(val, function(s) { rpoispp(s) }) hf <- hyperframe(t=val, e=as.listof(E)) Z <- ppx(data=hf, domain=c(0,1)) as.hyperframe(Z) as.data.frame(Z) as.im Convert to Pixel Image Description Converts various kinds of data to a pixel image Usage as.im(X, ...) ## S3 method for class 'im' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL) ## S3 method for class 'owin' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL, value=1) 106 as.im ## S3 method for class 'matrix' as.im(X, W=NULL, ...) ## S3 method for class 'tess' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL) ## S3 method for class 'function' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL, strict=FALSE) ## S3 method for class 'funxy' as.im(X, W=Window(X), ...) ## S3 method for class 'distfun' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL, approx=TRUE) ## S3 method for class 'nnfun' as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL) ## S3 method for class 'Smoothfun' as.im(X, W=NULL, ...) ## S3 method for class 'leverage.ppm' as.im(X, ..., what=c("smooth", "nearest")) ## S3 method for class 'data.frame' as.im(X, ..., step, fatal=TRUE, drop=TRUE) ## Default S3 method: as.im(X, W=NULL, ..., eps=NULL, dimyx=NULL, xy=NULL, na.replace=NULL) Arguments X Data to be converted to a pixel image. W Window object which determines the spatial domain and pixel array geometry. ... Additional arguments passed to X when X is a function. eps,dimyx,xy Optional parameters passed to as.mask which determine the pixel array geometry. See as.mask. na.replace Optional value to replace NA entries in the output image. value Optional. The value to be assigned to pixels inside the window, if X is a window. as.im 107 strict Logical value indicating whether to match formal arguments of X when X is a function. If strict=FALSE (the default), all the ... arguments are passed to X. If strict=TRUE, only named arguments are passed, and only if they match the names of formal arguments of X. step Optional. A single number, or numeric vector of length 2, giving the grid step lengths in the x and y directions. fatal Logical value indicating what to do if the resulting image would be too large for available memory. If fatal=TRUE (the default), an error occurs. If fatal=FALSE, a warning is issued and NULL is returned. drop Logical value indicating what to do when X is a data frame with 3 columns. If drop=TRUE (the default), the result is a pixel image. If drop=FALSE, the result is a list containing one image. approx Logical value indicating whether to compute an approximate result at faster speed, by using distmap, when X is a distance function. what Character string (partially matched) specifying which image data should be extracted. See plot.leverage.ppm for explanation. Details This function converts the data X into a pixel image object of class "im" (see im.object). The function as.im is generic, with methods for the classes listed above. Currently X may be any of the following: • a pixel image object, of class "im". • a window object, of class "owin" (see owin.object). The result is an image with all pixel entries equal to value inside the window X, and NA outside. • a matrix. • a tessellation (object of class "tess"). The result is a factor-valued image, with one factor level corresponding to each tile of the tessellation. Pixels are classified according to the tile of the tessellation into which they fall. • a single number (or a single logical, complex, factor or character value). The result is an image with all pixel entries equal to this constant value inside the window W (and NA outside, unless the argument na.replace is given). Argument W is required. • a function of the form function(x, y, ...) which is to be evaluated to yield the image pixel values. In this case, the additional argument W must be present. This window will be converted to a binary image mask. Then the function X will be evaluated in the form X(x, y, ...) where x and y are vectors containing the x and y coordinates of all the pixels in the image mask, and ... are any extra arguments given. This function must return a vector or factor of the same length as the input vectors, giving the pixel values. • an object of class "funxy" representing a function(x,y,...) • an object of class "distfun" representing a distance function (created by the command distfun). • an object of class "nnfun" representing a nearest neighbour function (created by the command nnfun). • a list with entries x, y, z in the format expected by the standard R functions image.default and contour.default. That is, z is a matrix of pixel values, x and y are vectors of x and y coordinates respectively, and z[i,j] is the pixel value for the location (x[i],y[j]). • a point pattern (object of class "ppp"). See the separate documentation for as.im.ppp. 108 as.im • A data frame with at least three columns. Columns named x, y and z, if present, will be assumed to contain the spatial coordinates and the pixel values, respectively. Otherwise the x and y coordinates will be taken from the first two columns of the data frame, and any remaining columns will be interpreted as pixel values. The spatial domain (enclosing rectangle) of the pixel image is determined by the argument W. If W is absent, the spatial domain is determined by X. When X is a function, a matrix, or a single numerical value, W is required. The pixel array dimensions of the final resulting image are determined by (in priority order) • the argument eps, dimyx or xy if present; • the pixel dimensions of the window W, if it is present and if it is a binary mask; • the pixel dimensions of X if it is an image, a binary mask, or a list(x,y,z); • the default pixel dimensions, controlled by spatstat.options. Note that if eps, dimyx or xy is given, this will override the pixel dimensions of X if it has them. Thus, as.im can be used to change an image’s pixel dimensions. If the argument na.replace is given, then all NA entries in the image will be replaced by this value. The resulting image is then defined everwhere on the full rectangular domain, instead of a smaller window. Here na.replace should be a single value, of the same type as the other entries in the image. If X is a pixel image that was created by an older version of spatstat, the command X <- as.im(X) will repair the internal format of X so that it conforms to the current version of spatstat. If X is a data frame with m columns, then m-2 columns of data are interpreted as pixel values, yielding m-2 pixel images. The result of as.im.data.frame is a list of pixel images, belonging to the class "imlist". If m = 3 and drop=TRUE (the default), then the result is a pixel image rather than a list containing this image. Value A pixel image (object of class "im"), or a list of pixel images, or NULL if the conversion failed. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also Separate documentation for as.im.ppp Examples data(demopat) # window object W <- Window(demopat) plot(W) Z <- as.im(W) image(Z) # function Z <- as.im(function(x,y) {x^2 + y^2}, unit.square()) image(Z) # function with extra arguments as.interact 109 f <- function(x, y, x0, y0) { sqrt((x - x0)^2 + (y-y0)^2) } Z <- as.im(f, unit.square(), x0=0.5, y0=0.5) image(Z) # Revisit the Sixties data(letterR) Z <- as.im(f, letterR, x0=2.5, y0=2) image(Z) # usual convention in S stuff <- list(x=1:10, y=1:10, z=matrix(1:100, nrow=10)) Z <- as.im(stuff) # convert to finer grid Z <- as.im(Z, dimyx=256) # pixellate the Dirichlet tessellation Di <- dirichlet(runifpoint(10)) plot(as.im(Di)) plot(Di, add=TRUE) # as.im.data.frame is the reverse of as.data.frame.im grad <- bei.extra$grad slopedata <- as.data.frame(grad) slope <- as.im(slopedata) unitname(slope) <- c("metre","metres") all.equal(slope, grad) # TRUE as.interact Extract Interaction Structure Description Extracts the interpoint interaction structure from a point pattern model. Usage as.interact(object) ## S3 method for class 'fii' as.interact(object) ## S3 method for class 'interact' as.interact(object) ## S3 method for class 'ppm' as.interact(object) Arguments object A fitted point process model (object of class "ppm") or an interpoint interaction structure (object of class "interact"). Details The function as.interact extracts the interpoint interaction structure from a suitable object. An object of class "interact" describes an interpoint interaction structure, before it has been fitted to point pattern data. The irregular parameters of the interaction (such as the interaction range) are 110 as.layered fixed, but the regular parameters (such as interaction strength) are undetermined. Objects of this class are created by the functions Poisson, Strauss and so on. The main use of such objects is in a call to ppm. The function as.interact is generic, with methods for the classes "ppm", "fii" and "interact". The result is an object of class "interact" which can be printed. Value An object of class "interact" representing the interpoint interaction. This object can be printed and plotted. Note on parameters This function does not extract the fitted coefficients of the interaction. To extract the fitted interaction including the fitted coefficients, use fitin. Author(s) Adrian Baddeley and Rolf Turner See Also fitin, ppm. Examples data(cells) model <- ppm(cells, ~1, Strauss(0.07)) f <- as.interact(model) f as.layered Convert Data To Layered Object Description Converts spatial data into a layered object. Usage as.layered(X) ## Default S3 method: as.layered(X) ## S3 method for class 'ppp' as.layered(X) ## S3 method for class 'splitppp' as.layered(X) as.layered 111 ## S3 method for class 'solist' as.layered(X) ## S3 method for class 'listof' as.layered(X) ## S3 method for class 'msr' as.layered(X) Arguments X Some kind of spatial data. Details This function converts the object X into an object of class "layered". The argument X should contain some kind of spatial data such as a point pattern, window, or pixel image. If X is a simple object then it will be converted into a layered object containing only one layer which is equivalent to X. If X can be interpreted as consisting of multiple layers of data, then the result will be a layered object consisting of these separate layers of data. • if X is a list of class "listof" or "solist", then as.layered(X) consists of several layers, one for each entry in the list X; • if X is a multitype point pattern, then as.layered(X) consists of several layers, each containing the sub-pattern consisting of points of one type; • if X is a vector-valued measure, then as.layered(X) consists of several layers, each containing a scalar-valued measure. Value An object of class "layered" (see layered). Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also layered, split.ppp Examples as.layered(cells) as.layered(amacrine) P <- rpoispp(100) fit <- ppm(P ~ x+y) rs <- residuals(fit, type="score") as.layered(rs) 112 as.linfun as.linfun Convert Data to a Function on a Linear Network Description Convert some kind of data to an object of class "linfun" representing a function on a linear network. Usage as.linfun(X, ...) ## S3 method for class 'linim' as.linfun(X, ...) ## S3 method for class 'lintess' as.linfun(X, ..., values, navalue=NA) Arguments X Some kind of data to be converted. ... Other arguments passed to methods. values Optional. Vector of function values, one entry associated with each tile of the tessellation. navalue Optional. Function value associated with locations that do not belong to a tile of the tessellation. Details An object of class "linfun" represents a function defined on a linear network. The function as.linfun is generic. The method as.linfun.linim converts objects of class "linim" (pixel images on a linear network) to functions on the network. The method as.linfun.lintess converts a tessellation on a linear network into a function with a different value on each tile of the tessellation. If the argument values is missing or null, then the function returns factor values identifying which tile contains each given point. If values is given, it should be a vector with one entry for each tile of the tessellation: any point lying in tile number i will return the value v[i]. Value Object of class "linfun". Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also linfun as.linim 113 Examples X <- runiflpp(2, simplenet) Y <- runiflpp(5, simplenet) # image on network D <- density(Y, 0.1, verbose=FALSE) f <- as.linfun(D) f f(X) # tessellation on network Z <- lineardirichlet(Y) g <- as.linfun(Z) g(X) h <- as.linfun(Z, values = runif(5)) h(X) as.linim Convert to Pixel Image on Linear Network Description Converts various kinds of data to a pixel image on a linear network. Usage as.linim(X, ...) ## S3 method for class 'linim' as.linim(X, ...) ## Default S3 method: as.linim(X, L, ..., eps = NULL, dimyx = NULL, xy = NULL, delta=NULL) ## S3 method for class 'linfun' as.linim(X, L=domain(X), ..., eps = NULL, dimyx = NULL, xy = NULL, delta=NULL) Arguments X Data to be converted to a pixel image on a linear network. L Linear network (object of class "linnet"). ... Additional arguments passed to X when X is a function. eps,dimyx,xy Optional arguments passed to as.mask to control the pixel resolution. delta Optional. Numeric value giving the approximate distance (in coordinate units) between successive sample points along each segment of the network. 114 as.linnet.linim Details This function converts the data X into a pixel image on a linear network, an object of class "linim" (see linim). The argument X may be any of the following: • a function on a linear network, an object of class "linfun". • a pixel image on a linear network, an object of class "linim". • a pixel image, an object of class "im". • any type of data acceptable to as.im, such as a function, numeric value, or window. First X is converted to a pixel image object Y (object of class "im"). The conversion is performed by as.im. The arguments eps, dimyx and xy determine the pixel resolution. Next Y is converted to a pixel image on a linear network using linim. The argument L determines the linear network. If L is missing or NULL, then X should be an object of class "linim", and L defaults to the linear network on which X is defined. In addition to converting the function to a pixel image, the algorithm also generates a fine grid of sample points evenly spaced along each segment of the network (with spacing at most delta coordinate units). The function values at these sample points are stored in the resulting object as a data frame (the argument df of linim). This mechanism allows greater accuracy for some calculations (such as integral.linim). Value An image object on a linear network; an object of class "linim". Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also as.im Examples f <- function(x,y){ x + y } plot(as.linim(f, simplenet)) as.linnet.linim Extract Linear Network from Data on a Linear Network Description Given some kind of data on a linear network, the command as.linnet extracts the linear network itself. as.linnet.linim 115 Usage ## S3 method for class 'linim' as.linnet(X, ...) ## S3 method for class 'linfun' as.linnet(X, ...) ## S3 method for class 'lintess' as.linnet(X, ...) ## S3 method for class 'lpp' as.linnet(X, ..., fatal=TRUE, sparse) Arguments X Data on a linear network. A point pattern (class "lpp"), pixel image (class "linim"), function (class "linfun") or tessellation (class "lintess") on a linear network. ... Ignored. fatal Logical value indicating whether data in the wrong format should lead to an error (fatal=TRUE) or a warning (fatal=FALSE). sparse Logical value indicating whether to use a sparse matrix representation, as explained in linnet. Default is to keep the same representation as in X. Details These are methods for the generic as.linnet for various classes. The network on which the data are defined is extracted. Value A linear network (object of class "linnet"). Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also linnet, methods.linnet. Examples # make some data xcoord <- linfun(function(x,y,seg,tp) { x }, simplenet) as.linnet(xcoord) X <- as.linim(xcoord) as.linnet(X) 116 as.linnet.psp as.linnet.psp Convert Line Segment Pattern to Linear Network Description Converts a line segment pattern to a linear network. Usage ## S3 method for class 'psp' as.linnet(X, ..., eps, sparse=FALSE) Arguments X Line segment pattern (object of class "psp"). ... Ignored. eps Optional. Distance threshold. If two segment endpoints are closer than eps units apart, they will be treated as the same point, and will become a single vertex in the linear network. sparse Logical value indicating whether to use a sparse matrix representation, as explained in linnet. Details This command converts any collection of line segments into a linear network by guessing the connectivity of the network, using the distance threshold eps. If any segments in X cross over each other, they are first cut into pieces using selfcut.psp. Then any pair of segment endpoints lying closer than eps units apart, is treated as a single vertex. The linear network is then constructed using linnet. It would be wise to check the result by plotting the degree of each vertex, as shown in the Examples. If X has marks, then these are stored in the resulting linear network Y <- as.linnet(X), and can be extracted as marks(as.psp(Y)) or marks(Y$lines). Value A linear network (object of class "linnet"). Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also linnet, selfcut.psp, methods.linnet. as.lpp 117 Examples # make some data A <- psp(0.09, 0.55, 0.79, 0.80, window=owin()) B <- superimpose(A, as.psp(simplenet)) # convert to a linear network D <- as.linnet(B) # check validity D plot(D) text(vertices(D), labels=vertexdegree(D)) as.lpp Convert Data to a Point Pattern on a Linear Network Description Convert various kinds of data to a point pattern on a linear network. Usage as.lpp(x=NULL, y=NULL, seg=NULL, tp=NULL, ..., marks=NULL, L=NULL, check=FALSE, sparse) Arguments x,y Vectors of cartesian coordinates, or any data acceptable to xy.coords. Alternatively x can be a point pattern on a linear network (object of class "lpp") or a planar point pattern (object of class "ppp"). seg,tp Optional local coordinates. Vectors of the same length as x,y. See Details. ... Ignored. marks Optional marks for the point pattern. A vector or factor with one entry for each point, or a data frame or hyperframe with one row for each point. L Linear network (object of class "linnet") on which the points lie. check Logical. Whether to check the validity of the spatial coordinates. sparse Optional logical value indicating whether to store the linear network data in a sparse matrix representation or not. See linnet. Details This function converts data in various formats into a point pattern on a linear network (object of class "lpp"). The possible formats are: • x is already a point pattern on a linear network (object of class "lpp"). Then x is returned unchanged. • x is a planar point pattern (object of class "ppp"). Then x is converted to a point pattern on the linear network L using lpp. 118 as.mask • x,y,seg,tp are vectors of equal length. These specify that the ith point has Cartesian coordinates (x[i],y[i]), and lies on segment number seg[i] of the network L, at a fractional position tp[i] along that segment (with tp=0 representing one endpoint and tp=1 the other endpoint of the segment). • x,y are missing and seg,tp are vectors of equal length as described above. • seg,tp are NULL, and x,y are data in a format acceptable to xy.coords specifying the Cartesian coordinates. Value A point pattern on a linear network (object of class "lpp"). Author(s) Adrian Baddeley and Rolf Turner See Also lpp. Examples A <- as.psp(simplenet) X <- runifpointOnLines(10, A) is.ppp(X) Y <- as.lpp(X, L=simplenet) as.mask Pixel Image Approximation of a Window Description Obtain a discrete (pixel image) approximation of a given window Usage as.mask(w, eps=NULL, dimyx=NULL, xy=NULL) Arguments w A window (object of class "owin") or data acceptable to as.owin. eps (optional) width and height of pixels. dimyx (optional) pixel array dimensions xy (optional) data containing pixel coordinates as.mask 119 Details This function generates a rectangular grid of locations in the plane, tests whether each of these locations lies inside the window w, and stores the results as a binary pixel image or ‘mask’ (an object of class "owin", see owin.object). The most common use of this function is to approximate the shape of another window w by a binary pixel image. In this case, we will usually want to have a very fine grid of pixels. This function can also be used to generate a coarsely-spaced grid of locations inside a window, for purposes such as subsampling and prediction. The grid spacing and location are controlled by the arguments eps, dimyx and xy, which are mutually incompatible. If eps is given, then it determines the grid spacing. If eps is a single number, then the grid spacing will be approximately eps in both the x and y directions. If eps is a vector of length 2, then the grid spacing will be approximately eps[1] in the x direction and eps[2] in the y direction. If dimyx is given, then the pixel grid will be an m × n rectangular grid where m, n are given by dimyx[2], dimyx[1] respectively. Warning: dimyx[1] is the number of pixels in the y direction, and dimyx[2] is the number in the x direction. If xy is given, then this should be some kind of data specifing the coordinates of a pixel grid. It may be • a list or structure containing elements x and y which are numeric vectors of equal length. These will be taken as x and y coordinates of the margins of the grid. The pixel coordinates will be generated from these two vectors. • a pixel image (object of class "im"). • a window (object of class "owin") which is of type "mask" so that it contains pixel coordinates. If xy is given, w may be omitted. If neither eps nor dimyx nor xy is given, the pixel raster dimensions are obtained from spatstat.options("npixel"). There is no inverse of this function. However, the function as.polygonal will compute a polygonal approximation of a binary mask. Value A window (object of class "owin") of type "mask" representing a binary pixel image. Author(s) Adrian Baddeley and Rolf Turner See Also owin.object, as.rectangle, as.polygonal, spatstat.options Examples w <- owin(c(0,10),c(0,10), poly=list(x=c(1,2,3,2,1), y=c(2,3,4,6,7))) ## Not run: plot(w) m <- as.mask(w) ## Not run: plot(m) 120 as.mask.psp x <- 1:9 y <- seq(0.25, 9.75, by=0.5) m <- as.mask(w, xy=list(x=x, y=y)) as.mask.psp Convert Line Segment Pattern to Binary Pixel Mask Description Converts a line segment pattern to a binary pixel mask by determining which pixels intersect the lines. Usage as.mask.psp(x, W=NULL, ...) Arguments x Line segment pattern (object of class "psp"). W Optional window (object of class "owin") determining the pixel raster. ... Optional extra arguments passed to as.mask to determine the pixel resolution. Details This function converts a line segment pattern to a binary pixel mask by determining which pixels intersect the lines. The pixel raster is determined by W and the optional arguments .... If W is missing or NULL, it defaults to the window containing x. Then W is converted to a binary pixel mask using as.mask. The arguments ... are passed to as.mask to control the pixel resolution. Value A window (object of class "owin") which is a binary pixel mask (type "mask"). Author(s) Adrian Baddeley and Rolf Turner See Also pixellate.psp, as.mask. Use pixellate.psp if you want to measure the length of line in each pixel. Examples X <- psp(runif(10), runif(10), runif(10), runif(10), window=owin()) plot(as.mask.psp(X)) plot(X, add=TRUE, col="red") as.matrix.im 121 as.matrix.im Convert Pixel Image to Matrix or Array Description Converts a pixel image to a matrix or an array. Usage ## S3 method for class 'im' as.matrix(x, ...) ## S3 method for class 'im' as.array(x, ...) Arguments x A pixel image (object of class "im"). ... See below. Details The function as.matrix.im converts the pixel image x into a matrix containing the pixel values. It is handy when you want to extract a summary of the pixel values. See the Examples. The function as.array.im converts the pixel image to an array. By default this is a three-dimensional array of dimension n by m by 1. If the extra arguments ... are given, they will be passed to array, and they may change the dimensions of the array. Value A matrix or array. Author(s) Adrian Baddeley and Rolf Turner See Also as.matrix.owin Examples # artificial image Z <- setcov(square(1)) M <- as.matrix(Z) median(M) ## Not run: # plot the cumulative distribution function of pixel values plot(ecdf(as.matrix(Z))) 122 as.matrix.owin ## End(Not run) as.matrix.owin Convert Pixel Image to Matrix Description Converts a pixel image to a matrix. Usage ## S3 method for class 'owin' as.matrix(x, ...) Arguments x A window (object of class "owin"). ... Arguments passed to as.mask to control the pixel resolution. Details The function as.matrix.owin converts a window to a logical matrux. It first converts the window x into a binary pixel mask using as.mask. It then extracts the pixel entries as a logical matrix. The resulting matrix has entries that are TRUE if the corresponding pixel is inside the window, and FALSE if it is outside. The function as.matrix is generic. The function as.matrix.owin is the method for windows (objects of class "owin"). Use as.im to convert a window to a pixel image. Value A logical matrix. Author(s) Adrian Baddeley and Rolf Turner See Also as.matrix.im, as.im Examples m <- as.matrix(letterR) as.owin as.owin 123 Convert Data To Class owin Description Converts data specifying an observation window in any of several formats, into an object of class "owin". Usage as.owin(W, ..., fatal=TRUE) ## S3 method for class 'owin' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'ppp' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'ppm' as.owin(W, ..., from=c("points", "covariates"), fatal=TRUE) ## S3 method for class 'kppm' as.owin(W, ..., from=c("points", "covariates"), fatal=TRUE) ## S3 method for class 'dppm' as.owin(W, ..., from=c("points", "covariates"), fatal=TRUE) ## S3 method for class 'lpp' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'lppm' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'msr' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'psp' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'quad' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'quadratcount' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'quadrattest' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'tess' as.owin(W, ..., fatal=TRUE) 124 as.owin ## S3 method for class 'im' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'layered' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'data.frame' as.owin(W, ..., step, fatal=TRUE) ## S3 method for class 'distfun' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'nnfun' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'funxy' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'boxx' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'rmhmodel' as.owin(W, ..., fatal=FALSE) ## S3 method for class 'leverage.ppm' as.owin(W, ..., fatal=TRUE) ## S3 method for class 'influence.ppm' as.owin(W, ..., fatal=TRUE) ## Default S3 method: as.owin(W, ..., fatal=TRUE) Arguments W fatal ... from step Data specifying an observation window, in any of several formats described under Details below. Logical flag determining what to do if the data cannot be converted to an observation window. See Details. Ignored. Character string. See Details. Optional. A single number, or numeric vector of length 2, giving the grid step lengths in the x and y directions. Details The class "owin" is a way of specifying the observation window for a point pattern. See owin.object for an overview. This function converts data in any of several formats into an object of class "owin" for use by the spatstat package. The function as.owin is generic, with methods for different classes of objects, and a default method. The argument W may be as.owin 125 • an object of class "owin" • a structure with entries xrange, yrange specifying the x and y dimensions of a rectangle • a four-element vector (interpreted as (xmin, xmax, ymin, ymax)) specifying the x and y dimensions of a rectangle • a structure with entries xl, xu, yl, yu specifying the x and y dimensions of a rectangle as (xmin, xmax) = (xl, xu) and (ymin, ymax) = (yl, yu). This will accept objects of class spp used in the Venables and Ripley spatial library. • an object of class "ppp" representing a point pattern. In this case, the object’s window structure will be extracted. • an object of class "psp" representing a line segment pattern. In this case, the object’s window structure will be extracted. • an object of class "tess" representing a tessellation. In this case, the object’s window structure will be extracted. • an object of class "quad" representing a quadrature scheme. In this case, the window of the data component will be extracted. • an object of class "im" representing a pixel image. In this case, a window of type "mask" will be returned, with the same pixel raster coordinates as the image. An image pixel value of NA, signifying that the pixel lies outside the window, is transformed into the logical value FALSE, which is the corresponding convention for window masks. • an object of class "ppm", "kppm" or "dppm" representing a fitted point process model. In this case, if from="data" (the default), as.owin extracts the original point pattern data to which the model was fitted, and returns the observation window of this point pattern. If from="covariates" then as.owin extracts the covariate images to which the model was fitted, and returns a binary mask window that specifies the pixel locations. • an object of class "lpp" representing a point pattern on a linear network. In this case, as.owin extracts the linear network and returns a window containing this network. • an object of class "lppm" representing a fitted point process model on a linear network. In this case, as.owin extracts the linear network and returns a window containing this network. • A data.frame with exactly three columns. Each row of the data frame corresponds to one pixel. Each row contains the x and y coordinates of a pixel, and a logical value indicating whether the pixel lies inside the window. • A data.frame with exactly two columns. Each row of the data frame contains the x and y coordinates of a pixel that lies inside the window. • an object of class "distfun", "nnfun" or "funxy" representing a function of spatial location, defined on a spatial domain. The spatial domain of the function will be extracted. • an object of class "rmhmodel" representing a point process model that can be simulated using rmh. The window (spatial domain) of the model will be extracted. The window may be NULL in some circumstances (indicating that the simulation window has not yet been determined). This is not treated as an error, because the argument fatal defaults to FALSE for this method. • an object of class "layered" representing a list of spatial objects. See layered. In this case, as.owin will be applied to each of the objects in the list, and the union of these windows will be returned. If the argument W is not in one of these formats and cannot be converted to a window, then an error will be generated (if fatal=TRUE) or a value of NULL will be returned (if fatal=FALSE). When W is a data frame, the argument step can be used to specify the pixel grid spacing; otherwise, the spacing will be guessed from the data. 126 as.polygonal Value An object of class "owin" (see owin.object) specifying an observation window. Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also owin.object, owin Examples w <- as.owin(c(0,1,0,1)) w <- as.owin(list(xrange=c(0,5),yrange=c(0,10))) # point pattern data(demopat) w <- as.owin(demopat) # image Z <- as.im(function(x,y) { x + 3}, unit.square()) w <- as.owin(Z) # Venables & Ripley 'spatial' package require(spatial) towns <- ppinit("towns.dat") w <- as.owin(towns) detach(package:spatial) as.polygonal Convert a Window to a Polygonal Window Description Given a window W of any geometric type (rectangular, polygonal or binary mask), this function returns a polygonal window that represents the same spatial domain. Usage as.polygonal(W, repair=FALSE) Arguments W A window (object of class "owin"). repair Logical value indicating whether to check the validity of the polygon data and repair it, if W is already a polygonal window. as.ppm 127 Details Given a window W of any geometric type (rectangular, polygonal or binary mask), this function returns a polygonal window that represents the same spatial domain. If W is a rectangle, it is converted to a polygon with 4 vertices. If W is already polygonal, it is returned unchanged, by default. However if repair=TRUE then the validity of the polygonal coordinates will be checked (for example to check the boundary is not self-intersecting) and repaired if necessary, so that the result could be different from W. If W is a binary mask, then each pixel in the mask is replaced by a small square or rectangle, and the union of these squares or rectangles is computed. The result is a polygonal window that has only horizontal and vertical edges. (Use simplify.owin to remove the staircase appearance, if desired). Value A polygonal window (object of class "owin" and of type "polygonal"). Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also owin, as.owin, as.mask, simplify.owin Examples data(letterR) m <- as.mask(letterR, dimyx=32) p <- as.polygonal(m) if(interactive()) { plot(m) plot(p, add=TRUE, lwd=2) } as.ppm Extract Fitted Point Process Model Description Extracts the fitted point process model from some kind of fitted model. Usage as.ppm(object) ## S3 method for class 'ppm' as.ppm(object) ## S3 method for class 'profilepl' as.ppm(object) 128 as.ppm ## S3 method for class 'kppm' as.ppm(object) ## S3 method for class 'dppm' as.ppm(object) Arguments object An object that includes a fitted Poisson or Gibbs point process model. An object of class "ppm", "profilepl", "kppm" or "dppm" or possibly other classes. Details The function as.ppm extracts the fitted point process model (of class "ppm") from a suitable object. The function as.ppm is generic, with methods for the classes "ppm", "profilepl", "kppm" and "dppm", and possibly for other classes. For the class "profilepl" of models fitted by maximum profile pseudolikelihood, the method as.ppm.profilepl extracts the fitted point process model (with the optimal values of the irregular parameters). For the class "kppm" of models fitted by minimum contrast (or Palm or composite likelihood) using Waagepetersen’s two-step estimation procedure (see kppm), the method as.ppm.kppm extracts the Poisson point process model that is fitted in the first stage of the procedure. The behaviour for the class "dppm" is analogous to the "kppm" case above. Value An object of class "ppm". Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also ppm, profilepl. Examples # fit a model by profile maximum pseudolikelihood rvals <- data.frame(r=(1:10)/100) pfit <- profilepl(rvals, Strauss, cells, ~1) # extract the fitted model fit <- as.ppm(pfit) as.ppp 129 as.ppp Convert Data To Class ppp Description Tries to coerce any reasonable kind of data to a spatial point pattern (an object of class "ppp") for use by the spatstat package). Usage as.ppp(X, ..., fatal=TRUE) ## S3 method for class 'ppp' as.ppp(X, ..., fatal=TRUE) ## S3 method for class 'psp' as.ppp(X, ..., fatal=TRUE) ## S3 method for class 'quad' as.ppp(X, ..., fatal=TRUE) ## S3 method for class 'matrix' as.ppp(X, W=NULL, ..., fatal=TRUE) ## S3 method for class 'data.frame' as.ppp(X, W=NULL, ..., fatal=TRUE) ## S3 method for class 'influence.ppm' as.ppp(X, ...) ## Default S3 method: as.ppp(X, W=NULL, ..., fatal=TRUE) Arguments X Data which will be converted into a point pattern W Data which define a window for the pattern, when X does not contain a window. (Ignored if X contains window information.) ... Ignored. fatal Logical value specifying what to do if the data cannot be converted. See Details. Details Converts the dataset X to a point pattern (an object of class "ppp"; see ppp.object for an overview). This function is normally used to convert an existing point pattern dataset, stored in another format, to the "ppp" format. To create a new point pattern from raw data such as x, y coordinates, it is normally easier to use the creator function ppp. The function as.ppp is generic, with methods for the classes "ppp", "psp", "quad", "matrix", "data.frame" and a default method. The dataset X may be: 130 as.ppp • an object of class "ppp" • an object of class "psp" • a point pattern object created by the spatial library • an object of class "quad" representing a quadrature scheme (see quad.object) • a matrix or data frame with at least two columns • a structure with entries x, y which are numeric vectors of equal length • a numeric vector of length 2, interpreted as the coordinates of a single point. In the last three cases, we need the second argument W which is converted to a window object by the function as.owin. In the first four cases, W will be ignored. If X is a line segment pattern (an object of class psp) the point pattern returned consists of the endpoints of the segments. If X is marked then the point pattern returned will also be marked, the mark associated with a point being the mark of the segment of which that point was an endpoint. If X is a matrix or data frame, the first and second columns will be interpreted as the x and y coordinates respectively. Any additional columns will be interpreted as marks. The argument fatal indicates what to do when W is missing and X contains no information about the window. If fatal=TRUE, a fatal error will be generated; if fatal=FALSE, the value NULL is returned. In the spatial library, a point pattern is represented in either of the following formats: • (in spatial versions 1 to 6) a structure with entries x, y xl, xu, yl, yu • (in spatial version 7) a structure with entries x, y and area, where area is a structure with entries xl, xu, yl, yu where x and y are vectors of equal length giving the point coordinates, and xl, xu, yl, yu are numbers giving the dimensions of a rectangular window. Point pattern datasets can also be created by the function ppp. Value An object of class "ppp" (see ppp.object) describing the point pattern and its window of observation. The value NULL may also be returned; see Details. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also ppp, ppp.object, as.owin, owin.object Examples xy <- matrix(runif(40), ncol=2) pp <- as.ppp(xy, c(0,1,0,1)) # Venables-Ripley format # check for 'spatial' package spatialpath <- system.file(package="spatial") if(nchar(spatialpath) > 0) { require(spatial) as.psp } 131 towns <- ppinit("towns.dat") pp <- as.ppp(towns) # converted to our format detach(package:spatial) xyzt <- matrix(runif(40), ncol=4) Z <- as.ppp(xyzt, square(1)) as.psp Convert Data To Class psp Description Tries to coerce any reasonable kind of data object to a line segment pattern (an object of class "psp") for use by the spatstat package. Usage as.psp(x, ..., from=NULL, to=NULL) ## S3 method for class 'psp' as.psp(x, ..., check=FALSE, fatal=TRUE) ## S3 method for class 'data.frame' as.psp(x, ..., window=NULL, marks=NULL, check=spatstat.options("checksegments"), fatal=TRUE) ## S3 method for class 'matrix' as.psp(x, ..., window=NULL, marks=NULL, check=spatstat.options("checksegments"), fatal=TRUE) ## Default S3 method: as.psp(x, ..., window=NULL, marks=NULL, check=spatstat.options("checksegments"), fatal=TRUE) Arguments x Data which will be converted into a line segment pattern window Data which define a window for the pattern. ... Ignored. marks (Optional) vector or data frame of marks for the pattern check Logical value indicating whether to check the validity of the data, e.g. to check that the line segments lie inside the window. fatal Logical value. See Details. from,to Point patterns (object of class "ppp") containing the first and second endpoints (respectively) of each segment. Incompatible with x. 132 as.psp Details Converts the dataset x to a line segment pattern (an object of class "psp"; see psp.object for an overview). This function is normally used to convert an existing line segment pattern dataset, stored in another format, to the "psp" format. To create a new point pattern from raw data such as x, y coordinates, it is normally easier to use the creator function psp. The dataset x may be: • an object of class "psp" • a data frame with at least 4 columns • a structure (list) with elements named x0, y0, and possibly a fifth element named marks x1, y1 or elements named xmid, ymid, length, angle If x is a data frame the interpretation of its columns is as follows: • If there are columns named x0, y0, x1, y1 then these will be interpreted as the coordinates of the endpoints of the segments and used to form the ends component of the psp object to be returned. • If there are columns named xmid, ymid, length, angle then these will be interpreted as the coordinates of the segment midpoints, the lengths of the segments, and the orientations of the segments in radians and used to form the ends component of the psp object to be returned. • If there is a column named marks then this will be interpreted as the marks of the pattern provided that the argument marks of this function is NULL. If argument marks is not NULL then the value of this argument is taken to be the marks of the pattern and the column named marks is ignored (with a warning). In either case the column named marks is deleted and omitted from further consideration. • If there is no column named marks and if the marks argument of this function is NULL, and if after interpreting 4 columns of x as determining the ends component of the psp object to be returned, there remain other columns of x, then these remaining columns will be taken to form a data frame of marks for the psp object to be returned. If x is a structure (list) with elements named x0, y0, x1, y1, marks or xmid, ymid, length, angle, marks, then the element named marks will be interpreted as the marks of the pattern provide that the argument marks of this function is NULL. If this argument is non-NULL then it is interpreted as the marks of the pattern and the element marks of x is ignored — with a warning. Alternatively, you may specify two point patterns from and to containing the first and second endpoints of the line segments. The argument window is converted to a window object by the function as.owin. The argument fatal indicates what to do when the data cannot be converted to a line segment pattern. If fatal=TRUE, a fatal error will be generated; if fatal=FALSE, the value NULL is returned. The function as.psp is generic, with methods for the classes "psp", "data.frame", "matrix" and a default method. Point pattern datasets can also be created by the function psp. Value An object of class "psp" (see psp.object) describing the line segment pattern and its window of observation. The value NULL may also be returned; see Details. as.rectangle 133 Warnings If only a proper subset of the names x0,y0,x1,y1 or xmid,ymid,length,angle appear amongst the names of the columns of x where x is a data frame, then these special names are ignored. For example if the names of the columns were xmid,ymid,length,degrees, then these columns would be interpreted as if the represented x0,y0,x1,y1 in that order. Whether it gets used or not, column named marks is always removed from x before any attempt to form the ends component of the psp object that is returned. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also psp, psp.object, as.owin, owin.object. See edges for extracting the edges of a polygonal window as a "psp" object. Examples mat <- matrix(runif(40), ncol=4) mx <- data.frame(v1=sample(1:4,10,TRUE), v2=factor(sample(letters[1:4],10,TRUE),levels=letters[1:4])) a <- as.psp(mat, window=owin(),marks=mx) mat <- cbind(as.data.frame(mat),mx) b <- as.psp(mat, window=owin()) # a and b are identical. stuff <- list(xmid=runif(10), ymid=runif(10), length=rep(0.1, 10), angle=runif(10, 0, 2 * pi)) a <- as.psp(stuff, window=owin()) b <- as.psp(from=runifpoint(10), to=runifpoint(10)) as.rectangle Window Frame Description Extract the window frame of a window or other spatial dataset Usage as.rectangle(w, ...) Arguments w A window, or a dataset that has a window. Either a window (object of class "owin"), a pixel image (object of class "im") or other data determining such a window. ... Optional. Auxiliary data to help determine the window. If w does not belong to a recognised class, the arguments w and ... are passed to as.owin to determine the window. 134 as.solist Details This function is the quickest way to determine a bounding rectangle for a spatial dataset. If w is a window, the function just extracts the outer bounding rectangle of w as given by its elements xrange,yrange. The function can also be applied to any spatial dataset that has a window: for example, a point pattern (object of class "ppp") or a line segment pattern (object of class "psp"). The bounding rectangle of the window of the dataset is extracted. Use the function boundingbox to compute the smallest bounding rectangle of a dataset. Value A window (object of class "owin") of type "rectangle" representing a rectangle. Author(s) Adrian Baddeley and Rolf Turner See Also owin, as.owin, boundingbox Examples w <- owin(c(0,10),c(0,10), poly=list(x=c(1,2,3,2,1), y=c(2,3,4,6,7))) r <- as.rectangle(w) # returns a 10 x 10 rectangle data(lansing) as.rectangle(lansing) data(copper) as.rectangle(copper$SouthLines) as.solist Convert List of Two-Dimensional Spatial Objects Description Given a list of two-dimensional spatial objects, convert it to the class "solist". Usage as.solist(x, ...) Arguments x A list of objects, each representing a two-dimensional spatial dataset. ... Additional arguments passed to solist. as.tess 135 Details This command makes the list x into an object of class "solist" (spatial object list). See solist for details. The entries in the list x should be two-dimensional spatial datasets (not necessarily of the same class). Value A list, usually of class "solist". Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also solist, as.anylist, solapply. Examples x <- list(cells, density(cells)) y <- as.solist(x) as.tess Convert Data To Tessellation Description Converts data specifying a tessellation, in any of several formats, into an object of class "tess". Usage as.tess(X) ## S3 method as.tess(X) ## S3 method as.tess(X) ## S3 method as.tess(X) ## S3 method as.tess(X) ## S3 method as.tess(X) ## S3 method as.tess(X) for class 'tess' for class 'im' for class 'owin' for class 'quadratcount' for class 'quadrattest' for class 'list' Arguments X Data to be converted to a tessellation. 136 as.tess Details A tessellation is a collection of disjoint spatial regions (called tiles) that fit together to form a larger spatial region. This command creates an object of class "tess" that represents a tessellation. This function converts data in any of several formats into an object of class "tess" for use by the spatstat package. The argument X may be • an object of class "tess". The object will be stripped of any extraneous attributes and returned. • a pixel image (object of class "im") with pixel values that are logical or factor values. Each level of the factor will determine a tile of the tessellation. • a window (object of class "owin"). The result will be a tessellation consisting of a single tile. • a set of quadrat counts (object of class "quadratcount") returned by the command quadratcount. The quadrats used to generate the counts will be extracted and returned as a tessellation. • a quadrat test (object of class "quadrattest") returned by the command quadrat.test. The quadrats used to perform the test will be extracted and returned as a tessellation. • a list of windows (objects of class "owin") giving the tiles of the tessellation. The function as.tess is generic, with methods for various classes, as listed above. Value An object of class "tess" specifying a tessellation. Author(s) Adrian Baddeley and Rolf Turner See Also tess Examples # pixel image v <- as.im(function(x,y){factor(round(5 * (x^2 + y^2)))}, W=owin()) levels(v) <- letters[seq(length(levels(v)))] as.tess(v) # quadrat counts data(nztrees) qNZ <- quadratcount(nztrees, nx=4, ny=3) as.tess(qNZ) auc 137 auc Area Under ROC Curve Description Compute the AUC (area under the Receiver Operating Characteristic curve) for a fitted point process model. Usage auc(X, ...) ## S3 method for class 'ppp' auc(X, covariate, ..., high = TRUE) ## S3 method for class 'ppm' auc(X, ...) ## S3 method for class 'kppm' auc(X, ...) ## S3 method for class 'lpp' auc(X, covariate, ..., high = TRUE) ## S3 method for class 'lppm' auc(X, ...) Arguments X Point pattern (object of class "ppp" or "lpp") or fitted point process model (object of class "ppm" or "kppm" or "lppm"). covariate Spatial covariate. Either a function(x,y), a pixel image (object of class "im"), or one of the strings "x" or "y" indicating the Cartesian coordinates. ... Arguments passed to as.mask controlling the pixel resolution for calculations. high Logical value indicating whether the threshold operation should favour high or low values of the covariate. Details This command computes the AUC, the area under the Receiver Operating Characteristic curve. The ROC itself is computed by roc. For a point pattern X and a covariate Z, the AUC is a numerical index that measures the ability of the covariate to separate the spatial domain into areas of high and low density of points. Let xi be a randomly-chosen data point from X and U a randomly-selected location in the study region. The AUC is the probability that Z(xi ) > Z(U ) assuming high=TRUE. That is, AUC is the probability that a randomly-selected data point has a higher value of the covariate Z than does a randomlyselected spatial location. The AUC is a number between 0 and 1. A value of 0.5 indicates a complete lack of discriminatory power. For a fitted point process model X, the AUC measures the ability of the fitted model intensity to separate the spatial domain into areas of high and low density of points. Suppose λ(u) is the 138 BadGey intensity function of the model. The AUC is the probability that λ(xi ) > λ(U ). That is, AUC is the probability that a randomly-selected data point has higher predicted intensity than does a randomlyselected spatial location. The AUC is not a measure of the goodness-of-fit of the model (Lobo et al, 2007). Value Numeric. For auc.ppp and auc.lpp, the result is a single number giving the AUC value. For auc.ppm, auc.kppm and auc.lppm, the result is a numeric vector of length 2 giving the AUC value and the theoretically expected AUC value for this model. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . References Lobo, J.M., Jiménez-Valverde, A. and Real, R. (2007) AUC: a misleading measure of the performance of predictive distribution models. Global Ecology and Biogeography 17(2) 145–151. Nam, B.-H. and D’Agostino, R. (2002) Discrimination index, the area under the ROC curve. Pages 267–279 in Huber-Carol, C., Balakrishnan, N., Nikulin, M.S. and Mesbah, M., Goodness-of-fit tests and model validity, Birkhäuser, Basel. See Also roc Examples fit <- ppm(swedishpines ~ x+y) auc(fit) auc(swedishpines, "x") BadGey Hybrid Geyer Point Process Model Description Creates an instance of the Baddeley-Geyer point process model, defined as a hybrid of several Geyer interactions. The model can then be fitted to point pattern data. Usage BadGey(r, sat) Arguments r vector of interaction radii sat vector of saturation parameters, or a single common value of saturation parameter BadGey 139 Details This is Baddeley’s generalisation of the Geyer saturation point process model, described in Geyer, to a process with multiple interaction distances. The BadGey point process with interaction radii r1 , . . . , rk , saturation thresholds s1 , . . . , sk , intensity parameter β and interaction parameters γ1 , . . . , gammak , is the point process in which each point xi in the pattern X contributes a factor v (xi ,X) βγ1 1 v (xi ,X) . . . gammakk to the probability density of the point pattern, where vj (xi , X) = min(sj , tj (xi , X)) where tj (xi , X) denotes the number of points in the pattern X which lie within a distance rj from the point xi . BadGey is used to fit this model to data. The function ppm(), which fits point process models to point pattern data, requires an argument of class "interact" describing the interpoint interaction structure of the model to be fitted. The appropriate description of the piecewise constant Saturated pairwise interaction is yielded by the function BadGey(). See the examples below. The argument r specifies the vector of interaction distances. The entries of r must be strictly increasing, positive numbers. The argument sat specifies the vector of saturation parameters that are applied to the point counts tj (xi , X). It should be a vector of the same length as r, and its entries should be nonnegative numbers. Thus sat[1] is applied to the count of points within a distance r[1], and sat[2] to the count of points within a distance r[2], etc. Alternatively sat may be a single number, and this saturation value will be applied to every count. Infinite values of the saturation parameters are also permitted; in this case vj (xi , X) = tj (xi , X) and there is effectively no ‘saturation’ for the distance range in question. If all the saturation parameters are set to Inf then the model is effectively a pairwise interaction process, equivalent to PairPiece (however the interaction parameters γ obtained from BadGey have a complicated relationship to the interaction parameters γ obtained from PairPiece). If r is a single number, this model is virtually equivalent to the Geyer process, see Geyer. Value An object of class "interact" describing the interpoint interaction structure of a point process. Author(s) Adrian Baddeley and Rolf Turner in collaboration with Hao Wang and Jeff Picka See Also ppm, pairsat.family, Geyer, PairPiece, SatPiece Examples BadGey(c(0.1,0.2), c(1,1)) # prints a sensible description of itself BadGey(c(0.1,0.2), 1) data(cells) 140 bc.ppm # fit a stationary Baddeley-Geyer model ppm(cells, ~1, BadGey(c(0.07, 0.1, 0.13), 2)) # nonstationary process with log-cubic polynomial trend ## Not run: ppm(cells, ~polynom(x,y,3), BadGey(c(0.07, 0.1, 0.13), 2)) ## End(Not run) bc.ppm Bias Correction for Fitted Model Description Applies a first-order bias correction to a fitted model. Usage bc(fit, ...) ## S3 method for class 'ppm' bc(fit, ..., nfine = 256) Arguments fit A fitted point process model (object of class "ppm") or a model of some other class. ... Additional arguments are currently ignored. nfine Grid dimensions for fine grid of locations. An integer, or a pair of integers. See Details. Details This command applies the first order Newton-Raphson bias correction method of Baddeley and Turner (2014, sec 4.2) to a fitted model. The function bc is generic, with a method for fitted point process models of class "ppm". A fine grid of locations, of dimensions nfine * nfine or nfine[2] * nfine[1], is created over the original window of the data, and the intensity or conditional intensity of the fitted model is calculated on this grid. The result is used to update the fitted model parameters once by a NewtonRaphson update. This is only useful if the quadrature points used to fit the original model fit are coarser than the grid of points specified by nfine. Value A numeric vector, of the same length as coef(fit), giving updated values for the fitted model coefficients. Author(s) Adrian Baddeley and Rolf Turner . bdist.pixels 141 References Baddeley, A. and Turner, R. (2014) Bias correction for parameter estimates of spatial point process models. Journal of Statistical Computation and Simulation 84, 1621–1643. DOI: 10.1080/00949655.2012.755976 See Also rex Examples fit <- ppm(cells ~ x, Strauss(0.07)) coef(fit) if(!interactive()) { bc(fit, nfine=64) } else { bc(fit) } bdist.pixels Distance to Boundary of Window Description Computes the distances from each pixel in a window to the boundary of the window. Usage bdist.pixels(w, ..., style="image", method=c("C", "interpreted")) Arguments w A window (object of class "owin"). ... Arguments passed to as.mask to determine the pixel resolution. style Character string determining the format of the output: either "matrix", "coords" or "image". method Choice of algorithm to use when w is polygonal. Details This function computes, for each pixel u in the window w, the shortest distance d(u, W c ) from u to the boundary of W . If the window is a binary mask then the distance from each pixel to the boundary is computed using the distance transform algorithm distmap.owin. The result is equivalent to distmap(W, invert=TRUE). If the window is a rectangle or a polygonal region, the grid of pixels is determined by the arguments "..." passed to as.mask. The distance from each pixel to the boundary is calculated exactly, using analytic geometry. This is slower but more accurate than in the case of a binary mask. For software testing purposes, there are two implementations available when w is a polygon: the default is method="C" which is much faster than method="interpreted". 142 bdist.points Value If style="image", a pixel image (object of class "im") containing the distances from each pixel in the image raster to the boundary of the window. If style="matrix", a matrix giving the distances from each pixel in the image raster to the boundary of the window. Rows of this matrix correspond to the y coordinate and columns to the x coordinate. If style="coords", a list with three components x,y,z, where x,y are vectors of length m, n giving the x and y coordinates respectively, and z is an m × n matrix such that z[i,j] is the distance from (x[i],y[j]) to the boundary of the window. Rows of this matrix correspond to the x coordinate and columns to the y coordinate. This result can be plotted with persp, image or contour. Author(s) Adrian Baddeley and Rolf Turner See Also owin.object, erosion, bdist.points, bdist.tiles, distmap.owin. Examples u <- owin(c(0,1),c(0,1)) d <- bdist.pixels(u, eps=0.01) image(d) d <- bdist.pixels(u, eps=0.01, style="matrix") mean(d >= 0.1) # value is approx (1 - 2 * 0.1)^2 = 0.64 bdist.points Distance to Boundary of Window Description Computes the distances from each point of a point pattern to the boundary of the window. Usage bdist.points(X) Arguments X A point pattern (object of class "ppp"). Details This function computes, for each point xi in the point pattern X, the shortest distance d(xi , W c ) from xi to the boundary of the window W of observation. If the window Window(X) is of type "rectangle" or "polygonal", then these distances are computed by analytic geometry and are exact, up to rounding errors. If the window is of type "mask" then the distances are computed using the real-valued distance transform, which is an approximation with maximum error equal to the width of one pixel in the mask. bdist.tiles 143 Value A numeric vector, giving the distances from each point of the pattern to the boundary of the window. Author(s) Adrian Baddeley and Rolf Turner See Also bdist.pixels, bdist.tiles, ppp.object, erosion Examples data(cells) d <- bdist.points(cells) bdist.tiles Distance to Boundary of Window Description Computes the shortest distances from each tile in a tessellation to the boundary of the window. Usage bdist.tiles(X) Arguments X A tessellation (object of class "tess"). Details This function computes, for each tile si in the tessellation X, the shortest distance from si to the boundary of the window W containing the tessellation. Value A numeric vector, giving the shortest distance from each tile in the tessellation to the boundary of the window. Entries of the vector correspond to the entries of tiles(X). Author(s) Adrian Baddeley and Rolf Turner See Also tess, bdist.points, bdist.pixels 144 beachcolours Examples P <- runifpoint(15) X <- dirichlet(P) plot(X, col="red") B <- bdist.tiles(X) # identify tiles that do not touch the boundary plot(X[B > 0], add=TRUE, col="green", lwd=3) beachcolours Create Colour Scheme for a Range of Numbers Description Given a range of numerical values, this command creates a colour scheme that would be appropriate if the numbers were altitudes (elevation above or below sea level). Usage beachcolours(range, sealevel = 0, monochrome = FALSE, ncolours = if (monochrome) 16 else 64, nbeach = 1) beachcolourmap(range, ...) Arguments range Range of numerical values to be mapped. A numeric vector of length 2. sealevel Value that should be treated as zero. A single number, lying between range[1] and range[2]. monochrome Logical. If TRUE then a greyscale colour map is constructed. ncolours Number of distinct colours to use. nbeach Number of colours that will be yellow. ... Arguments passed to beachcolours. Details Given a range of numerical values, these commands create a colour scheme that would be appropriate if the numbers were altitudes (elevation above or below sea level). Numerical values close to zero are portrayed in green (representing the waterline). Negative values are blue (representing water) and positive values are yellow to red (representing land). At least, these are the colours of land and sea in Western Australia. This colour scheme was proposed by Baddeley et al (2005). The function beachcolours returns these colours as a character vector, while beachcolourmap returns a colourmap object. The argument range should be a numeric vector of length 2 giving a range of numerical values. The argument sealevel specifies the height value that will be treated as zero, and mapped to the colour green. A vector of ncolours colours will be created, of which nbeach colours will be green. The argument monochrome is included for convenience when preparing publications. If monochrome=TRUE the colour map will be a simple grey scale containing ncolours shades from black to white. beginner 145 Value For beachcolours, a character vector of length ncolours specifying colour values. For beachcolourmap, a colour map (object of class "colourmap"). Author(s) Adrian Baddeley and Rolf Turner References Baddeley, A., Turner, R., Møller, J. and Hazelton, M. (2005) Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67, 617–666. See Also colourmap, colourtools. Examples plot(beachcolourmap(c(-2,2))) beginner Print Introduction For Beginners Description Prints an introduction for beginners to the spatstat package, or another specified package. Usage beginner(package = "spatstat") Arguments package Name of package. Details This function prints an introduction for beginners to the spatstat package. The function can be executed simply by typing beginner without parentheses. If the argument package is given, then the function prints the beginner’s help file BEGINNER.txt from the specified package (if it has one). Value Null. Author(s) Adrian Baddeley and Rolf Turner 146 begins See Also latest.news Examples beginner begins Check Start of Character String Description Checks whether a character string begins with a particular prefix. Usage begins(x, firstbit) Arguments x Character string, or vector of character strings, to be tested. firstbit A single character string. Details This simple wrapper function checks whether (each entry in) x begins with the string firstbit, and returns a logical value or logical vector with one entry for each entry of x. This function is useful mainly for reducing complexity in model formulae. Value Logical vector of the same length as x. Author(s) Adrian Baddeley Rolf Turner and Ege Rubak Examples begins(c("Hello", "Goodbye"), "Hell") begins("anything", "") berman.test 147 berman.test Berman’s Tests for Point Process Model Description Tests the goodness-of-fit of a Poisson point process model using methods of Berman (1986). Usage berman.test(...) ## S3 method for class 'ppp' berman.test(X, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...) ## S3 method for class 'ppm' berman.test(model, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...) ## S3 method for class 'lpp' berman.test(X, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...) ## S3 method for class 'lppm' berman.test(model, covariate, which = c("Z1", "Z2"), alternative = c("two.sided", "less", "greater"), ...) Arguments X A point pattern (object of class "ppp" or "lpp"). model A fitted point process model (object of class "ppm" or "lppm"). covariate The spatial covariate on which the test will be based. An image (object of class "im") or a function. which Character string specifying the choice of test. alternative Character string specifying the alternative hypothesis. ... Additional arguments controlling the pixel resolution (arguments dimyx and eps passed to as.mask) or other undocumented features. Details These functions perform a goodness-of-fit test of a Poisson point process model fitted to point pattern data. The observed distribution of the values of a spatial covariate at the data points, and the predicted distribution of the same values under the model, are compared using either of two test statistics Z1 and Z2 proposed by Berman (1986). The Z1 test is also known as the Lawson-Waller test. 148 berman.test The function berman.test is generic, with methods for point patterns ("ppp" or "lpp") and point process models ("ppm" or "lppm"). • If X is a point pattern dataset (object of class "ppp" or "lpp"), then berman.test(X, ...) performs a goodness-of-fit test of the uniform Poisson point process (Complete Spatial Randomness, CSR) for this dataset. • If model is a fitted point process model (object of class "ppm" or "lppm") then berman.test(model, ...) performs a test of goodness-of-fit for this fitted model. In this case, model should be a Poisson point process. The test is performed by comparing the observed distribution of the values of a spatial covariate at the data points, and the predicted distribution of the same covariate under the model. Thus, you must nominate a spatial covariate for this test. The argument covariate should be either a function(x,y) or a pixel image (object of class "im" containing the values of a spatial function. If covariate is an image, it should have numeric values, and its domain should cover the observation window of the model. If covariate is a function, it should expect two arguments x and y which are vectors of coordinates, and it should return a numeric vector of the same length as x and y. First the original data point pattern is extracted from model. The values of the covariate at these data points are collected. Next the values of the covariate at all locations in the observation window are evaluated. The point process intensity of the fitted model is also evaluated at all locations in the window. • If which="Z1", the test statistic Z1 is computed as follows. The sum S of the covariate values at all data points is evaluated. The predicted mean µ and variance σ 2 of S are computed from the values of the covariate at all locations in the window. Then we compute Z1 = (S − µ)/σ. Closely-related tests were proposed independently by Waller et al (1993) and Lawson (1993) so this test is often termed the Lawson-Waller test in epidemiological literature. • If which="Z2", the test statistic Z2 is computed as follows. The values of the covariate at all locations in the observation window, weighted by the point process intensity, are compiled into a cumulative distribution function F . The probability integral transformation is then applied: the values of the covariate at the original data points are transformed by the predicted cumulative distribution function F into numbers between 0 and 1. If the model is correct, these numbers are i.i.d. uniform random numbers. The standardised sample mean of these numbers is the statistic Z2 . In both cases the null distribution of the test statistic is the standard normal distribution, approximately. The return value is an object of class "htest" containing the results of the hypothesis test. The print method for this class gives an informative summary of the test outcome. Value An object of class "htest" (hypothesis test) and also of class "bermantest", containing the results of the test. The return value can be plotted (by plot.bermantest) or printed to give an informative summary of the test. Warning The meaning of a one-sided test must be carefully scrutinised: see the printed output. bind.fv 149 Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . References Berman, M. (1986) Testing for spatial association between a point process and another stochastic process. Applied Statistics 35, 54–62. Lawson, A.B. (1993) On the analysis of mortality events around a prespecified fixed point. Journal of the Royal Statistical Society, Series A 156 (3) 363–377. Waller, L., Turnbull, B., Clark, L.C. and Nasca, P. (1992) Chronic Disease Surveillance and testing of clustering of disease and exposure: Application to leukaemia incidence and TCE-contaminated dumpsites in upstate New York. Environmetrics 3, 281–300. See Also cdf.test, quadrat.test, ppm Examples # Berman's data data(copper) X <- copper$SouthPoints L <- copper$SouthLines D <- distmap(L, eps=1) # test of CSR berman.test(X, D) berman.test(X, D, "Z2") bind.fv Combine Function Value Tables Description Advanced Use Only. Combine objects of class "fv", or glue extra columns of data onto an existing "fv" object. Usage ## S3 method for class 'fv' cbind(...) bind.fv(x, y, labl = NULL, desc = NULL, preferred = NULL, clip=FALSE) Arguments ... Any number of arguments, which are objects of class "fv". x An object of class "fv". y Either a data frame or an object of class "fv". labl Plot labels (see fv) for columns of y. A character vector. 150 bind.fv desc Descriptions (see fv) for columns of y. A character vector. preferred Character string specifying the column which is to be the new recommended value of the function. clip Logical value indicating whether each object must have exactly the same domain, that is, the same sequence of values of the function argument (clip=FALSE, the default) or whether objects with different domains are permissible and will be restricted to a common domain (clip=TRUE). Details This documentation is provided for experienced programmers who want to modify the internal behaviour of spatstat. The function cbind.fv is a method for the generic R function cbind. It combines any number of objects of class "fv" into a single object of class "fv". The objects must be compatible, in the sense that they have identical values of the function argument. The function bind.fv is a lower level utility which glues additional columns onto an existing object x of class "fv". It has two modes of use: • If the additional dataset y is an object of class "fv", then x and y must be compatible as described above. Then the columns of y that contain function values will be appended to the object x. • Alternatively if y is a data frame, then y must have the same number of rows as x. All columns of y will be appended to x. The arguments labl and desc provide plot labels and description strings (as described in fv) for the new columns. If y is an object of class "fv" then labl and desc are optional, and default to the relevant entries in the object y. If y is a data frame then labl and desc must be provided. Value An object of class "fv". Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also fv, with.fv. Undocumented functions for modifying an "fv" object include fvnames, fvnames<-, tweak.fv.entry and rebadge.fv. Examples data(cells) K1 <- Kest(cells, correction="border") K2 <- Kest(cells, correction="iso") # remove column 'theo' to avoid duplication K2 <- K2[, names(K2) != "theo"] cbind(K1, K2) bits.test 151 bind.fv(K1, K2, preferred="iso") # constrain border estimate to be monotonically increasing bm <- cumsum(c(0, pmax(0, diff(K1$border)))) bind.fv(K1, data.frame(bmono=bm), "%s[bmo](r)", "monotone border-corrected estimate of %s", "bmono") bits.test Balanced Independent Two-Stage Monte Carlo Test Description Performs a Balanced Independent Two-Stage Monte Carlo test of goodness-of-fit for spatial pattern. Usage bits.test(X, ..., exponent = 2, nsim=19, alternative=c("two.sided", "less", "greater"), leaveout=1, interpolate = FALSE, savefuns=FALSE, savepatterns=FALSE, verbose = TRUE) Arguments X Either a point pattern dataset (object of class "ppp", "lpp" or "pp3") or a fitted point process model (object of class "ppm", "kppm", "lppm" or "slrm"). ... Arguments passed to dclf.test or mad.test or envelope to control the conduct of the test. Useful arguments include fun to determine the summary function, rinterval to determine the range of r values used in the test, and use.theory described under Details. exponent Exponent used in the test statistic. Use exponent=2 for the Diggle-CressieLoosmore-Ford test, and exponent=Inf for the Maximum Absolute Deviation test. nsim Number of replicates in each stage of the test. A total of nsim * (nsim + 1) simulated point patterns will be generated, and the p-value will be a multiple of 1/(nsim+1). alternative Character string specifying the alternative hypothesis. The default (alternative="two.sided") is that the true value of the summary function is not equal to the theoretical value postulated under the null hypothesis. If alternative="less" the alternative hypothesis is that the true value of the summary function is lower than the theoretical value. leaveout Optional integer 0, 1 or 2 indicating how to calculate the deviation between the observed summary function and the nominal reference value, when the reference value must be estimated by simulation. See Details. interpolate Logical value indicating whether to interpolate the distribution of the test statistic by kernel smoothing, as described in Dao and Genton (2014, Section 5). 152 bits.test savefuns Logical flag indicating whether to save the simulated function values (from the first stage). savepatterns Logical flag indicating whether to save the simulated point patterns (from the first stage). verbose Logical value indicating whether to print progress reports. Details Performs the Balanced Independent Two-Stage Monte Carlo test proposed by Baddeley et al (2017), an improvement of the Dao-Genton (2014) test. If X is a point pattern, the null hypothesis is CSR. If X is a fitted model, the null hypothesis is that model. The argument use.theory passed to envelope determines whether to compare the summary function for the data to its theoretical value for CSR (use.theory=TRUE) or to the sample mean of simulations from CSR (use.theory=FALSE). The argument leaveout specifies how to calculate the discrepancy between the summary function for the data and the nominal reference value, when the reference value must be estimated by simulation. The values leaveout=0 and leaveout=1 are both algebraically equivalent (Baddeley et al, 2014, Appendix) to computing the difference observed - reference where the reference is the mean of simulated values. The value leaveout=2 gives the leave-two-out discrepancy proposed by Dao and Genton (2014). Value A hypothesis test (object of class "htest" which can be printed to show the outcome of the test. Author(s) Adrian Baddeley, Andrew Hardegen, Tom Lawrence, Robin Milne, Gopalan Nair and Suman Rakshit. Implemented by Adrian Baddeley , Rolf Turner . References Dao, N.A. and Genton, M. (2014) A Monte Carlo adjusted goodness-of-fit test for parametric models describing spatial point patterns. Journal of Graphical and Computational Statistics 23, 497– 517. Baddeley, A., Diggle, P.J., Hardegen, A., Lawrence, T., Milne, R.K. and Nair, G. (2014) On tests of spatial pattern based on simulation envelopes. Ecological Monographs 84 (3) 477–489. Baddeley, A., Hardegen, A., Lawrence, L., Milne, R.K., Nair, G.M. and Rakshit, S. (2017) On twostage Monte Carlo tests of composite hypotheses. Computational Statistics and Data Analysis, in press. See Also dg.test, dclf.test, mad.test blur 153 Examples ns <- if(interactive()) 19 else 4 bits.test(cells, nsim=ns) bits.test(cells, alternative="less", nsim=ns) bits.test(cells, nsim=ns, interpolate=TRUE) blur Apply Gaussian Blur to a Pixel Image Description Applies a Gaussian blur to a pixel image. Usage blur(x, sigma = NULL, ..., normalise=FALSE, bleed = TRUE, varcov=NULL) ## S3 method for class 'im' Smooth(X, sigma = NULL, ..., normalise=FALSE, bleed = TRUE, varcov=NULL) Arguments x,X The pixel image. An object of class "im". sigma Standard deviation of isotropic Gaussian smoothing kernel. ... Ignored. normalise Logical flag indicating whether the output values should be divided by the corresponding blurred image of the window itself. See Details. bleed Logical flag indicating whether to allow blur to extend outside the original domain of the image. See Details. varcov Variance-covariance matrix of anisotropic Gaussian kernel. Incompatible with sigma. Details This command applies a Gaussian blur to the pixel image x. Smooth.im is a method for the generic Smooth for pixel images. It is currently identical to blur, apart from the name of the first argument. The blurring kernel is the isotropic Gaussian kernel with standard deviation sigma, or the anisotropic Gaussian kernel with variance-covariance matrix varcov. The arguments sigma and varcov are incompatible. Also sigma may be a vector of length 2 giving the standard deviations of two independent Gaussian coordinates, thus equivalent to varcov = diag(sigma^2). If the pixel values of x include some NA values (meaning that the image domain does not completely fill the rectangular frame) then these NA values are first reset to zero. The algorithm then computes the convolution x ∗ G of the (zero-padded) pixel image x with the specified Gaussian kernel G. If normalise=FALSE, then this convolution x ∗ G is returned. If normalise=TRUE, then the convolution x ∗ G is normalised by dividing it by the convolution w ∗ G of the image domain w with 154 border the same Gaussian kernel. Normalisation ensures that the result can be interpreted as a weighted average of input pixel values, without edge effects due to the shape of the domain. If bleed=FALSE, then pixel values outside the original image domain are set to NA. Thus the output is a pixel image with the same domain as the input. If bleed=TRUE, then no such alteration is performed, and the result is a pixel image defined everywhere in the rectangular frame containing the input image. Computation is performed using the Fast Fourier Transform. Value A pixel image with the same pixel array as the input image x. Author(s) Adrian Baddeley and Rolf Turner See Also interp.im for interpolating a pixel image to a finer resolution, density.ppp for blurring a point pattern, Smooth.ppp for interpolating marks attached to points. Examples data(letterR) Z <- as.im(function(x,y) { 4 * x^2 + 3 * y }, letterR) par(mfrow=c(1,3)) plot(Z) plot(letterR, add=TRUE) plot(blur(Z, 0.3, bleed=TRUE)) plot(letterR, add=TRUE) plot(blur(Z, 0.3, bleed=FALSE)) plot(letterR, add=TRUE) par(mfrow=c(1,1)) border Border Region of a Window Description Computes the border region of a window, that is, the region lying within a specified distance of the boundary of a window. Usage border(w, r, outside=FALSE, ...) border 155 Arguments w A window (object of class "owin") or something acceptable to as.owin. r Numerical value. outside Logical value determining whether to compute the border outside or inside w. ... Optional arguments passed to erosion (if outside=FALSE) or to dilation (if outside=TRUE). Details By default (if outside=FALSE), the border region is the subset of w lying within a distance r of the boundary of w. It is computed by eroding w by the distance r (using erosion) and subtracting this eroded window from the original window w. If outside=TRUE, the border region is the set of locations outside w lying within a distance r of w. It is computed by dilating w by the distance r (using dilation) and subtracting the original window w from the dilated window. Value A window (object of class "owin"). Author(s) Adrian Baddeley and Rolf Turner See Also erosion, dilation Examples # rectangle u <- unit.square() border(u, 0.1) border(u, 0.1, outside=TRUE) # polygon data(letterR) plot(letterR) plot(border(letterR, 0.1), add=TRUE) plot(border(letterR, 0.1, outside=TRUE), add=TRUE) 156 bounding.box.xy bounding.box.xy Convex Hull of Points Description Computes the smallest rectangle containing a set of points. Usage bounding.box.xy(x, y=NULL) Arguments x vector of x coordinates of observed points, or a 2-column matrix giving x,y coordinates, or a list with components x,y giving coordinates (such as a point pattern object of class "ppp".) y (optional) vector of y coordinates of observed points, if x is a vector. Details Given an observed pattern of points with coordinates given by x and y, this function finds the smallest rectangle, with sides parallel to the coordinate axes, that contains all the points, and returns it as a window. Value A window (an object of class "owin"). Author(s) Adrian Baddeley and Rolf Turner See Also owin, as.owin, convexhull.xy, ripras Examples x <- runif(30) y <- runif(30) w <- bounding.box.xy(x,y) plot(owin(), main="bounding.box.xy(x,y)") plot(w, add=TRUE) points(x,y) X <- rpoispp(30) plot(X, main="bounding.box.xy(X)") plot(bounding.box.xy(X), add=TRUE) boundingbox 157 boundingbox Bounding Box of a Window, Image, or Point Pattern Description Find the smallest rectangle containing a given window(s), image(s) or point pattern(s). Usage boundingbox(...) ## Default S3 method: boundingbox(...) ## S3 method for class 'im' boundingbox(...) ## S3 method for class 'owin' boundingbox(...) ## S3 method for class 'ppp' boundingbox(...) ## S3 method for class 'psp' boundingbox(...) ## S3 method for class 'lpp' boundingbox(...) ## S3 method for class 'linnet' boundingbox(...) ## S3 method for class 'solist' boundingbox(...) Arguments ... One or more windows (objects of class "owin"), pixel images (objects of class "im") or point patterns (objects of class "ppp" or "lpp") or line segment patterns (objects of class "psp") or linear networks (objects of class "linnet") or any combination of such objects. Alternatively, the argument may be a list of such objects, of class "solist". Details This function finds the smallest rectangle (with sides parallel to the coordinate axes) that contains all the given objects. For a window (object of class "owin"), the bounding box is the smallest rectangle that contains all the vertices of the window (this is generally smaller than the enclosing frame, which is returned by as.rectangle). 158 boundingcircle For a point pattern (object of class "ppp" or "lpp"), the bounding box is the smallest rectangle that contains all the points of the pattern. This is usually smaller than the bounding box of the window of the point pattern. For a line segment pattern (object of class "psp") or a linear network (object of class "linnet"), the bounding box is the smallest rectangle that contains all endpoints of line segments. For a pixel image (object of class "im"), the image will be converted to a window using as.owin, and the bounding box of this window is obtained. If the argument is a list of several objects, then this function finds the smallest rectangle that contains all the bounding boxes of the objects. Value owin, as.owin, as.rectangle Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . Examples w <- owin(c(0,10),c(0,10), poly=list(x=c(1,2,3,2,1), y=c(2,3,4,6,7))) r <- boundingbox(w) # returns rectangle [1,3] x [2,7] w2 <- unit.square() r <- boundingbox(w, w2) # returns rectangle [0,3] x [0,7] boundingcircle Smallest Enclosing Circle Description Find the smallest circle enclosing a spatial window or other object. Return its radius, or the location of its centre, or the circle itself. Usage boundingradius(x, ...) boundingcentre(x, ...) boundingcircle(x, ...) ## S3 method for class 'owin' boundingradius(x, ...) ## S3 method for class 'owin' boundingcentre(x, ...) boundingcircle 159 ## S3 method for class 'owin' boundingcircle(x, ...) ## S3 method for class 'ppp' boundingradius(x, ...) ## S3 method for class 'ppp' boundingcentre(x, ...) ## S3 method for class 'ppp' boundingcircle(x, ...) Arguments x A window (object of class "owin"), or another spatial object. ... Arguments passed to as.mask to determine the pixel resolution for the calculation. Details The boundingcircle of a spatial region W is the smallest circle that contains W . The boundingradius is the radius of this circle, and the boundingcentre is the centre of the circle. The functions boundingcircle, boundingcentre and boundingradius are generic. There are methods for objects of class "owin", "ppp" and "linnet". Value The result of boundingradius is a single numeric value. The result of boundingcentre is a point pattern containing a single point. The result of boundingcircle is a window representing the boundingcircle. Author(s) Adrian Baddeley See Also boundingradius.linnet Examples boundingradius(letterR) plot(grow.rectangle(Frame(letterR), 0.2), main="", type="n") plot(letterR, add=TRUE, col="grey") plot(boundingcircle(letterR), add=TRUE, border="green", lwd=2) plot(boundingcentre(letterR), pch="+", cex=2, col="blue", add=TRUE) X <- runifpoint(5) plot(X) plot(boundingcircle(X), add=TRUE) plot(boundingcentre(X), pch="+", cex=2, col="blue", add=TRUE) 160 box3 box3 Three-Dimensional Box Description Creates an object representing a three-dimensional box. Usage box3(xrange = c(0, 1), yrange = xrange, zrange = yrange, unitname = NULL) Arguments xrange, yrange, zrange Dimensions of the box in the x, y, z directions. Each of these arguments should be a numeric vector of length 2. unitname Optional. Name of the unit of length. See Details. Details This function creates an object representing a three-dimensional rectangular parallelepiped (box) with sides parallel to the coordinate axes. The object can be used to specify the domain of a three-dimensional point pattern (see pp3) and in various geometrical calculations (see volume.box3, diameter.box3, eroded.volumes). The optional argument unitname specifies the name of the unit of length. See unitname for valid formats. The function as.box3 can be used to convert other kinds of data to this format. Value An object of class "box3". There is a print method for this class. Author(s) Adrian Baddeley and Rolf Turner See Also as.box3, pp3, volume.box3, diameter.box3, eroded.volumes. Examples box3() box3(c(0,10),c(0,10),c(0,5), unitname=c("metre","metres")) box3(c(-1,1)) boxx 161 boxx Multi-Dimensional Box Description Creates an object representing a multi-dimensional box. Usage boxx(..., unitname = NULL) Arguments ... Dimensions of the box. Vectors of length 2. unitname Optional. Name of the unit of length. See Details. Details This function creates an object representing a multi-dimensional rectangular parallelepiped (box) with sides parallel to the coordinate axes. The object can be used to specify the domain of a multi-dimensional point pattern (see ppx) and in various geometrical calculations (see volume.boxx, diameter.boxx, eroded.volumes). The optional argument unitname specifies the name of the unit of length. See unitname for valid formats. Value An object of class "boxx". There is a print method for this class. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also ppx, volume.boxx, diameter.boxx, eroded.volumes.boxx. Examples boxx(c(0,10),c(0,10),c(0,5),c(0,1), unitname=c("metre","metres")) 162 branchlabelfun branchlabelfun Tree Branch Membership Labelling Function Description Creates a function which returns the tree branch membership label for any location on a linear network. Usage branchlabelfun(L, root = 1) Arguments L Linear network (object of class "linnet"). The network must have no loops. root Root of the tree. An integer index identifying which point in vertices(L) is the root of the tree. Details The linear network L must be an acyclic graph (i.e. must not contain any loops) so that it can be interpreted as a tree. The result of f <- branchlabelfun(L, root) is a function f which gives, for each location on the linear network L, the tree branch label at that location. Tree branch labels are explained in treebranchlabels. The result f also belongs to the class "linfun". It can be called using several different kinds of data, as explained in the help for linfun. The values of the function are character strings. Value A function (of class "linfun"). Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also treebranchlabels, linfun Examples # make a simple tree m <- simplenet$m m[8,10] <- m[10,8] <- FALSE L <- linnet(vertices(simplenet), m) # make function f <- branchlabelfun(L, 1) plot(f) bugfixes 163 X <- runiflpp(5, L) f(X) bugfixes List Recent Bug Fixes Description List all bug fixes in a package, starting from a certain date or version of the package. Fixes are sorted alphabetically by the name of the affected function. The default is to list bug fixes in the latest version of the spatstat package. Usage bugfixes(sinceversion = NULL, sincedate = NULL, package = "spatstat", show = TRUE) Arguments sinceversion Earliest version of package for which bugs should be listed. The default is the current installed version. sincedate Earliest release date of package for which bugs should be listed. A character string or a date-time object. package Character string. The name of the package for which bugs are to be listed. show Logical value indicating whether to display the bug table on the terminal. Details Bug reports are extracted from the NEWS file of the specified package. Only those after a specified date, or after a specified version of the package, are retained. The bug reports are then sorted alphabetically, so that all bugs affecting a particular function are listed consecutively. Finally the table of bug reports is displayed (if show=TRUE) and returned invisibly. The argument sinceversion should be a character string like "1.2-3". The default is the current installed version of the package. The argument sincedata should be a character string like "2015-05-27", or a date-time object. Typing bugfixes without parentheses will display a table of all bug fixes in the current installed version of spatstat. Value A data frame, belonging to the class "bugtable", which has its own print method. Author(s) Adrian Baddeley . See Also latest.news, news. 164 bw.diggle Examples # show all bugs reported after publication of the spatstat book if(interactive()) bugfixes("1.42-0") bw.diggle Cross Validated Bandwidth Selection for Kernel Density Description Uses cross-validation to select a smoothing bandwidth for the kernel estimation of point process intensity. Usage bw.diggle(X, ..., correction="good", hmax=NULL, nr=512) Arguments X A point pattern (object of class "ppp"). ... Ignored. correction Character string passed to Kest determining the edge correction to be used to calculate the K function. hmax Numeric. Maximum value of bandwidth that should be considered. nr Integer. Number of steps in the distance value r to use in computing numerical integrals. Details This function selects an appropriate bandwidth sigma for the kernel estimator of point process intensity computed by density.ppp. The bandwidth σ is chosen to minimise the mean-square error criterion defined by Diggle (1985). The algorithm uses the method of Berman and Diggle (1989) to compute the quantity M (σ) = MSE(σ) − g(0) λ2 as a function of bandwidth σ, where MSE(σ) is the mean squared error at bandwidth σ, while λ is the mean intensity, and g is the pair correlation function. See Diggle (2003, pages 115-118) for a summary of this method. The result is a numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted to show the (rescaled) mean-square error as a function of sigma. Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted. bw.frac 165 Definition of bandwidth The smoothing parameter sigma returned by bw.diggle (and displayed on the horizontal axis of the plot) corresponds to h/2, where h is the smoothing parameter described in Diggle (2003, pages 116-118) and Berman and Diggle (1989). In those references, the smoothing kernel is the uniform density on the disc of radius h. In density.ppp, the smoothing kernel is the isotropic Gaussian density with standard deviation sigma. When replacing one kernel by another, the usual practice is to adjust the bandwidths so that the kernels have equal variance (cf. Diggle 2003, page 118). This implies that sigma = h/2. Author(s) Adrian Baddeley and Rolf Turner References Berman, M. and Diggle, P. (1989) Estimating weighted integrals of the second-order intensity of a spatial point process. Journal of the Royal Statistical Society, series B 51, 81–92. Diggle, P.J. (1985) A kernel method for smoothing point process data. Applied Statistics (Journal of the Royal Statistical Society, Series C) 34 (1985) 138–147. Diggle, P.J. (2003) Statistical analysis of spatial point patterns, Second edition. Arnold. See Also density.ppp, bw.ppl, bw.scott Examples data(lansing) attach(split(lansing)) b <- bw.diggle(hickory) plot(b, ylim=c(-2, 0), main="Cross validation for hickories") plot(density(hickory, b)) bw.frac Bandwidth Selection Based on Window Geometry Description Select a smoothing bandwidth for smoothing a point pattern, based only on the geometry of the spatial window. The bandwidth is a specified quantile of the distance between two independent random points in the window. Usage bw.frac(X, ..., f=1/4) 166 bw.pcf Arguments X A window (object of class "owin") or point pattern (object of class "ppp") or other data which can be converted to a window using as.owin. ... Arguments passed to distcdf. f Probability value (between 0 and 1) determining the quantile of the distribution. Details This function selects an appropriate bandwidth sigma for the kernel estimator of point process intensity computed by density.ppp. The bandwidth σ is computed as a quantile of the distance between two independent random points in the window. The default is the lower quartile of this distribution. If F (r) is the cumulative distribution function of the distance between two independent random points uniformly distributed in the window, then the value returned is the quantile with probability f . That is, the bandwidth is the value r such that F (r) = f . The cumulative distribution function F (r) is computed using distcdf. We then we compute the smallest number r such that F (r) ≥ f . Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.frac" which can be plotted to show the cumulative distribution function and the selected quantile. Author(s) Adrian Baddeley and Rolf Turner See Also density.ppp, bw.diggle, bw.ppl, bw.relrisk, bw.scott, bw.smoothppp, bw.stoyan Examples h <- bw.frac(letterR) h plot(h, main="bw.frac(letterR)") bw.pcf Cross Validated Bandwidth Selection for Pair Correlation Function Description Uses composite likelihood or generalized least squares cross-validation to select a smoothing bandwidth for the kernel estimation of pair correlation function. bw.pcf 167 Usage bw.pcf(X, rmax=NULL, lambda=NULL, divisor="r", kernel="epanechnikov", nr=10000, bias.correct=TRUE, cv.method=c("compLik", "leastSQ"), simple=TRUE, srange=NULL, ..., verbose=FALSE) Arguments X A point pattern (object of class "ppp"). rmax Numeric. Maximum value of the spatial lag distance r for which g(r) should be evaluated. lambda Optional. Values of the estimated intensity function. A vector giving the intensity values at the points of the pattern X. divisor Choice of divisor in the estimation formula: either "r" (the default) or "d". See pcf.ppp. kernel Choice of smoothing kernel, passed to density; see pcf and pcfinhom. nr Integer. Number of subintervals for discretization of [0, rmax] to use in computing numerical integrals. bias.correct Logical. Whether to use bias corrected version of the kernel estimate. See Details. cv.method Choice of cross validation method: either "compLik" or "leastSQ" (partially matched). simple Logical. Whether to use simple removal of spatial lag distances. See Details. srange Optional. Numeric vector of length 2 giving the range of bandwidth values that should be searched to find the optimum bandwidth. ... Other arguments, passed to pcf or pcfinhom. verbose Logical value indicating whether to print progress reports during the optimization procedure. Details This function selects an appropriate bandwidth bw for the kernel estimator of the pair correlation function of a point process intensity computed by pcf.ppp (homogeneous case) or pcfinhom (inhomogeneous case). With cv.method="leastSQ", the bandwidth h is chosen to minimise an unbiased estimate of the integrated mean-square error criterion M (h) defined in equation (4) in Guan (2007a). With cv.method="compLik", the bandwidth h is chosen to maximise a likelihood cross-validation criterion CV (h) defined in equation (6) of Guan (2007b). M (b) = MSE(σ) − g(0) λ2 The result is a numerical value giving the selected bandwidth. Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted. 168 bw.ppl Definition of bandwidth The bandwidth bw returned by bw.pcf corresponds to the standard deviation of the smoothoing kernel. As mentioned in the documentation of density.default and pcf.ppp, this differs from the scale parameter h of the smoothing kernel which is often considered in the literature as the bandwidth of the kernel function. For example for the Epanechnikov kernel, bw=h/sqrt(h). Author(s) Rasmus Waagepetersen and Abdollah Jalilian. Adapted for spatstat by Adrian Baddeley and Ege Rubak . References Guan, Y. (2007a). A composite likelihood cross-validation approach in selecting bandwidth for the estimation of the pair correlation function. Scandinavian Journal of Statistics, 34(2), 336–346. Guan, Y. (2007b). A least-squares cross-validation bandwidth selection approach in pair correlation function estimations. Statistics & Probability Letters, 77(18), 1722–1729. See Also pcf.ppp, pcfinhom Examples b <- bw.pcf(redwood) plot(pcf(redwood, bw=b)) bw.ppl Likelihood Cross Validation Bandwidth Selection for Kernel Density Description Uses likelihood cross-validation to select a smoothing bandwidth for the kernel estimation of point process intensity. Usage bw.ppl(X, ..., srange=NULL, ns=16, sigma=NULL, weights=NULL) Arguments X A point pattern (object of class "ppp"). ... Ignored. srange Optional numeric vector of length 2 giving the range of values of bandwidth to be searched. ns Optional integer giving the number of values of bandwidth to search. sigma Optional. Vector of values of the bandwidth to be searched. Overrides the values of ns and srange. weights Optional. Numeric vector of weights for the points of X. Argument passed to density.ppp. bw.ppl 169 Details This function selects an appropriate bandwidth sigma for the kernel estimator of point process intensity computed by density.ppp. The bandwidth σ is chosen to maximise the point process likelihood cross-validation criterion LCV(σ) = X Z log λ̂−i (xi ) − i λ̂(u) du W where the sum is taken over all the data points xi , where λ̂−i (xi ) is the leave-one-out kernelsmoothing estimate of the intensity at xi with smoothing bandwidth σ, and λ̂(u) is the kernelsmoothing estimate of the intensity at a spatial location u with smoothing bandwidth σ. See Loader(1999, Section 5.3). The value of LCV(σ) is computed directly, using density.ppp, for ns different values of σ between srange[1] and srange[2]. The result is a numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted to show the (rescaled) mean-square error as a function of sigma. Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted. Author(s) Adrian Baddeley and Rolf Turner References Loader, C. (1999) Local Regression and Likelihood. Springer, New York. See Also density.ppp, bw.diggle, bw.scott Examples b <- bw.ppl(redwood) plot(b, main="Likelihood cross validation for redwoods") plot(density(redwood, b)) 170 bw.relrisk bw.relrisk Cross Validated Bandwidth Selection for Relative Risk Estimation Description Uses cross-validation to select a smoothing bandwidth for the estimation of relative risk. Usage bw.relrisk(X, method = "likelihood", nh = spatstat.options("n.bandwidth"), hmin=NULL, hmax=NULL, warn=TRUE) Arguments X A multitype point pattern (object of class "ppp" which has factor valued marks). method Character string determining the cross-validation method. Current options are "likelihood", "leastsquares" or "weightedleastsquares". nh Number of trial values of smoothing bandwith sigma to consider. The default is 32. hmin, hmax Optional. Numeric values. Range of trial values of smoothing bandwith sigma to consider. There is a sensible default. warn Logical. If TRUE, issue a warning if the minimum of the cross-validation criterion occurs at one of the ends of the search interval. Details This function selects an appropriate bandwidth for the nonparametric estimation of relative risk using relrisk. Consider the indicators yij which equal 1 when data point xi belongs to type j, and equal 0 otherwise. For a particular value of smoothing bandwidth, let p̂j (u) be the estimated probabilities that a point at location u will belong to type j. Then the bandwidth is chosen to minimise either the likelihood, the squared error, or the approximately standardised squared error, of the indicators yij relative to the fitted values p̂j (xi ). See Diggle (2003). The result is a numerical value giving the selected bandwidth sigma. The result also belongs to the class "bw.optim" allowing it to be printed and plotted. The plot shows the cross-validation criterion as a function of bandwidth. The range of values for the smoothing bandwidth sigma is set by the arguments hmin, hmax. There is a sensible default, based on multiples of Stoyan’s rule of thumb bw.stoyan. If the optimal bandwidth is achieved at an endpoint of the interval [hmin, hmax], the algorithm will issue a warning (unless warn=FALSE). If this occurs, then it is probably advisable to expand the interval by changing the arguments hmin, hmax. Computation time depends on the number nh of trial values considered, and also on the range [hmin, hmax] of values considered, because larger values of sigma require calculations involving more pairs of data points. Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted. bw.scott 171 Author(s) Adrian Baddeley and Rolf Turner References Diggle, P.J. (2003) Statistical analysis of spatial point patterns, Second edition. Arnold. Kelsall, J.E. and Diggle, P.J. (1995) Kernel estimation of relative risk. Bernoulli 1, 3–16. See Also relrisk, bw.stoyan Examples data(urkiola) b <- bw.relrisk(urkiola) b plot(b) b <- bw.relrisk(urkiola, hmax=20) plot(b) bw.scott Scott’s Rule for Bandwidth Selection for Kernel Density Description Use Scott’s rule of thumb to determine the smoothing bandwidth for the kernel estimation of point process intensity. Usage bw.scott(X) Arguments X A point pattern (object of class "ppp"). Details This function selects a bandwidth sigma for the kernel estimator of point process intensity computed by density.ppp. The bandwidth σ is computed by the rule of thumb of Scott (1992, page 152). It is very fast to compute. This rule is designed for density estimation, and typically produces a larger bandwidth than bw.diggle. It is useful for estimating gradual trend. Value A numerical vector of two elements giving the selected bandwidths in the x and y directions. 172 bw.smoothppp Author(s) Adrian Baddeley and Rolf Turner References Scott, D.W. (1992) Multivariate Density Estimation. Theory, Practice and Visualization. New York: Wiley. See Also density.ppp, bw.diggle, bw.ppl, bw.frac. Examples data(lansing) attach(split(lansing)) b <- bw.scott(hickory) b plot(density(hickory, b)) bw.smoothppp Cross Validated Bandwidth Selection for Spatial Smoothing Description Uses least-squares cross-validation to select a smoothing bandwidth for spatial smoothing of marks. Usage bw.smoothppp(X, nh = spatstat.options("n.bandwidth"), hmin=NULL, hmax=NULL, warn=TRUE) Arguments X A marked point pattern with numeric marks. nh Number of trial values of smoothing bandwith sigma to consider. The default is 32. hmin, hmax Optional. Numeric values. Range of trial values of smoothing bandwith sigma to consider. There is a sensible default. warn Logical. If TRUE, issue a warning if the minimum of the cross-validation criterion occurs at one of the ends of the search interval. bw.smoothppp 173 Details This function selects an appropriate bandwidth for the nonparametric smoothing of mark values using Smooth.ppp. The argument X must be a marked point pattern with a vector or data frame of marks. All mark values must be numeric. The bandwidth is selected by least-squares cross-validation. Let yi be the mark value at the ith data point. For a particular choice of smoothing bandwidth, let ŷi be the smoothed value at the ith data the bandwidth is chosen to minimise the squared error of the smoothed values P point. Then 2 i (yi − ŷi ) . The result of bw.smoothppp is a numerical value giving the selected bandwidth sigma. The result also belongs to the class "bw.optim" allowing it to be printed and plotted. The plot shows the cross-validation criterion as a function of bandwidth. The range of values for the smoothing bandwidth sigma is set by the arguments hmin, hmax. There is a sensible default, based on the nearest neighbour distances. If the optimal bandwidth is achieved at an endpoint of the interval [hmin, hmax], the algorithm will issue a warning (unless warn=FALSE). If this occurs, then it is probably advisable to expand the interval by changing the arguments hmin, hmax. Computation time depends on the number nh of trial values considered, and also on the range [hmin, hmax] of values considered, because larger values of sigma require calculations involving more pairs of data points. Value A numerical value giving the selected bandwidth. The result also belongs to the class "bw.optim" which can be plotted. Author(s) Adrian Baddeley and Rolf Turner See Also Smooth.ppp Examples data(longleaf) b <- bw.smoothppp(longleaf) b plot(b) 174 bw.stoyan bw.stoyan Stoyan’s Rule of Thumb for Bandwidth Selection Description Computes a rough estimate of the appropriate bandwidth for kernel smoothing estimators of the pair correlation function and other quantities. Usage bw.stoyan(X, co=0.15) Arguments X A point pattern (object of class "ppp"). co Coefficient appearing in the rule of thumb. See Details. Details Estimation of the pair correlation function and other quantities by smoothing methods requires a choice of the smoothing bandwidth. Stoyan and Stoyan (1995, equation (15.16), page 285) proposed a rule of thumb for choosing the smoothing bandwidth. √ For the Epanechnikov kernel, the rule of thumb is to set the kernel’s half-width h to 0.15/ λ where λ is the estimated intensity of the point pattern, typically computed as the number of points of X divided by the area of the window containing X. For a √ general kernel, the corresponding rule is to set the standard deviation of the kernel to σ = 0.15/ 5λ. The coefficient 0.15 can be tweaked using the argument co. Value A numerical value giving the selected bandwidth (the standard deviation of the smoothing kernel). Author(s) Adrian Baddeley and Rolf Turner References Stoyan, D. and Stoyan, H. (1995) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons. See Also pcf, bw.relrisk Examples data(shapley) bw.stoyan(shapley) by.im 175 by.im Apply Function to Image Broken Down by Factor Description Splits a pixel image into sub-images and applies a function to each sub-image. Usage ## S3 method for class 'im' by(data, INDICES, FUN, ...) Arguments data A pixel image (object of class "im"). INDICES Grouping variable. Either a tessellation (object of class "tess") or a factorvalued pixel image. FUN Function to be applied to each sub-image of data. ... Extra arguments passed to FUN. Details This is a method for the generic function by for pixel images (class "im"). The pixel image data is first divided into sub-images according to INDICES. Then the function FUN is applied to each subset. The results of each computation are returned in a list. The grouping variable INDICES may be either • a tessellation (object of class "tess"). Each tile of the tessellation delineates a subset of the spatial domain. • a pixel image (object of class "im") with factor values. The levels of the factor determine subsets of the spatial domain. Value A list containing the results of each evaluation of FUN. Author(s) Adrian Baddeley and Rolf Turner See Also split.im, tess, im 176 by.ppp Examples W <- square(1) X <- as.im(function(x,y){sqrt(x^2+y^2)}, W) Y <- dirichlet(runifpoint(12, W)) # mean pixel value in each subset unlist(by(X, Y, mean)) # trimmed mean unlist(by(X, Y, mean, trim=0.05)) by.ppp Apply a Function to a Point Pattern Broken Down by Factor Description Splits a point pattern into sub-patterns, and applies the function to each sub-pattern. Usage ## S3 method for class 'ppp' by(data, INDICES=marks(data), FUN, ...) Arguments data Point pattern (object of class "ppp"). INDICES Grouping variable. Either a factor, a pixel image with factor values, or a tessellation. FUN Function to be applied to subsets of data. ... Additional arguments to FUN. Details This is a method for the generic function by for point patterns (class "ppp"). The point pattern data is first divided into subsets according to INDICES. Then the function FUN is applied to each subset. The results of each computation are returned in a list. The argument INDICES may be • a factor, of length equal to the number of points in data. The levels of INDICES determine the destination of each point in data. The ith point of data will be placed in the sub-pattern split.ppp(data)$l where l = f[i]. • a pixel image (object of class "im") with factor values. The pixel value of INDICES at each point of data will be used as the classifying variable. • a tessellation (object of class "tess"). Each point of data will be classified according to the tile of the tessellation into which it falls. If INDICES is missing, then data must be a multitype point pattern (a marked point pattern whose marks vector is a factor). Then the effect is that the points of each type are separated into different point patterns. cauchy.estK 177 Value A list (also of class "anylist" or "solist" as appropriate) containing the results returned from FUN for each of the subpatterns. Author(s) Adrian Baddeley and Rolf Turner See Also ppp, split.ppp, cut.ppp, tess, im. Examples # multitype point pattern, broken down by type data(amacrine) by(amacrine, FUN=density) by(amacrine, FUN=function(x) { min(nndist(x)) } ) # how to pass additional arguments to FUN by(amacrine, FUN=clarkevans, correction=c("Donnelly","cdf")) # point pattern broken down by tessellation data(swedishpines) tes <- quadrats(swedishpines, 5, 5) B <- by(swedishpines, tes, clarkevans, correction="Donnelly") unlist(lapply(B, as.numeric)) cauchy.estK Fit the Neyman-Scott cluster process with Cauchy kernel Description Fits the Neyman-Scott Cluster point process with Cauchy kernel to a point pattern dataset by the Method of Minimum Contrast. Usage cauchy.estK(X, startpar=c(kappa=1,scale=1), lambda=NULL, q = 1/4, p = 2, rmin = NULL, rmax = NULL, ...) Arguments X startpar lambda q,p rmin, rmax ... Data to which the model will be fitted. Either a point pattern or a summary statistic. See Details. Vector of starting values for the parameters of the model. Optional. An estimate of the intensity of the point process. Optional. Exponents for the contrast criterion. Optional. The interval of r values for the contrast criterion. Optional arguments passed to optim to control the optimisation algorithm. See Details. 178 cauchy.estK Details This algorithm fits the Neyman-Scott cluster point process model with Cauchy kernel to a point pattern dataset by the Method of Minimum Contrast, using the K function. The argument X can be either a point pattern: An object of class "ppp" representing a point pattern dataset. The K function of the point pattern will be computed using Kest, and the method of minimum contrast will be applied to this. a summary statistic: An object of class "fv" containing the values of a summary statistic, computed for a point pattern dataset. The summary statistic should be the K function, and this object should have been obtained by a call to Kest or one of its relatives. The algorithm fits the Neyman-Scott cluster point process with Cauchy kernel to X, by finding the parameters of the Matern Cluster model which give the closest match between the theoretical K function of the Matern Cluster process and the observed K function. For a more detailed explanation of the Method of Minimum Contrast, see mincontrast. The model is described in Jalilian et al (2013). It is a cluster process formed by taking a pattern of parent points, generated according to a Poisson process with intensity κ, and around each parent point, generating a random number of offspring points, such that the number of offspring of each parent is a Poisson random variable with mean µ, and the locations of the offspring points of one parent follow a common distribution described in Jalilian et al (2013). If the argument lambda is provided, then this is used as the value of the point process intensity λ. Otherwise, if X is a point pattern, then λ will be estimated from X. If X is a summary statistic and lambda is missing, then the intensity λ cannot be estimated, and the parameter µ will be returned as NA. The remaining arguments rmin,rmax,q,p control the method of minimum contrast; see mincontrast. The corresponding model can be simulated using rCauchy. For computational reasons, the optimisation procedure uses the parameter eta2, which is equivalent to 4 * scale^2 where scale is the scale parameter for the model as used in rCauchy. Homogeneous or inhomogeneous Neyman-Scott/Cauchy models can also be fitted using the function kppm and the fitted models can be simulated using simulate.kppm. The optimisation algorithm can be controlled through the additional arguments "..." which are passed to the optimisation function optim. For example, to constrain the parameter values to a certain range, use the argument method="L-BFGS-B" to select an optimisation algorithm that respects box constraints, and use the arguments lower and upper to specify (vectors of) minimum and maximum values for each parameter. Value An object of class "minconfit". There are methods for printing and plotting this object. It contains the following main components: par Vector of fitted parameter values. fit Function value table (object of class "fv") containing the observed values of the summary statistic (observed) and the theoretical values of the summary statistic computed from the fitted model parameters. Author(s) Abdollah Jalilian and Rasmus Waagepetersen. Adapted for spatstat by Adrian Baddeley and Rolf Turner See Also hyperframe, as.hyperframe Examples lambda <- runif(5, min=10, max=30) X <- lapply(as.list(lambda), function(x) { rpoispp(x) }) h <- hyperframe(lambda=lambda, X=X) g <- hyperframe(id=letters[1:5], Y=rev(X)) gh <- cbind(h, g) hh <- rbind(h, h) CDF Cumulative Distribution Function From Kernel Density Estimate Description Given a kernel estimate of a probability density, compute the corresponding cumulative distribution function. Usage CDF(f, ...) ## S3 method for class 'density' CDF(f, ..., warn = TRUE) Arguments f Density estimate (object of class "density"). ... Ignored. warn Logical value indicating whether to issue a warning if the density estimate f had to be renormalised because it was computed in a restricted interval. Details CDF is generic, with a method for class "density". This calculates the cumulative distribution function whose probability density has been estimated and stored in the object f. The object f must belong to the class "density", and would typically have been obtained from a call to the function density. cdf.test 183 Value A function, which can be applied to any numeric value or vector of values. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also density, quantile.density Examples b <- density(runif(10)) f <- CDF(b) f(0.5) plot(f) cdf.test Spatial Distribution Test for Point Pattern or Point Process Model Description Performs a test of goodness-of-fit of a point process model. The observed and predicted distributions of the values of a spatial covariate are compared using either the Kolmogorov-Smirnov test, Cramér-von Mises test or Anderson-Darling test. For non-Poisson models, a Monte Carlo test is used. Usage cdf.test(...) ## S3 method for class 'ppp' cdf.test(X, covariate, test=c("ks", "cvm", "ad"), ..., interpolate=TRUE, jitter=TRUE) ## S3 method for class 'ppm' cdf.test(model, covariate, test=c("ks", "cvm", "ad"), ..., interpolate=TRUE, jitter=TRUE, nsim=99, verbose=TRUE) ## S3 method for class 'lpp' cdf.test(X, covariate, test=c("ks", "cvm", "ad"), ..., interpolate=TRUE, jitter=TRUE) ## S3 method for class 'lppm' cdf.test(model, covariate, test=c("ks", "cvm", "ad"), ..., interpolate=TRUE, jitter=TRUE, nsim=99, verbose=TRUE) ## S3 method for class 'slrm' cdf.test(model, covariate, test=c("ks", "cvm", "ad"), ..., modelname=NULL, covname=NULL) 184 cdf.test Arguments X A point pattern (object of class "ppp" or "lpp"). model A fitted point process model (object of class "ppm" or "lppm") or fitted spatial logistic regression (object of class "slrm"). covariate The spatial covariate on which the test will be based. A function, a pixel image (object of class "im"), a list of pixel images, or one of the characters "x" or "y" indicating the Cartesian coordinates. test Character string identifying the test to be performed: "ks" for KolmogorovSmirnov test, "cvm" for Cramér-von Mises test or "ad" for Anderson-Darling test. ... Arguments passed to ks.test (from the stats package) or cvm.test or ad.test (from the goftest package) to control the test. interpolate Logical flag indicating whether to interpolate pixel images. If interpolate=TRUE, the value of the covariate at each point of X will be approximated by interpolating the nearby pixel values. If interpolate=FALSE, the nearest pixel value will be used. jitter Logical flag. If jitter=TRUE, values of the covariate will be slightly perturbed at random, to avoid tied values in the test. modelname,covname Character strings giving alternative names for model and covariate to be used in labelling plot axes. nsim Number of simulated realisations from the model to be used for the Monte Carlo test, when model is not a Poisson process. verbose Logical value indicating whether to print progress reports when performing a Monte Carlo test. Details These functions perform a goodness-of-fit test of a Poisson or Gibbs point process model fitted to point pattern data. The observed distribution of the values of a spatial covariate at the data points, and the predicted distribution of the same values under the model, are compared using the Kolmogorov-Smirnov test, the Cramér-von Mises test or the Anderson-Darling test. For Gibbs models, a Monte Carlo test is performed using these test statistics. The function cdf.test is generic, with methods for point patterns ("ppp" or "lpp"), point process models ("ppm" or "lppm") and spatial logistic regression models ("slrm"). • If X is a point pattern dataset (object of class "ppp"), then cdf.test(X, ...) performs a goodness-of-fit test of the uniform Poisson point process (Complete Spatial Randomness, CSR) for this dataset. For a multitype point pattern, the uniform intensity is assumed to depend on the type of point (sometimes called Complete Spatial Randomness and Independence, CSRI). • If model is a fitted point process model (object of class "ppm" or "lppm") then cdf.test(model, ...) performs a test of goodness-of-fit for this fitted model. • If model is a fitted spatial logistic regression (object of class "slrm") then cdf.test(model, ...) performs a test of goodness-of-fit for this fitted model. The test is performed by comparing the observed distribution of the values of a spatial covariate at the data points, and the predicted distribution of the same covariate under the model, using a classical goodness-of-fit test. Thus, you must nominate a spatial covariate for this test. cdf.test 185 If X is a point pattern that does not have marks, the argument covariate should be either a function(x,y) or a pixel image (object of class "im" containing the values of a spatial function, or one of the characters "x" or "y" indicating the Cartesian coordinates. If covariate is an image, it should have numeric values, and its domain should cover the observation window of the model. If covariate is a function, it should expect two arguments x and y which are vectors of coordinates, and it should return a numeric vector of the same length as x and y. If X is a multitype point pattern, the argument covariate can be either a function(x,y,marks), or a pixel image, or a list of pixel images corresponding to each possible mark value, or one of the characters "x" or "y" indicating the Cartesian coordinates. First the original data point pattern is extracted from model. The values of the covariate at these data points are collected. The predicted distribution of the values of the covariate under the fitted model is computed as follows. The values of the covariate at all locations in the observation window are evaluated, weighted according to the point process intensity of the fitted model, and compiled into a cumulative distribution function F using ewcdf. The probability integral transformation is then applied: the values of the covariate at the original data points are transformed by the predicted cumulative distribution function F into numbers between 0 and 1. If the model is correct, these numbers are i.i.d. uniform random numbers. The A goodness-of-fit test of the uniform distribution is applied to these numbers using stats::ks.test, goftest::cvm.test or goftest::ad.test. This test was apparently first described (in the context of spatial data, and using KolmogorovSmirnov) by Berman (1986). See also Baddeley et al (2005). If model is not a Poisson process, then a Monte Carlo test is performed, by generating nsim point patterns which are simulated realisations of the model, re-fitting the model to each simulated point pattern, and calculating the test statistic for each fitted model. The Monte Carlo p value is determined by comparing the simulated values of the test statistic with the value for the original data. The return value is an object of class "htest" containing the results of the hypothesis test. The print method for this class gives an informative summary of the test outcome. The return value also belongs to the class "cdftest" for which there is a plot method plot.cdftest. The plot method displays the empirical cumulative distribution function of the covariate at the data points, and the predicted cumulative distribution function of the covariate under the model, plotted against the value of the covariate. The argument jitter controls whether covariate values are randomly perturbed, in order to avoid ties. If the original data contains any ties in the covariate (i.e. points with equal values of the covariate), and if jitter=FALSE, then the Kolmogorov-Smirnov test implemented in ks.test will issue a warning that it cannot calculate the exact p-value. To avoid this, if jitter=TRUE each value of the covariate will be perturbed by adding a small random value. The perturbations are normally distributed with standard deviation equal to one hundredth of the range of values of the covariate. This prevents ties, and the p-value is still correct. There is a very slight loss of power. Value An object of class "htest" containing the results of the test. See ks.test for details. The return value can be printed to give an informative summary of the test. The value also belongs to the class "cdftest" for which there is a plot method. Warning The outcome of the test involves a small amount of random variability, because (by default) the coordinates are randomly perturbed to avoid tied values. Hence, if cdf.test is executed twice, the 186 cdf.test p-values will not be exactly the same. To avoid this behaviour, set jitter=FALSE. Author(s) Adrian Baddeley and Rolf Turner References Baddeley, A., Turner, R., Møller, J. and Hazelton, M. (2005) Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67, 617–666. Berman, M. (1986) Testing for spatial association between a point process and another stochastic process. Applied Statistics 35, 54–62. See Also plot.cdftest, quadrat.test, berman.test, ks.test, cvm.test, ad.test, ppm Examples op <- options(useFancyQuotes=FALSE) # test of CSR using x coordinate cdf.test(nztrees, "x") cdf.test(nztrees, "x", "cvm") cdf.test(nztrees, "x", "ad") # test of CSR using a function of x and y fun <- function(x,y){2* x + y} cdf.test(nztrees, fun) # test of CSR using an image covariate funimage <- as.im(fun, W=Window(nztrees)) cdf.test(nztrees, funimage) # fit inhomogeneous Poisson model and test model <- ppm(nztrees ~x) cdf.test(model, "x") if(interactive()) { # synthetic data: nonuniform Poisson process X <- rpoispp(function(x,y) { 100 * exp(x) }, win=square(1)) # fit uniform fit0 <- ppm(X # fit correct fit1 <- ppm(X } Poisson process ~1) nonuniform Poisson process ~x) # test wrong model cdf.test(fit0, "x") # test right model cdf.test(fit1, "x") # multitype point pattern cdf.test(amacrine, "x") cdf.test.mppm 187 yimage <- as.im(function(x,y){y}, W=Window(amacrine)) cdf.test(ppm(amacrine ~marks+y), yimage) options(op) cdf.test.mppm Spatial Distribution Test for Multiple Point Process Model Description Performs a spatial distribution test of a point process model fitted to multiple spatial point patterns. The test compares the observed and predicted distributions of the values of a spatial covariate, using either the Kolmogorov-Smirnov, Cramér-von Mises or Anderson-Darling test of goodness-of-fit. Usage ## S3 method for class 'mppm' cdf.test(model, covariate, test=c("ks", "cvm", "ad"), ..., nsim=19, verbose=TRUE, interpolate=FALSE, fast=TRUE, jitter=TRUE) Arguments model An object of class "mppm" representing a point process model fitted to multiple spatial point patterns. covariate The spatial covariate on which the test will be based. A function, a pixel image, a list of functions, a list of pixel images, a hyperframe, a character string containing the name of one of the covariates in model, or one of the strings "x" or "y". test Character string identifying the test to be performed: "ks" for KolmogorovSmirnov test, "cvm" for Cramér-von Mises test or "ad" for Anderson-Darling test. ... Arguments passed to cdf.test to control the test. nsim Number of simulated realisations which should be generated, if a Monte Carlo test is required. verbose Logical flag indicating whether to print progress reports. interpolate Logical flag indicating whether to interpolate between pixel values when codecovariate is a pixel image. See Details. fast Logical flag. If TRUE, values of the covariate are only sampled at the original quadrature points used to fit the model. If FALSE, values of the covariate are sampled at all pixels, which can be slower by three orders of magnitude. jitter Logical flag. If TRUE, observed values of the covariate are perturbed by adding small random values, to avoid tied observations. 188 cdf.test.mppm Details This function is a method for the generic function cdf.test for the class mppm. This function performs a goodness-of-fit test of a point process model that has been fitted to multiple point patterns. The observed distribution of the values of a spatial covariate at the data points, and the predicted distribution of the same values under the model, are compared using the KolmogorovSmirnov, Cramér-von Mises or Anderson-Darling test of goodness-of-fit. These are exact tests if the model is Poisson; otherwise, for a Gibbs model, a Monte Carlo p-value is computed by generating simulated realisations of the model and applying the selected goodness-of-fit test to each simulation. The argument model should be a fitted point process model fitted to multiple point patterns (object of class "mppm"). The argument covariate contains the values of a spatial function. It can be • a function(x,y) • a pixel image (object of class "im" • a list of function(x,y), one for each point pattern • a list of pixel images, one for each point pattern • a hyperframe (see hyperframe) of which the first column will be taken as containing the covariate • a character string giving the name of one of the covariates in model • one of the character strings "x" or "y", indicating the spatial coordinates. If covariate is an image, it should have numeric values, and its domain should cover the observation window of the model. If covariate is a function, it should expect two arguments x and y which are vectors of coordinates, and it should return a numeric vector of the same length as x and y. First the original data point pattern is extracted from model. The values of the covariate at these data points are collected. The predicted distribution of the values of the covariate under the fitted model is computed as follows. The values of the covariate at all locations in the observation window are evaluated, weighted according to the point process intensity of the fitted model, and compiled into a cumulative distribution function F using ewcdf. The probability integral transformation is then applied: the values of the covariate at the original data points are transformed by the predicted cumulative distribution function F into numbers between 0 and 1. If the model is correct, these numbers are i.i.d. uniform random numbers. A goodness-of-fit test of the uniform distribution is applied to these numbers using ks.test, cvm.test or ad.test. The argument interpolate determines how pixel values will be handled when codecovariate is a pixel image. The value of the covariate at a data point is obtained by looking up the value of the nearest pixel if interpolate=FALSE, or by linearly interpolating between the values of the four nearest pixels if interpolate=TRUE. Linear interpolation is slower, but is sometimes necessary to avoid tied values of the covariate arising when the pixel grid is coarse. If model is a Poisson point process, then the Kolmogorov-Smirnov, Cramér-von Mises and AndersonDarling tests are theoretically exact. This test was apparently first described (in the context of spatial data, and for Kolmogorov-Smirnov) by Berman (1986). See also Baddeley et al (2005). If model is not a Poisson point process, then the Kolmogorov-Smirnov, Cramér-von Mises and Anderson-Darling tests are biased. Instead they are used as the basis of a Monte Carlo test. First nsim simulated realisations of the model will be generated. Each simulated realisation consists of a list of simulated point patterns, one for each of the original data patterns. This can take a very centroid.owin 189 long time. The model is then re-fitted to each simulation, and the refitted model is subjected to the goodness-of-fit test described above. A Monte Carlo p-value is then computed by comparing the p-value of the original test with the p-values obtained from the simulations. Value An object of class "cdftest" and "htest" containing the results of the test. See cdf.test for details. Author(s) Adrian Baddeley , Ida-Maria Sintorn and Leanne Bischoff. Implemented by Adrian Baddeley , Rolf Turner and Ege Rubak . References Baddeley, A., Rubak, E. and Turner, R. (2015) Spatial Point Patterns: Methodology and Applications with R. London: Chapman and Hall/CRC Press. Baddeley, A., Turner, R., Moller, J. and Hazelton, M. (2005) Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67, 617–666. Berman, M. (1986) Testing for spatial association between a point process and another stochastic process. Applied Statistics 35, 54–62. See Also cdf.test, quadrat.test, mppm Examples # three i.i.d. realisations of nonuniform Poisson process lambda <- as.im(function(x,y) { 300 * exp(x) }, square(1)) dat <- hyperframe(X=list(rpoispp(lambda), rpoispp(lambda), rpoispp(lambda))) # fit uniform Poisson process fit0 <- mppm(X~1, dat) # fit correct nonuniform Poisson process fit1 <- mppm(X~x, dat) # test wrong model cdf.test(fit0, "x") # test right model cdf.test(fit1, "x") centroid.owin Centroid of a window Description Computes the centroid (centre of mass) of a window 190 centroid.owin Usage centroid.owin(w, as.ppp = FALSE) Arguments w A window as.ppp Logical flag indicating whether to return the centroid as a point pattern (ppp object) Details The centroid of the window w is computed. The centroid (“centre of mass”) is the point whose x and y coordinates are the mean values of the x and y coordinates of all points in the window. The argument w should be a window (an object of class "owin", see owin.object for details) or can be given in any format acceptable to as.owin(). The calculation uses an exact analytic formula for the case of polygonal windows. Note that the centroid of a window is not necessarily inside the window, unless the window is convex. If as.ppp=TRUE and the centroid of w lies outside w, then the window of the returned point pattern will be a rectangle containing the original window (using as.rectangle. Value Either a list with components x, y, or a point pattern (of class ppp) consisting of a single point, giving the coordinates of the centroid of the window w. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak See Also owin, as.owin Examples w <- owin(c(0,1),c(0,1)) centroid.owin(w) # returns 0.5, 0.5 data(demopat) w <- Window(demopat) # an irregular window cent <- centroid.owin(w, as.ppp = TRUE) ## Not run: plot(cent) # plot the window and its centroid ## End(Not run) wapprox <- as.mask(w) # pixel approximation of window chop.tess 191 ## Not run: points(centroid.owin(wapprox)) # should be indistinguishable ## End(Not run) chop.tess Subdivide a Window or Tessellation using a Set of Lines Description Divide a given window into tiles delineated by a set of infinite straight lines, obtaining a tessellation of the window. Alternatively, given a tessellation, divide each tile of the tessellation into sub-tiles delineated by the lines. Usage chop.tess(X, L) Arguments X A window (object of class "owin") or tessellation (object of class "tess") to be subdivided by lines. L A set of infinite straight lines (object of class "infline") Details The argument L should be a set of infinite straight lines in the plane (stored in an object L of class "infline" created by the function infline). If X is a window, then it is divided into tiles delineated by the lines in L. If X is a tessellation, then each tile of X is subdivided into sub-tiles delineated by the lines in L. The result is a tessellation. Value A tessellation (object of class "tess"). Warning If X is a non-convex window, or a tessellation containing non-convex tiles, then chop.tess(X,L) may contain a tile which consists of several unconnected pieces. Author(s) Adrian Baddeley and Rolf Turner See Also infline, clip.infline 192 circdensity Examples L <- infline(p=1:3, theta=pi/4) W <- square(4) chop.tess(W, L) circdensity Density Estimation for Circular Data Description Computes a kernel smoothed estimate of the probability density for angular data. Usage circdensity(x, sigma = "nrd0", ..., bw = NULL, weights=NULL, unit = c("degree", "radian")) Arguments x sigma bw ... weights unit Numeric vector, containing angular data. Smoothing bandwidth, or bandwidth selection rule, passed to density.default. Alternative to sigma for consistency with other functions. Additional arguments passed to density.default, such as kernel and weights. Optional numeric vector of weights for the data in x. The unit of angle in which x is expressed. Details The angular values x are smoothed using (by default) the wrapped Gaussian kernel with standard deviation sigma. Value An object of class "density" (produced by density.default) which can be plotted by plot or by rose. Author(s) Adrian Baddeley Rolf Turner and Ege Rubak See Also density.default), rose. Examples ang <- runif(1000, max=360) rose(circdensity(ang, 12)) clarkevans clarkevans 193 Clark and Evans Aggregation Index Description Computes the Clark and Evans aggregation index R for a spatial point pattern. Usage clarkevans(X, correction=c("none", "Donnelly", "cdf"), clipregion=NULL) Arguments X A spatial point pattern (object of class "ppp"). correction Character vector. The type of edge correction(s) to be applied. clipregion Clipping region for the guard area correction. A window (object of class "owin"). See Details. Details The Clark and Evans (1954) aggregation index R is a crude measure of clustering or ordering of a point pattern. It is the ratio of the observed mean nearest neighbour distance in the pattern to that expected for a Poisson point process of the same intensity. A value R > 1 suggests ordering, while R < 1 suggests clustering. Without correction for edge effects, the value of R will be positively biased. Edge effects arise because, for a point of X close to the edge of the window, the true nearest neighbour may actually lie outside the window. Hence observed nearest neighbour distances tend to be larger than the true nearest neighbour distances. The argument correction specifies an edge correction or several edge corrections to be applied. It is a character vector containing one or more of the options "none", "Donnelly", "guard" and "cdf" (which are recognised by partial matching). These edge corrections are: "none": No edge correction is applied. "Donnelly": Edge correction of Donnelly (1978), available for rectangular windows only. The theoretical expected value of mean nearest neighbour distance under a Poisson process is adjusted for edge effects by the edge correction of Donnelly (1978). The value of R is the ratio of the observed mean nearest neighbour distance to this adjusted theoretical mean. "guard": Guard region or buffer area method. The observed mean nearest neighbour distance for the point pattern X is re-defined by averaging only over those points of X that fall inside the sub-window clipregion. "cdf": Cumulative Distribution Function method. The nearest neighbour distance distribution function G(r) of the stationary point process is estimated by Gest using the Kaplan-Meier type edge correction. Then the mean of the distribution is calculated from the cdf. Alternatively correction="all" selects all options. If the argument clipregion is given, then the selected edge corrections will be assumed to include correction="guard". To perform a test based on the Clark-Evans index, see clarkevans.test. 194 clarkevans Value A numeric value, or a numeric vector with named components naive R without edge correction Donnelly R using Donnelly edge correction guard R using guard region cdf R using cdf method (as selected by correction). The value of the Donnelly component will be NA if the window of X is not a rectangle. Author(s) John Rudge with modifications by Adrian Baddeley References Clark, P.J. and Evans, F.C. (1954) Distance to nearest neighbour as a measure of spatial relationships in populations Ecology 35, 445–453. Donnelly, K. (1978) Simulations to determine the variance and edge-effect of total nearest neighbour distance. In I. Hodder (ed.) Simulation studies in archaeology, Cambridge/New York: Cambridge University Press, pp 91–95. See Also clarkevans.test, hopskel, nndist, Gest Examples # Example of a clustered pattern clarkevans(redwood) # Example of an ordered pattern clarkevans(cells) # Random pattern X <- rpoispp(100) clarkevans(X) # How to specify a clipping region clip1 <- owin(c(0.1,0.9),c(0.1,0.9)) clip2 <- erosion(Window(cells), 0.1) clarkevans(cells, clipregion=clip1) clarkevans(cells, clipregion=clip2) clarkevans.test clarkevans.test 195 Clark and Evans Test Description Performs the Clark-Evans test of aggregation for a spatial point pattern. Usage clarkevans.test(X, ..., correction="none", clipregion=NULL, alternative=c("two.sided", "less", "greater", "clustered", "regular"), nsim=999) Arguments X ... correction clipregion alternative nsim A spatial point pattern (object of class "ppp"). Ignored. Character string. The type of edge correction to be applied. See clarkevans Clipping region for the guard area correction. A window (object of class "owin"). See clarkevans String indicating the type of alternative for the hypothesis test. Partially matched. Number of Monte Carlo simulations to perform, if a Monte Carlo p-value is required. Details This command uses the Clark and Evans (1954) aggregation index R as the basis for a crude test of clustering or ordering of a point pattern. The Clark-Evans index is computed by the function clarkevans. See the help for clarkevans for information about the Clark-Evans index R and about the arguments correction and clipregion. This command performs a hypothesis test of clustering or ordering of the point pattern X. The null hypothesis is Complete Spatial Randomness, i.e.\ a uniform Poisson process. The alternative hypothesis is specified by the argument alternative: • alternative="less" or alternative="clustered": the alternative hypothesis is that R < 1 corresponding to a clustered point pattern; • alternative="greater" or alternative="regular": the alternative hypothesis is that R > 1 corresponding to a regular or ordered point pattern; • alternative="two.sided": the alternative hypothesis is that R 6= 1 corresponding to a clustered or regular pattern. The Clark-Evans index R is computed for the data as described in clarkevans. If correction="none" and nsim is missing, the p-value for the test is computed by standardising R as proposed by Clark and Evans (1954) and referring the statistic to the standard Normal distribution. Otherwise, the p-value for the test is computed by Monte Carlo simulation of nsim realisations of Complete Spatial Randomness conditional on the observed number of points. 196 clickbox Value An object of class "htest" representing the result of the test. Author(s) Adrian Baddeley References Clark, P.J. and Evans, F.C. (1954) Distance to nearest neighbour as a measure of spatial relationships in populations. Ecology 35, 445–453. Donnelly, K. (1978) Simulations to determine the variance and edge-effect of total nearest neighbour distance. In Simulation methods in archaeology, Cambridge University Press, pp 91–95. See Also clarkevans, hopskel.test Examples # Redwood data - clustered clarkevans.test(redwood) clarkevans.test(redwood, alternative="clustered") clickbox Interactively Define a Rectangle Description Allows the user to specify a rectangle by point-and-click in the display. Usage clickbox(add=TRUE, ...) Arguments add Logical value indicating whether to create a new plot (add=FALSE) or draw over the existing plot (add=TRUE). ... Graphics arguments passed to polygon to plot the box. Details This function allows the user to create a rectangular window by interactively clicking on the screen display. The user is prompted to point the mouse at any desired locations for two corners of the rectangle, and click the left mouse button to add each point. The return value is a window (object of class "owin") representing the rectangle. This function uses the R command locator to input the mouse clicks. It only works on screen devices such as ‘X11’, ‘windows’ and ‘quartz’. clickdist 197 Value A window (object of class "owin") representing the selected rectangle. Author(s) Adrian Baddeley , Rolf Turner and Ege Rubak . See Also clickpoly, clickppp, clickdist, locator clickdist Interactively Measure Distance Description Measures the distance between two points which the user has clicked on. Usage clickdist() Details This function allows the user to measure the distance between two spatial locations, interactively, by clicking on the screen display. When clickdist() is called, the user is expected to click two points in the current graphics device. The distance between these points will be returned. This function uses the R command locator to input the mouse clicks. It only works on screen devices such as ‘X11’, ‘windows’ and ‘quartz’. Value A single nonnegative number. Author(s) Adrian Baddeley