get_likelihood_category | R Documentation |
Given a probabiliy p it returns the term used to describe the category this probability belongs to. It ensures the levels of the output are ordered appropietly.
get_likelihood_category(p, scale = c("statsnz", "ipcc"),
term_type = c("worsening-improving", "improving-worsening",
"increasing-decreasing", "decreasing-increasing", "likely-unlikely"),
p_is = c("probability", "percentage"))
p |
the probability (or percentage) used to caclulate the category |
scale |
whether to base the categories using the Statistics New Zealand likelihood scale ("statsnz") or the IPCC scale ("ipcc") |
term_type |
when |
p_is |
whether |
This function uses the data contained in the statsnz_likelihood_scale
and ipcc_likelihood_scale tables to determine the category of a given
probability (usually a p-value). It uses
order_likelihood_levels
to ensure that levels of the output are
ordered correctly.
a character
Other likelihood functions: order_likelihood_levels
,
simplify_likelihood_levels
p <- seq(0, 1, length.out = 11)
# In most water quality metrics an increasing trend (large p) corresponds to
# a worsening trend
get_likelihood_category(p, term_type = "worsening-improving") %>%
order_likelihood_levels()
# In climate metrics we usually prefer an increasing-decreasing scale
get_likelihood_category(p, term_type = "increasing-decreasing") %>%
order_likelihood_levels()
# Also works when p is a percentages
get_likelihood_category(p*100, p_is = "percentage") %>%
order_likelihood_levels()
# We can also get terms used by ipcc if desired
get_likelihood_category(p, scale = "ipcc") %>%
order_likelihood_levels()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.