K2w {replicatedpp2w}R Documentation

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.

dataKijk

A data.frame with the K-functions (in columns) of each of the replicated point patterns. This argument os alternative to pplist.

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 dataKijk is NULL), first element of r should be 0.

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 factor asigning the levels of the first factor to each point pattern replicate.

tratB

A factor asigning the levels of the second factor to each point pattern replicate.

wt

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 .

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 k2w.

trat

(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).

lty

(optional) numeric vector of values of the graphical parameter lty controlling the line type of each plot.

col

(optional) numeric vector of values of the graphical parameter col controlling the colour of each K function.

lwd

(optional) numeric vector of values of the graphical parameter lwd controlling the line width of each plot.

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 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.

legendpos

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).

fun

One of "K" or "L" to select the function to be displayed. By default , L(r) = sqrt(K(r)/pi)-r would be ploted.

main

text to display as the title of the plot. By default, the name of the k2w object would be shown.

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=99)

croton.2w

plot(croton.2w)

plot(croton.2w, "tratB")



[Package replicatedpp2w version 0.1-5 Index]