View source: R/veg_cover_functions.R
get_cover_quantiles | R Documentation |
This function takes a multi-band raster of LiDAR point counts for ground level and vegetation strata, arranged in increasing height order (i.e. ground is band 1), and returns a raster of vegetation cover estimates for strata. Estimates are based on a Bayesian approach, where the detection of stratum vegetation is viewed as a binomial sampling process. LiDAR points (i.e. discrete returns) from a stratum are treated as 'successes' while points from ground level and any lower strata are 'failures'. Under this model, the binomial probability of success is an estimator of vegetation cover, while the degree of certainty about the estimate will depend on the LiDAR point density. Selected quantiles for estimated cover are returned as raster bands for each stratum. The default is to calculate median cover and the central 90% bounds (5%, 50% and 95% quantiles) for each stratum. Optionally, the maximum likelihood estimate of mean cover can also be returned.
get_cover_quantiles(
rcounts,
probs = c(0.05, 0.5, 0.95),
mle = FALSE,
backgroundNA = TRUE,
beta_prior = c(1, 1)
)
rcounts |
A raster object with a band of point count data for each
vegetation stratum plus a band for the ground layer. Normally, this will be
a |
probs |
A numeric vector of one or more probability values specifying
the quantiles of vegetation cover. The default |
mle |
A logical value specifying whether the maximum likelihood estimate
(MLE) of mean cover should be returned in addition to any specified cover
quantiles. The MLE is the same value as that returned by the deprecated
function |
backgroundNA |
Controls what pixel value should be returned for a
stratum when there are no LiDAR points for the stratum, any lower strata or
ground. If set to |
beta_prior |
(Expert use only!) Either a numeric vector of two
values defining the prior beta distribution to use for all strata, or a
named list of two-element vectors where names match raster layer names for
vegetation strata (case-insensitive). The default is |
If we view the detection of vegetation within a stratum via discrete LiDAR
returns as a binomial sampling process, then we can make use of the
relationship between the binomial and beta distributions. For a given pixel,
if we have n
returns from vegetation within a stratum out of a total
of N
returns from that stratum or lower (including ground level), then
the distribution of the possible vegetation cover values for the stratum that
could result in the observed points counts will follow a beta distribution.
For the baseline no-data case (ie. no LiDAR returns from the stratum or
below, perhaps because higher strata blocked all LiDAR pulses), it is
reasonable to depict the possible cover distribution as uniform between 0 and
1, i.e. with no data we have no reason to prefer any cover value over any
other. This baseline can be represented as a beta(1, 1)
distribution
which, for quantile calculations, we refer to as the Bayesian prior
distribution of cover values. Most of the time this is probably what you
want to use. We use the LiDAR data within a pixel to update our
expectation of stratum cover from the flat prior beta(1, 1)
distribution to a beta(1+n, 1+n-N)
distribution. We can then summarize
this distribution via selected quantiles which can be output as raster
layers.
Sometimes, it might be preferable to adopt something other than a uniform
prior expectation for vegetation cover. For example, from previous studies
and/or expert knowledge we might expect that tree canopy cover will typically
be around 30%, relative to the pixel size being used for mapping, with a
certain degree of variation around this value. In this case, a beta
distribution can be chosen to represent this expectation (e.g.
beta(2,5)
) and specified for the stratum using the beta_prior
argument. See examples below.
In addition to quantiles of stratum vegetation cover, this function can be
used to calculate the simpler maximum likelihood estimate of mean cover
(MLE), equivalent to the value returned by the deprecated function
get_stratum_cover
. The MLE is the ratio of the number of LiDAR points
returned from within the stratum height range to the total number of points
returned between ground level and the top of the stratum. This value
corresponds to the mode of the beta distribution used to calculate quantiles,
assuming that the default beta(1,1)
prior distribution has been
specified.
A SpatRast
(terra
package) raster object with a layer
for each requested quantile within each stratum. For example, calculating
the default median plus 90% bounds (0.05 and 0.95 quantiles) for 5
vegetation strata would return a raster object with 15 layers. Layers are
arranged by stratum, then by quantile. Layer names have the form
stratum_q_prob
, e.g. 'TallShrub_q_0.5'
for the median (50%)
quantile. If the maximum likelihood cover estimate has been requested
(mle=TRUE
), this will appear before any quantile layers for each
stratum with a name of the form stratum_mle
.
get_cover_difference
beta_prior_helper
## Not run:
# Estimate quantiles of vegetation cover for each stratum corresponding to
# 50\
#
probs <- c(0.05, 0.25, 0.5, 0.75, 0.95)
rcover <- get_cover_quantiles(rcounts, probs)
# Alternatively, calculate the maximum likelihood cover estimate for each
# stratum. Note that this is insensitive to LiDAR point density, i.e. it provides
# no indication of the uncertainty associated with the estimates.
#
rcover_mle <- get_cover_quantiles(rcounts, probs = NULL, mle = TRUE)
# An example of setting 'informed' beta priors for two strata:
# 'LowShrub' and 'MediumTree', corresponding to an expectation of 25\
# for shrubs and 40\
# strata names. The default \code{beta(1,1)} prior will be used for other strata.
#
beta_prior <- list(lowshrub=c(2,4), mediumtree=c(2,2.5))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.