pcf_calc: Compute pair correlation function for breakpoint distribution

Description Usage Arguments Details Value Examples

View source: R/pcf_calc.R

Description

This function computes the pair correlation function (PCF) for the point pattern of breakpoints. The PCF estimates g for a given radius distance r, where g represents the degree of clustering.

Usage

1
2
pcf_calc(bfast_in, level = 0.05, boundary, template, resample_dist = NULL,
  max.dist = NULL, output_directory = NULL, mc.cores = 1)

Arguments

bfast_in

A data frame generated by bfastSpatial().

level

A number indicating the significance level for the pointwise Monte Carlo test. See the documentation for spatstat::envelope() for more details. If level=NA, no envelope will be simulated.

boundary

A SpatialPolygons object defining the boundary of the PCF analysis. If this argument is not supplied, all records in bfast_in will be used.

template

A Raster object with the same resolution, extent, and projection as the raster dataset used to generate bfast_in. Alternatively, an XML file generated by create_raster_metadata().

resample_dist

An optional number indicating the square dimension to which the breakpoint pattern raster should be resampled. This argument is in the same units as the projection of template. If not supplied, no resampling will occur and points will be generated based on the resolution of template.

max.dist

The maximum radius distance to which the PCF calculation should be performed. If not supplied, the default is the diagonal distance across boundary.

output_directory

An optional character file path to a directory to which the PCF calculations for each year and month should be written in .rds format. The radius distances for which the PCF was computed will also be written here.

mc.cores

A numeric indicating the number of cores to be used in parallel computing.

Details

This function is a convenient wrapper for spatstat::pcf() and spatstat::envelope(). Most default values in pcf and envelope are accepted. However, the translation correction is used here.

If level is not set to NA, a simulation envelope will be computed according to the number of simulations needed to achieve level. However, the simulation process is very time-consuming so setting level=NA may be best choice for reasonable processing times.

The returned data frame has the following fields:

  1. year: The year of the observation.

  2. month: The month of the observation.

  3. type: The type of statistic for g.

  4. g: The value of g for the given type.

  5. dist: The radius distance.

  6. upper.bound, lower.bound: The upper/lower bound of the simulation envelope at distance dist.

  7. nsim: The number of simulations to produce the envelope.

  8. sig.level: The significance level of the pointwise Monte Carlo test.

Value

A list of length 2. The first item is a data frame summarizing the PCF results. The second item is the vector of radius distances.

Examples

1
2
3
4
## Not run: 
pcf_calc(bf_df, NA, rgdal::readOGR(dsn="C:/Desktop/shapefiles", layer="Mojave"), template, 2000, "C:/Desktop/PCF_files", 6)

## End(Not run)

jnghiem/bfasttools documentation built on Nov. 4, 2019, 3:02 p.m.