bd_calc_relative_density: For each sample, calculate the time it takes for the density...

Description Usage Arguments Details Value

View source: R/bd_calc_decay_time_from_peak.R View source: R/bd_calc_relative_density.R

Description

For each sample, calculate the time it takes for the density to decrease by half from the peak

Calculate the relative density at two dates (or a range of dates / the peak)

Usage

1
2
3
bd_calc_relative_density(soln, spec1, spec2, ind = NA, anal = NA)

bd_calc_relative_density(soln, spec1, spec2, ind = NA, anal = NA)

Arguments

soln

The result of a call to bd_do_inference

spec1

The specification for the first density (see details)

spec2

The specification for the second density (see details)

ind

(Optional) Indices at which to do the calculation. By default, all the samples in anal are used.

anal

The result of a call to bd_analyze_soln

propChange

(Default 0.5) The proportional

anal

(Optional) The result of a call to bd_analyze_soln. This is only needed if either spec1 or spec2 is 'peak'

soln

The result of a call to bd_do_inference

anal

The result of a call to bd_analyze_soln

spec2

The specification for the second density (see details)

ind

(Optional) Indices at which to do the calculation. By default, all the samples in anal are used.

anal

(Optional) The result of a call to bd_analyze_soln. This is only needed if either spec1 or spec2 is 'peak'

Details

Calculate the relative density for two dates or, more generally, for two

Calculate the relative density for two dates or, more generally, for two different specifications of the density aside from a simple date. The additional specifications that are supported are the peak value and the mean density on an interval. For a simple date, spec1/spec2 should be scalar real numbers. For a date range, spec1/spec2 should be real vectors with a length of 2. For the peak, spec1/spec2 should be the string 'peak'.

By default, this calculation is done for all the Bayesian samples in soln, which is the result of a call to bd_do_inference. Optionally, a subset can be specified via the input ind, which should be a vector of integer indices at which to do the calculation. To save computation if either spec1 or spec2 is 'peak', the result of a call to bd_analyze_soln for which doSummary was T can be input.

Value

A vector of relative densities (f_spec1 / f_spec2)

A vector of relative densities (f_spec1 / f_spec2)


MichaelHoltonPrice/BayDem documentation built on Sept. 12, 2019, 9:26 p.m.