Description Usage Arguments Details Value
View source: R/bd_analyze_soln.R
bd_do_inference
calls Stan to do Bayesian inference by generating
a sample of parameters from the posterior of theta (or th).
This function analyzes the result of that inference.
In particular, it calculates the quantiles of the density function and growth rate.
1 2 | bd_analyze_soln(soln, y = NA, th_sim = NA, lev = 0.025,
rateProp = NA, doSummary = T)
|
soln |
The solution, a list-like object of class bd_soln (see |
y |
(optional) The calendar dates at which to evaluate densities. If y is not input, y is built from the hyperparameters. |
th_sim |
(optional) The known parameters used to create simulation data |
lev |
(default: 0.025) The level to use for the quantile bands |
rateProp |
(optional) The cumulative density needed to define rate growth bands |
doSummary |
Default TRUE Whether to summarize each sample by calling bd_summarize_sample |
soln
is the result of a call to bd_do_inference
.
It contains both the resulting samples and the parameters used in the inference,
such as the hyperparameters (see bd_do_inference
for further details).
The primary thing bd_analyze_soln
does is calculate quantiles of both
the parameterized density and growth rate. For example,
for a calendar date y each sample yields a density and growth rate.
The quantile is the value of the density or growth rate such that
a given proportion of samples are smaller than that value.
The probabilities used to calculate these quantiles are probs = c(lev, 0.5, 1-lev)
,
where lev
is the level (0.025 by default, so that 95
lie between the first and last quantile bands).
In addition, bd_analyze_soln
identifies calendar dates for which
the growth rate quantiles defined by lev
and 1 - lev
do not contain zero.
This indicates significant positive or negative growth for the density curve.
The output vector growthState
codes calendar dates by growth state as 'negative',
'zero', and 'positive'. For the Gaussian mixture parameterization of the density,
the rate is not typically meaningful near the calendar date boundaries where it
increases linearly as the calendar date goes to positive or negative infinity.
The parameter rateProp
provides control on how calendar dates are classified by
growth rate near these boundaries. In particular, the calendar dates with a cumulative
density (50
(for the upper boundary) are classified as 'missing' in growthState
.
By default, rateProp
is NA and no calendar dates are classified as missing.
By default, a summary is done for each sample by calling bd_summarize_sample. This is not done of doSummary is FALSE
A list with information on the quantiles of the density function and growth rate (and sample summaries)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.