sctest_p: Compute the structural change p-values for a spatiotemporal...

Description Usage Arguments Details Value Examples

View source: R/sctest_p.R

Description

This function executes strucchange::sctest for a spatiotemporal dataset as a pre-processing step before BFAST analysis.

Usage

1
2
3
sctest_p(data_layers, obs_per_year, processingGeometry = NULL,
  subset_values = NULL, nodata_threshold = c(0.05, 4), h = 0.15,
  season = "harmonic", type = "OLS-MOSUM", impute = FALSE, mc.cores = 1)

Arguments

data_layers

A RasterBrick or RasterStack object. A RasterBrick is preferable to reduce processing time.

obs_per_year

A number indicating the number of observations in the time series per year. For example, this argument should be set to 12 for monthly data. For MODIS 16-day aggregates, this should be set to 23 (365/16, rounded to nearest integer.)

processingGeometry

An optional RasterLayer, SpatialPolygons, or SpatialPolygonsDataFrame object that demarcates the boundary in which the function will operate. This argument will also take a RasterStack or RasterBrick object and compute the boundary based on the intersected region.

subset_values

A vector or list of vectors that specifies which pixel values to select in processingGeometry. If class(processingGeometry) is "RasterStack" or "RasterBrick", this argument must be a list of vectors and must be matched in order of layer. Ignored if processingGeometry is a vector dataset.

nodata_threshold

A numeric vector of length 2. The first entry is the proportion of missing data points in each time series above which the function will not execute and return NA for all fields. The second entry is the number of consecutive missing data points above which the function will not execute and return NA for all fields.

h

See documentation for strucchange::efp() for more details.

season

See documentation for bfast::bfast() for more details.

type

See documentation for strucchange::efp() for more details.

impute

A logical indicating whether the function should linearly interpolate through time series with missing data if the time series does not exceed the thresholds defined by nodata_threshold.

mc.cores

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

Details

The minimum p-value that sctest can return is 0.01. It is unclear if this is a representative value for all p-values less than or equal to 0.01 or if all p-values at 0.01 are indeed exactly equal to 0.01. This subtle detail is important for performing p-value adjustments. For example, if many p-values are actually much smaller than 0.01, the adjusted p-value may flag them as not significant as a result of having them set at the nominal 0.01 level.

Value

A data frame with two columns: no_cell and sc.p. no_cell is the cell number (starting from 1 at the top-left of the raster grid and increasing by row). sc.p is the structural change test p-value.

Examples

1
2
3
4
## Not run: 
sctest_p(mod.brick, monthly=TRUE, processingGeometry=raster("C:/Desktop/boundary.tif"), subset_values=1, mc.cores=6)

## End(Not run)

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