dg.global_envelope: Adjusted global envelope tests

Description Usage Arguments Details Value References See Also

View source: R/adjusted_envelopes.r

Description

Adjusted global rank envelope test, studentized envelope test and directional quantile envelope test.

Usage

1
2
3
4
5
6
dg.global_envelope(X, nsim = 499, nsimsub = nsim, simfun = NULL,
  fitfun = NULL, ..., type = c("rank", "qdir", "st"), alpha = 0.05,
  alternative = c("two.sided", "less", "greater"), r_min = NULL,
  r_max = NULL, take_residual = FALSE, save.cons.envelope = savefuns ||
  savepatterns, savefuns = FALSE, savepatterns = FALSE, verbose = TRUE,
  mc.cores = 1L)

Arguments

X

An object containing point pattern data. A point pattern (object of class "ppp") or a fitted point process model (object of class "ppm" or "kppm"). See envelope.

nsim

The number of simulations to be generated in the primary test.

nsimsub

Number of simulations in each basic test. There will be nsim repetitions of the basic test, each involving nsimsub simulated realisations, so there will be a total of nsim * (1 + nsimsub) simulations.

simfun

A function for generating simulations from the null model. If given, this function is called by replicate(n=nsim, simfun(simfun.param), simplify=FALSE) to make nsim simulations. The function should return an ppp object as those are further passed to envelope. If the function is not provided, then envelope is used also for generating the point patterns from the null hypothesis.

fitfun

A function for estimating the parameters of the null model. If not given, then envelope takes care of the parameter estimation as well (and X should be a fitted model object). The function 'fitfun' should return the fitted model in the form that it can be directly passed to 'simfun' as the argument 'simfun.arg'.

...

Additional parameters passed to envelope. For example, the test function in the argument 'fun' and further specifications regarding that. If envelope is also used to generate simulations under the null hypothesis (if simfun not provided), then also recall to specify how to generate the simulations.

type

Either "rank" for the rank_envelope test, "qdir" for the qdir_envelope test or "st" for the st_envelope test.

alpha

The significance level. The 100(1-alpha)% global envelope will be calculated.

alternative

A character string specifying the alternative hypothesis. Must be one of the following: "two.sided" (default), "less" or "greater" for "rank". Relevant only for the rank test (otherwise ignored).

r_min

The minimum radius to include in the test.

r_max

The maximum radius to include in the test. Note: cannot be larger than r-values used in calculating functions by envelope.

take_residual

If (needed for visual reasons only) the theoretical or mean behaviour of the test function is reduced from the test functions. If TRUE, then: If envelope provides the theoretical value 'theo' for the simulated model, then this value is used. Otherwise, the theoretical function is taken as the mean of the simulations.

save.cons.envelope

Logical flag indicating whether to save the unadjusted envelope test results.

savefuns

Logical flag indicating whether to save all the simulated function values. See envelope.

savepatterns

Logical flag indicating whether to save all the simulated point patterns. See envelope.

verbose

Logical flag indicating whether to print progress reports during the simulations. See envelope.

mc.cores

The number of cores to use, i.e. at most how many child processes will be run simultaneously. Must be at least one, and parallelization requires at least two cores. On a Windows computer mc.cores must be 1 (no parallelization). For details, see mclapply, for which the argument is passed.

Details

The specification of X is important here:

1) If simfun = NULL and fitfun = NULL (default), then envelope is used for generating simulations under the null hypothesis and

2) The user can provide the function for fitting the model (fitfun) and for simulating from the fitted model (simfun). These functions should be coupled with each other such that the object returned by 'fitfun' is directly accepted as the (single) argument in 'simfun'. Further X should then be an ppp object and 'fitfun' should accept as the argument an ppp object (X and further simulated point patterns).

A note: The structure of the code, which utilizes envelope though the function global_envelope_with_sims, mimics the structure in the function dg.envelope in the use of envelope. However, this function allows for more general use as described above.

Value

An object of class adjusted_envelope_test.

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.

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

See Also

rank_envelope, qdir_envelope, st_envelope, plot.adjusted_envelope_test, saplings


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