Learn R Programming

BGGM (version 1.0.0)

confirm: Confirmatory Hypothesis Testing

Description

Traditionally, Gaussian graphical models are inherently exploratory. That is, automated model selection is performed. A key aspect of BGGM is the ability to extend inference beyond exploratory and to confirmatory hypothesis testing. This is accomplished by testing equality and/or inequality constraints for sets of edges (partial correlations).

Usage

confirm(Y, hypothesis, prior_sd = 0.25, iter = 25000, cores = 2)

Arguments

Y

data matrix (n by p).

hypothesis

hypothesis (or hypotheses) to be tested

prior_sd

hypothesized standard deviation of the prior distribution

iter

posterior and prior samples. 25,000 is the default, as it results in a more stable Bayes factor than using, say, 5,000.

cores

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

Value

list of class confirm:

  • BF_matrix matrix of Bayes factors for each hypothesis. Also includes the compliment

  • post_prob posterior hypothesis probabilities

  • hypotheses hypothesis

  • call match.call()

  • p number of variables

  • n number of observations

  • iter number of posterior samples

  • delta hyperparameter of matrix-F prior distribution (corresponds to prior_sd)

  • parcors_mat partial correlation matrix

  • returned_mats contrast matrices

Examples

Run this code
# NOT RUN {
# p = 10
Y <- BGGM::bfi[,1:10]

# hypothesis
hypothesis <- c("1--2 > 1--3 > 1--4 > 1--5")

# test inequality contraint
test_order <-  confirm(Y = Y, hypothesis  = hypothesis,
                      prior_sd = 0.5, iter = 50000,
                      cores = 2)
# summary
summary(test_order)


# test hypothesized directions

# hypothesis
hypothesis <- c("(1--2, 1--3, 1--4)  <  0 < (1--6)")

# test directions
test_directions <-  confirm(Y = Y, hypothesis  = hypothesis,
                      prior_sd = 0.5, iter = 50000,
                      cores = 2)
# summary
summary(test_directions)
# }

Run the code above in your browser using DataLab