Learn R Programming

BGGM (version 1.0.0)

ggm_compare_ppc.default: Compare GGMs with the Posterior Predictive Distribution

Description

Compare GGMs with the posterior predictive distribution. The method assume group equality, and the predictive check allows for testing whether that assumption should be modified--i.e., the GGMs are actually different. The current test statistic available is Kullback-Leibler divergence, which in this case, can be understood as a likelihood ratio for multivariate normal distributions. There are two options: (1) 'global' and (2) 'nodewise.' The former tests the entire GGM, whereas the latter allows for testing specific nodes (variables) in the model.

Usage

ggm_compare_ppc(..., type = "global", iter = 5000, cores = 1)

Arguments

...

data matrices (n by p). Requires at least two.

type

type = "global" for testing the entire precision matrix. type = "nodewise" for testing each node (i.e., variable)

iter

number of replicated data sets. default is iter = 1000.

cores

number of cores for parallel computing. The default is 2, but this can be adjusted.

Value

list of class ggm_compare_ppc:

  • pvalue posterior predictive p-values

  • obs_jsd observed symmetric KL divergence (Jensen-Shannon divergence)

  • predictive_risk list of predictive distributions

  • info list of information about the data matrices

    • dat list containing the data matrices

    • dat_info sample size for each data matrix

    • pairwise matrix of pairwise combinations

  • names contrast names (e.g.., Yg1 vs Yg2)

  • iter number of posterior samples

  • type "global"

  • call match.call()

Examples

Run this code
# NOT RUN {
# Assume null is true
Y1 <- MASS::mvrnorm(500, rep(0, 16), Sigma = diag(16))
Y2 <- MASS::mvrnorm(500, rep(0, 16), Sigma = diag(16))
Y3 <- MASS::mvrnorm(500, rep(0, 16), Sigma = diag(16))

# global predictive check (iter = 50 for demonstrative purposes)
ggm_ppc <- ggm_compare_ppc(Y1, Y2, Y3,
                           type = "global", iter = 50)
summary(ggm_ppc)

plot(ggm_ppc)

# nodewise
ggm_ppc  <- ggm_compare_ppc(Y1, Y2, Y3, type = "nodewise", iter = 50)

plot(ggm_ppc, log = TRUE)
# }

Run the code above in your browser using DataLab