| Type: | Package | 
| Title: | Two-Way ANOVA-Like Method to Analyze Replicated Point Patterns | 
| Version: | 0.1-6 | 
| Date: | 2025-04-30 | 
| Depends: | spatstat (≥ 2.0-0) | 
| Imports: | spatstat.geom, spatstat.explore, spatstat.utils | 
| Description: | Test for effects of both individual factors and their interaction on replicated spatial patterns in a two factorial design, as explained in Ramon et al. (2016) <doi:10.1111/ecog.01848>. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| NeedsCompilation: | no | 
| Packaged: | 2025-04-30 17:45:46 UTC; marcelino | 
| Author: | Marcelino de la Cruz
     | 
| Maintainer: | Marcelino de la Cruz <marcelino.delacruz@urjc.es> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-04-30 18:10:02 UTC | 
Two-Way ANOVA-Like Method to Analyze Replicated Point Patterns
Description
Test for effects of both individual factors and their interaction on replicated spatial patterns in a two factorial design.
Usage
K2w(pplist = NULL, dataKijk = NULL, nijk = NULL, r, r0 = NULL, rmax = NULL,
        tratA, tratB = NULL, wt = NULL, nsim = 999, correction = "trans", ...)
## S3 method for class 'k2w'
print(x,...)
## S3 method for class 'k2w'
plot(x, trat=NULL, ...,  lty = NULL, col = NULL, 
    lwd = NULL, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, 
     legend = TRUE, legendpos = "topleft",  fun="L", main=NULL)
Arguments
pplist | 
 A list of point patterns with the ppp format of spatstat. This argument os alternative to   | 
dataKijk | 
 A   | 
nijk | 
 A vector with the number of points in each of the replicated point patterns.  | 
r | 
 Vector of values for the argument r at which the K functions have been or should be evaluated. If the K functions are to be computed (i.e., if   | 
r0 | 
 Minimum r value for which K(r) estimates will be employed to compute BTSS.  | 
rmax | 
 Maximum r value for which K(r) estimates will be employed to compute BTSS.  | 
tratA | 
 A   | 
tratB | 
 A   | 
wt | 
 A weighting function employed to compute the BTSS. It can be either an R expression, a vector (with   | 
nsim | 
 Number of resamples to estimate the sampling distribution of the BTSS statistic.  | 
correction | 
 Any selection of the options "border", "bord.modif", "isotropic", "Ripley", "translate", "translation", "none" or "best". It specifies the edge correction to be applied if K functions should be computed.  | 
... | 
 Additional arguments for Kest function of spatstat (only applies if K functions should be computed) or additional graphical arguments for the matplot function.  | 
x | 
 an object of class   | 
trat | 
 (optional)  Factor employed to compute the averaged K functions that will be ploted. By default,   | 
lty | 
 (optional) numeric vector of values of the graphical parameter   | 
col | 
 (optional) numeric vector of values of the graphical parameter   | 
lwd | 
 (optional) numeric vector of values of the graphical parameter   | 
xlim | 
 (optional) range of x axis.  | 
ylim | 
 (optional) range of y axis.  | 
xlab | 
 (optional) label for x axis.  | 
ylab | 
 (optional) label for y axis.  | 
legend | 
 Logical flag or   | 
legendpos | 
 The position of the legend. Either a character string keyword (see legend for keyword options) or a pair of coordinates in the format   | 
fun | 
 One of    | 
main | 
 text to display as the title of the plot. By default, the name of the   | 
Details
This function implements a extension of the non-parametric one-way ANOVA-like method of Diggle et al. (1991) to the two-way case, and particularly to test the effects of the interaction of two factors on the spatial structure of replicated point patterns. From a set of K functions, it generates weighted averaged K functions for each level and combinations of levels of the factors and computes a statistic analogous to a between-treatment sum of squares (BTSS) in clasical ANOVA. More details are available in Ramon et al. (in revision).
Value
K2w returns an object of class k2w. Basically, a list with components:
btss.i | 
 Between treatment sum of squares (BTSS) for factor A.  | 
btss.j | 
 BTSS for factor B.  | 
btss.ij | 
 BTSS for the interaction of factors A and B.  | 
btss.i.res | 
 Resampled distribution of the BTSS statistic for factor A.  | 
btss.j.res | 
 Resampled distribution of BTSS for factor B.  | 
btss.ij.res | 
 Resampled distribution of BTSS for the interaction of factors A and B.  | 
KrepA | 
 Weighted average of the replicated K functions for each level of factor A.  | 
KrepB | 
 Weighted average of the replicated K functions for each level of factor B.  | 
KrepAB | 
 Weighted average of the replicated K functions for each combination of levels of factors A and B.  | 
K0i | 
 Global weighted average (i.e., all K fucntions averaged together).  | 
K0j | 
 Global weighted average (i.e., all K fucntions averaged together).  | 
K0ij | 
 Global weighted average (i.e., all K fucntions averaged together).  | 
Rik | 
 Data.frame with the residual functions for factor A.  | 
Rjk | 
 Data.frame with the residual functions for factor B.  | 
Rijk | 
 Data.frame with the residual functions for the interaction of factors A and B.  | 
nsumA | 
 Total number of points among the replicates in each level of factor A.  | 
nsumB | 
 Total number of points among the replicates in each level of factor B.  | 
nsumAB | 
 Total number of points among the replicates in each combinatipon of levels of factors A and B.  | 
wt | 
 Weighting function employed to compute the BTSS.  | 
tratA | 
 Factor A.  | 
tratB | 
 Factor B.  | 
tratAB | 
 Factor with the combination of levels of A and B.  | 
dataKijk | 
 Data.frame with the empirical, replicated, K-functions.  | 
nijk | 
 Vector with the number of points in each replicate.  | 
r | 
 Vector of r distances at which K functions are estimated.  | 
r0 | 
 Minimum r value for which K values have been employed to compute BTSS.  | 
KA.res | 
 Data.frame with the weighted average of replicated K functions for each level of factor A, for each of the nsim resamples.  | 
KB.res | 
 Data.frame with the weighted average of replicated K functions for each level of factor B, for each of the nsim resamples.  | 
KAB.res | 
 Data.frame with the weighted average of replicated K functions for each combination of levels of factors A and B, for each of the nsim resamples.  | 
nameA | 
 name of the R object with factor A.  | 
nameB | 
 name of the R object with factor B.  | 
Author(s)
Marcelino de la Cruz
References
Diggle, P.J., Nicholas, L. & Benes, F.M. (1991) Analysis of Variance for Replicated Spatial Point Patterns in Clinical Neuroanatomy. Journal of the American Statistical Association, 86: 618-625.
Ramon, P., De la Cruz, M., Chacon-Labella, J. & Escudero, A. (2016). A new two-way ANOVA-like method for analyzing replicated point patterns in ecology. Ecography, 39:1109-1117. doi:10.1111/ecog.01848.
Examples
# Get the data
data(croton)
croton.2w <- K2w(pplist=croton$list.ppp,  r=seq(0,8, by=0.1),               
               tratA=croton$elevation, tratB=croton$slope, nsim=39)
croton.2w
plot(croton.2w)
plot(croton.2w, "tratB")
Replicated Point Pattern of Croton
Description
A list with a) a list of 16 point patterns  (with the ppp format of spatstat) of Croton wagneri in Soutern Ecuador; b) a factor  with different elevations ("high", "slow")  and c) a factor with different topographical conditions ("steep" or "flat" slope) for each point pattern. Each point pattern is actually the result of a random thining (50 percent) of the original  pattern analyzed by  Ramon et al. (in revision).
Usage
data("croton")
References
Ramon, P., De la Cruz, M., Chacon-Labella, J. & Escudero, A. (in revision). A new two-way ANOVA-like method for analyzing replicated point patterns in ecology.
Examples
data(croton)