compare_gvar | R Documentation |
This function compares two Bayesian Graphical Vector Autoregressive models using matrix norms to test if the observed differences between two models is reliable. It computes the empirical distance between two models based on their point estimates and compares them using reference distributions created from their posterior distributions. Returns the p-value for the comparison based on a decision rule specified by the user. Details are available in Siepe, Kloft & Heck (2024) <doi:10.31234/osf.io/uwfjc>.
compare_gvar(
fit_a,
fit_b,
cutoff = 5,
dec_rule = "or",
n_draws = 1000,
comp = "frob",
return_all = FALSE,
sampling_method = "random",
indices = NULL,
burnin = 0
)
fit_a |
Fitted model object for Model A. This can be a tsnet_fit object
(obtained from |
fit_b |
Fitted model object for Model B. This can be a tsnet_fit object
(obtained from |
cutoff |
The percentage level of the test (default: |
dec_rule |
The decision rule to be used. Currently supports default |
n_draws |
The number of draws to use for reference distributions
(default: |
comp |
The distance metric to use. Should be one of "frob" (Frobenius
norm), "maxdiff" (maximum difference), or "l1" (L1 norm) (default:
|
return_all |
Logical indicating whether to return all 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 class compare_gvar
) containing the results of the
comparison. The list includes:
sig_beta |
Binary decision on whether there is a significant difference between the temporal networks of A and B |
sig_pcor |
Binary decision on whether there is a significant difference between the contemporaneous networks of A and B |
res_beta |
The null distribution for the temporal networks for both models |
res_pcor |
The null distribution for the contemporaneous networks for both models |
emp_beta |
The empirical distance between the two temporal networks |
emp_pcor |
The empirical distance between the two contemporaneous networks |
larger_beta |
The number of reference distances larger than the empirical distance for the temporal network |
larger_pcor |
The number of reference distances larger than the empirical distance for the temporal network |
arguments |
The arguments used in the function call |
# use internal fit data of two individuals
data(fit_data)
test_res <- compare_gvar(fit_data[[1]],
fit_data[[2]],
n_draws = 100,
return_all = TRUE)
print(test_res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.