sample_per_decrease: A Function to Sample the Annual Percentage Decrease with...

Description Usage Arguments Value Examples

View source: R/sample_per_decrease.R

Description

A Function to Sample the Annual Percentage Decrease with Uncertainty

Usage

1
2
sample_per_decrease(df, max_year = NULL, min_year = NULL,
  samples = 100, years_to_avg = 3)

Arguments

df

A dataframe containing a year variable and with the second variable being the one to sample from.

max_year

Numeric, set as greater than the maximum year in the dataframe if interested in projection. Defaults to NULL. If specified, then an average of the percentage decrease for a set number of years is taken. This is specified with years_to_avg.

min_year

Numeric, set as smaller than the minimum year in the dataframe if interested in backwards projection. Defaults to NULL. If specified, then an average of the percentage decrease for a set number of years is taken. This is specified with years_to_avg.

samples

Numeric, the number of samples to take.

years_to_avg

Numeric, the number of years over which to average the percentage decrease when estimating the ongoing percentage decrease.

Value

A dataframe containing annual percentage decrease samples.

Examples

1
2
3
 df <- data.frame(year = c(2000:2010), measure = seq(10, 110, 10))

sample_per_decrease(df, samples = 2)

seabbs/AssessBCGPolicyChange documentation built on Dec. 24, 2019, 11:56 a.m.