BlockBootID {ecostats}R Documentation

Construct a moving block bootstrap resampling scheme

Description

A spatial moving block bootstrap resampling scheme is constructed, that can then be used in resampling-based inference (e.g. using anova.manyglm). Blocks are constructed as discs or tiles of observations of a user-specified size and shape.

Usage

BlockBootID(
  x,
  y,
  block_L,
  nBoot = 499,
  Grid_space,
  lookuptables.folderpath = NA,
  shape = "disc",
  ...
)

Arguments

x

the easting of spatial coordinate for the site.

y

the northing of the spatial coordinate for the site.

block_L

the size of the spatial blocks to be resampled.

nBoot

the number of resamples required (defaults to 499).

Grid_space

the resolution of the lattice used to sample centres of spatial blocks. Defaults to a third of the resolution of block_Ls.

lookuptables.folderpath

(optional) path to a directory where lookup tables can be found that assign observations to spatial blocks. Such tables would considerably speed up the process.

shape

shape of the spatial blocks to resample. Default is disc, but square tiles can also be specified.

...

additional arguments passed to resample_blocks_by_area.

Details

A spatial moving block bootstrap resampling scheme is constructed, that can then be used in resampling-based inference. A matrix of IDs is returned, with different resamples in different rows of the matrix, which can be used as input to functions designed for resampling-based inference (such as anova.manyglm).

Blocks are constructed as discs or tiles of observations, whose size is controlled by blockl_L, these blocks are kept together in resampling. The centre of each block is chosen at random along a lattice specified via Grid_space.

The most computationally intensive part of this process is working out which observations belong in which blocks. If repeated analyses are to be undertaken in the same spatial domain using the same sites, it is best to run this process only once and save the result as a set of lookup tables. Then the path to the directory containing these tables is specified via lookuptables.folderpath and the whole thing runs heaps faster.

Value

A matrix of IDs for each moving block bootstrap resample, with different resamples in rows and observations in columns.

Author(s)

Eve Slavich <eve.slavich@unsw.edu.au>

See Also

anova.manyglm, lm

Examples


data(Myrtaceae)
# fit a lm:
library(mvabund)
Myrtaceae$logrich=log(Myrtaceae$richness+1)
mft_richAdd = manylm(logrich~soil+poly(TMP_MAX,degree=2)+
                     poly(TMP_MIN,degree=2)+poly(RAIN_ANN,degree=2),
                                        data=Myrtaceae)
                                        
# construct a boot ID matrix: 
BootID = BlockBootID(x = Myrtaceae$X, y = Myrtaceae$Y, block_L = 20,
            nBoot = 199, Grid_space = 5)
anova(mft_richAdd,resamp="case",bootID=BootID)



[Package ecostats version 1.1.11 Index]