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 |
a character
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.
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()#> [1] Very likely improving Likely improving Likely improving #> [4] Likely improving Indeterminate Indeterminate #> [7] Indeterminate Likely worsening Likely worsening #> [10] Likely worsening Very likely worsening #> 5 Levels: Very likely improving Likely improving ... Very likely worsening# In climate metrics we usually prefer an increasing-decreasing scale get_likelihood_category(p, term_type = "increasing-decreasing") %>% order_likelihood_levels()#> [1] Very likely increasing Likely increasing Likely increasing #> [4] Likely increasing Indeterminate Indeterminate #> [7] Indeterminate Likely decreasing Likely decreasing #> [10] Likely decreasing Very likely decreasing #> 5 Levels: Very likely increasing Likely increasing ... Very likely decreasing# Also works when p is a percentages get_likelihood_category(p*100, p_is = "percentage") %>% order_likelihood_levels()#> [1] Very likely improving Likely improving Likely improving #> [4] Likely improving Indeterminate Indeterminate #> [7] Indeterminate Likely worsening Likely worsening #> [10] Likely worsening Very likely worsening #> 5 Levels: Very likely improving Likely improving ... Very likely worsening# We can also get terms used by ipcc if desired get_likelihood_category(p, scale = "ipcc") %>% order_likelihood_levels()#> [1] Exceptionally unlikely Unlikely Unlikely #> [4] Unlikely About as likely as not About as likely as not #> [7] About as likely as not Likely Likely #> [10] Likely Virtually certain #> 9 Levels: Virtually certain Extremely likely Very likely ... Exceptionally unlikely