Test for effects of both individual factors and their interaction on replicated spatial patterns in a two factorial design.
K2w(pplist = NULL, dataKijk = NULL, nijk = NULL, r, r0 = NULL, rmax = NULL,
tratA, tratB = NULL, wt = NULL, nsim = 999, correction = "trans", ...)
# S3 method for k2w
print(x,...)
# S3 method for 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)
K2w
returns an object of class k2w
. Basically, a list with components:
Between treatment sum of squares (BTSS) for factor A.
BTSS for factor B.
BTSS for the interaction of factors A and B.
Resampled distribution of the BTSS statistic for factor A.
Resampled distribution of BTSS for factor B.
Resampled distribution of BTSS for the interaction of factors A and B.
Weighted average of the replicated K functions for each level of factor A.
Weighted average of the replicated K functions for each level of factor B.
Weighted average of the replicated K functions for each combination of levels of factors A and B.
Global weighted average (i.e., all K fucntions averaged together).
Global weighted average (i.e., all K fucntions averaged together).
Global weighted average (i.e., all K fucntions averaged together).
Data.frame with the residual functions for factor A.
Data.frame with the residual functions for factor B.
Data.frame with the residual functions for the interaction of factors A and B.
Total number of points among the replicates in each level of factor A.
Total number of points among the replicates in each level of factor B.
Total number of points among the replicates in each combinatipon of levels of factors A and B.
Weighting function employed to compute the BTSS.
Factor A.
Factor B.
Factor with the combination of levels of A and B.
Data.frame with the empirical, replicated, K-functions.
Vector with the number of points in each replicate.
Vector of r distances at which K functions are estimated.
Minimum r value for which K values have been employed to compute BTSS.
Data.frame with the weighted average of replicated K functions for each level of factor A, for each of the nsim resamples.
Data.frame with the weighted average of replicated K functions for each level of factor B, for each of the nsim resamples.
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.
name of the R object with factor A.
name of the R object with factor B.
A list of point patterns with the ppp format of spatstat. This argument os alternative to dataKijk
.
A data.frame
with the K-functions (in columns) of each of the replicated point patterns. This argument os alternative to pplist
.
A vector with the number of points in each of the replicated point patterns.
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 dataKijk
is NULL), first element of r
should be 0.
Minimum r value for which K(r) estimates will be employed to compute BTSS.
Maximum r value for which K(r) estimates will be employed to compute BTSS.
A factor
asigning the levels of the first factor to each point pattern replicate.
A factor
asigning the levels of the second factor to each point pattern replicate.
A weighting function employed to compute the BTSS. It can be either an R expression, a vector (with length(wt) ==length (r)
) or a single value (i.e., same weight for all distances). By default, K2w
will use wt=r^-2
.
Number of resamples to estimate the sampling distribution of the BTSS statistic.
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.
an object of class k2w
.
(optional) Factor employed to compute the averaged K functions that will be ploted. By default, plot.k2w
plots averaged functions for the interaction (i.e., for combination of levels of factors) if two factors have been employed in the analysis or for the levels of the unique factor employed (in the case of one-way analysis). To select some specific display, use one of these: "tratA" (for the levels of the first factor), "tratB" (for the levels of the second factor) or "tratAB" (for the combinations of levels of both factors).
(optional) numeric vector of values of the graphical parameter lty
controlling the line type of each plot.
(optional) numeric vector of values of the graphical parameter col
controlling the colour of each K function.
(optional) numeric vector of values of the graphical parameter lwd
controlling the line width of each plot.
(optional) range of x axis.
(optional) range of y axis.
(optional) label for x axis.
(optional) label for y axis.
Logical flag or NULL
. If legend=TRUE
, the algorithm plots a legend in the top left corner of the plot, explaining the meaning of the different line types and colours.
The position of the legend. Either a character string keyword (see legend for keyword options) or a pair of coordinates in the format list(x,y)
.
One of "K"
or "L"
to select the function to be displayed. By default , L(r) = sqrt(K(r)/pi)-r would be ploted.
text to display as the title of the plot. By default, the name of the k2w
object would be shown.
Marcelino de la Cruz
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).
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. tools:::Rd_expr_doi("10.1111/ecog.01848").
# 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=99)
croton.2w
plot(croton.2w)
plot(croton.2w, "tratB")
Run the code above in your browser using DataLab