# pcor_sum: Partial Correlation Sum In BGGM: Bayesian Gaussian Graphical Models

## Description

Compute and test partial correlation sums either within or between GGMs (e.g., different groups), resulting in a posterior distribution.

## Usage

 `1` ```pcor_sum(..., iter = NULL, relations) ```

## Arguments

 `...` An object of class `estimate`. This can be either one or two fitted objects. `iter` Number of iterations (posterior samples; defaults to the number in the object). `relations` Character string. Which partial correlations should be summed?

## Details

Some care must be taken when writing the string for `partial_sum`. Below are several examples

Just a Sum: Perhaps a sum is of interest, and not necessarily the difference of two sums. This can be written as

• `partial_sum <- c("A1--A2 + A1--A3 + A1--A4")`

which will sum those relations.

Comparing Sums: When comparing sums, each must be seperated by "`;`". For example,

• `partial_sum <- c("A1--A2 + A1--A3; A1--A2 + A1--A4")`

which will sum both and compute the difference. Note that there cannot be more than two sums, such that `c("A1--A2 + A1--A3; A1--A2 + A1--A4; A1--A2 + A1--A5")` will result in an error.

Comparing Groups:

When more than one fitted object is suppled to `object` it is assumed that the groups should be compared for the same sum. Hence, in this case, only the sum needs to be written.

• `partial_sum <- c("A1--A2 + A1--A3 + A1--A4")`

The above results in that sum being computed for each group and then compared.

## Value

An object of class `posterior_sum`, including the sum and possibly the difference for two sums.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26``` ```# data Y <- bfi # males Y_males <- subset(Y, gender == 1, select = -c(education, gender))[,1:5] # females Y_females <- subset(Y, gender == 2, select = -c(education, gender))[,1:5] # males fit_males <- estimate(Y_males, seed = 1, progress = FALSE) # fit females fit_females <- estimate(Y_females, seed = 2, progress = FALSE) sums <- pcor_sum(fit_males, fit_females, relations = "A1--A2 + A1--A3") # print sums # plot difference plot(sums)[[3]] ```

BGGM documentation built on Aug. 20, 2021, 5:08 p.m.