View source: R/post_distance_within.R
post_distance_within | R Documentation |
This function computes distances between posterior samples of a
single fitted GVAR model. Thereby, it calculates the uncertainty contained
in the posterior distribution, which can be used as a reference to compare
two modes. Distances can be obtained either from posterior samples or
posterior predictive draws. The distance between two models can currently
be calculated based on three options: Frobenius norm, maximum difference,
or L1 norm. Used within compare_gvar
. The function is not intended to
be used directly by the user.
post_distance_within(
fitobj,
comp,
pred,
n_draws = 1000,
sampling_method = "random",
indices = NULL,
burnin = 0
)
fitobj |
Fitted model object. This can be a tsnet_fit object
(obtained from |
comp |
The distance metric to use. Should be one of "frob" (Frobenius
norm), "maxdiff" (maximum difference), or "l1" (L1 norm) (default:
|
pred |
A logical indicating whether the input is posterior predictive
draws (TRUE) or posterior samples (FALSE). Default: |
n_draws |
The number of draws to use for reference distributions
(default: |
sampling_method |
Draw sequential pairs of samples from the posterior,
with certain distance between them ("sequential") or randomly from two
halves of the posterior ("random"). The "random" method is preferred to
account for potential autocorrelation between subsequent samples. Default:
|
indices |
A list of "beta" and "pcor" indices specifying which elements
of the matrices to consider when calculating distances. If |
burnin |
The number of burn-in iterations to discard (default: |
A list of distances between the specified pairs of fitted models. The list has length equal to the specified number of random pairs. Each list element contains two distance values, one for beta coefficients and one for partial correlations.
data(fit_data)
post_distance_within(fitobj = fit_data[[1]],
comp = "frob",
pred = FALSE,
n_draws = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.