PSTestInit: Initialise the data for performing the Monte Carlo test for...

View source: R/PSTestInit.R

PSTestInitR Documentation

Initialise the data for performing the Monte Carlo test for preferential sampling

Description

PSTestInit returns the data in the neccessary format for use with the function PSTestRun.

Usage

PSTestInit(
  type,
  discrete,
  positions = NULL,
  times = NULL,
  poly = NULL,
  discrete_locations = NULL,
  areal_polygons = NULL,
  areal_poly_observations = NULL,
  n_prediction = 10000
)

Arguments

type

is a character string taking value 'spatial' or 'spacetime'.

discrete

is a logical value stating if the data are discrete spatial (i.e. areal data), or continous spatial (i.e. point-referenced data).

positions

give the coordinates of the observations in space and time. This argument only needs specifying when discrete==F. When discrete=F, this is either an object of class ppp or else it takes a data.frame with named values x and y. These give the coordinates of the observed points.

times

give the discrete times of the observed points. Only required in the spacetime setting (i.e. when type=='spacetime').

poly

this takes a polygon-style object defining the boundaries of the study region. This can be of class owin (from the spatstat package), SpatialPolygons (from the sp package) or sf (from the sf package). This argument is only required when when discrete==F.

discrete_locations

is an optional argument when discrete==T. It gives the locations of the population of areal units. This is useful to specify when the distances with respect to areal unit centroids is not desirable.

areal_polygons

Specifies the polygons defining the population of areal units. This argument only needs specifying when discrete==T. This takes an object of class owin (from the spatstat package), SpatialPolygons (from the sp package) or sf (from the sf package).

areal_poly_observations

this is a vector of indices denoting the polygons with complete data. This argument only needs specifying when discrete==T.

n_prediction

is an integer specifying the number of prediction locations to generate within poly. This argument only needs specifying when discrete==T.

Value

A named list for use with PSTestRun.

Examples

For detailed examples, see the vignette (i.e. run vignette('PSTestR')), or visit https://github.com/joenomiddlename/PStestR for more details.

See Also

PSTestRun


joenomiddlename/PStestR documentation built on March 26, 2022, 8:17 a.m.