thresh_sm: A plot that summarised the relationship between a variable...

View source: R/threshold_small_multiple.R

thresh_smR Documentation

A plot that summarised the relationship between a variable and an aggregated output that depends on it.

Description

The plot is created by calculating, within each group, the proportion of observations that are above a threshold. A scatter plot with a linear model is plotted of the relationship between this proportion and the aggregated output. The threshold is varied and small multiples of the different values are plotted.

Usage

thresh_sm(
  formula,
  data,
  ID = ID,
  weights = weights,
  small_mult = 6,
  lower_percentile = 0.05,
  upper_percentile = 0.95
)

Arguments

formula

A formula for the y and x variables.

data

A data frame suitable for aggregate outputs models.

ID

The column to use as the group ID column. Unquoted value.

weights

Which column to use as within group weights such as population or time.

small_mult

How many small multiples to make.

lower_percentile

Lowest percentile to use

upper_percentile

Highest percentile to use

Examples

data(madagascar_malaria)
thresh_sm(case_rate ~ LSTmean, data = madagascar_malaria, ID = ID, weights = pop)

timcdlucas/agouti documentation built on Feb. 8, 2024, 6:12 p.m.