qdir_envelope: Directional quantile envelope test

Description Usage Arguments Value References Examples

View source: R/envelopes.r

Description

The directional quantile envelope test, which takes into account the unequal variances of the test function T(r) for different distances r and is also protected against asymmetry of T(r).

Usage

1
qdir_envelope(curve_set, ...)

Arguments

curve_set

A curve_set (see create_curve_set) or an envelope object. If an envelope object is given, it must contain the summary functions from the simulated patterns which can be achieved by setting savefuns = TRUE when calling envelope.

...

Additional parameters to be passed to global_envelope_test.

Value

An object of class "global_envelope", "envelope" and "fv" (see fv.object), which can be printed and plotted directly.

Essentially a data frame containing columns

Additionally, the return value has attributes

and a punch of attributes for the "fv" object type.

References

Myllymäki, M., Grabarnik, P., Seijo, H. and Stoyan. D. (2015). Deviation test construction and power comparison for marked spatial point patterns. Spatial Statistics 11: 19-34. doi: 10.1016/j.spasta.2014.11.004

Myllymäki, M., Mrkvička, T., Grabarnik, P., Seijo, H. and Hahn, U. (2017). Global envelope tests for spatial point patterns. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 381–404. doi: 10.1111/rssb.12172

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Testing complete spatial randomness (CSR)
#-------------------------------------------
require(spatstat)
pp <- spruces
## Test for complete spatial randomness (CSR)
# Generate nsim simulations under CSR, calculate L-function for the data and simulations
env <- envelope(pp, fun="Lest", nsim=999, savefuns=TRUE, correction="translate",
                simulate=expression(runifpoint(pp$n, win=pp$window)))
# The directional quantile envelope test
res <- qdir_envelope(env)
plot(res)
# or (requires R library ggplot2)
plot(res, plot_style="ggplot2")

## Advanced use:
# Create a curve set, choosing the interval of distances [r_min, r_max]
curve_set <- crop_curves(env, r_min = 1, r_max = 8)
# For better visualisation, take the L(r)-r function
curve_set <- residual(curve_set, use_theo = TRUE)
# The directional quantile envelope test
res <- qdir_envelope(curve_set); plot(res, plot_style="ggplot2")

## Random labeling test
#----------------------
# requires library 'marksummary'
mpp <- spruces
# Use the test function T(r) = \hat{L}_m(r), an estimator of the L_m(r) function
curve_set <- random_labelling(mpp, mtf_name = 'm', nsim=2499, r_min=1.5, r_max=9.5)
res <- qdir_envelope(curve_set)
plot(res, plot_style="ggplot2", ylab=expression(italic(L[m](r)-L(r))))

myllym/GET documentation built on Sept. 30, 2018, 5:49 a.m.