beta_prior_helper: Generate candidates for beta prior parameters

View source: R/veg_cover_functions.R

beta_prior_helperR Documentation

Generate candidates for beta prior parameters

Description

This function can be used to explore alternative beta distributions to use with the beta_prior argument of functions get_cover_quantiles and get_cover_difference. It returns parameter values of distributions corresponding to a prior expected value for stratum vegetation cover and, optionally, draws a graph of the alternative distributions.

Usage

beta_prior_helper(cover, a = c(2, 4, 8, 16), plot = FALSE)

Arguments

cover

Expected value (i.e. maximum likelihood value) of vegetation cover. Must be a single value greater than 1.0.

a

Candidate values for the first parameter of the beta distribution. Default is c(2, 4, 8, 16).

plot

A logical value (default is FALSE) specifying whether to draw a graph of the beta distributions.

Details

This function interprets the expected vegetation cover value as the mode of the beta distribution, i.e. the maximum likelihood value. For this reason it will only accept values greater than 1.0 for the first beta parameter (argument 'a'). A beta(1,1) distribution is equivalent to a uniform distribution of cover values, while beta(a, b) distributions with a < 1 are concave, i.e. the mode is undefined.

Given an expected (maximum likelihood) cover value, and candidate values for the first beta parameter, the function calculates corresponding values for the second beta parameter and returns a matrix with columns for the beta parameters (named 'a' and 'b'), and summary statistics.

Value

A matrix with columns for the beta parameters ('a' and 'b') plus columns for the median cover and the c(0.05, 0.95) quantiles (end-points of central 90% interval). The input expected cover value is attached as the attribute "cover".

Examples

# Return parameter values and draw a graph of beta distributions for
# an expected stratum cover value of 40\%
params <- beta_prior_helper(0.4, plot=TRUE)

# Retrieve the input expected cover value used for calculations
attr(params, "cover")


mbedward/CERMBlidar documentation built on April 10, 2024, 2:05 p.m.