Skip to contents

This function takes in the output from a sparta occupancy model and rescales the posteriers so that the gemean for each species is the same in the first year. This function accounts for species that have no data at the beginning of the period, by bringing them in at the geomean, and those that have no data at the end of the period, by applying a multiplier to the result of the species data.

Usage

rescale_posterior(
  input_dir,
  subset_table = NULL,
  index = 100,
  max = 10000,
  min = 1,
  year_limit = 10,
  upperQuantile = 0.975,
  lowerQuantile = 0.025,
  verbose = TRUE
)

Arguments

input_dir

the location of occupancy model output files

subset_table

dataframe with columns for years and rows for species. Column names must be character years and row names must match the file names in input_dir

index

The index value for the first year, defaults to 100.

max

The upper limit allowed for scaled values. Values greater than this will be set equal to max.

min

The upper limit allowed for scaled values. Values greater than this will be set equal to min.

year_limit

The minimum length of 'good years' for a species to be included

upperQuantile

The upper confidence interval to use (as a probability)

lowerQuantile

The lower confidence interval to use (as a probability)

verbose

If TRUE progress is written to console

Value

A list with two elements, a summary (data.frame) and the rescaled data (list)

Details

There are two options for calculating confidence intervals; the first is to use the 95 is to calculate the indicator line for each iteration (given in the posterior data) and then to present the 97.5 and 2.5 quantiles of these lines. Both are returned in the summary table.