There is a direct correspondence between the inverse covariance matrix and multiple regression (Kwan 2014; Stephens 1998) . This readily allows for converting the GGM parameters to regression coefficients. All data types are supported.
Usage
# S3 method for class 'estimate'
coef(object, iter = NULL, progress = TRUE, ...)
Value
An object of class coef
, containting two lists.
betas
A list of length p, each containing a p - 1 byiter
matrix of posterior samplesobject
An object of classestimate
(the fitted model).
References
Kwan CC (2014).
“A regression-based interpretation of the inverse of the sample covariance matrix.”
Spreadsheets in Education, 7(1), 4613.
Stephens G (1998).
“On the Inverse of the Covariance Matrix in Portfolio Analysis.”
The Journal of Finance, 53(5), 1821–1827.
Examples
# \donttest{
# note: iter = 250 for demonstrative purposes
#########################
### example 1: binary ###
#########################
# data
Y = matrix( rbinom(100, 1, .5), ncol=4)
# fit model
fit <- estimate(Y, type = "binary",
iter = 250,
progress = TRUE)
#> BGGM: Posterior Sampling
#> BGGM: Finished
# summarize the partial correlations
reg <- coef(fit, progress = FALSE)
# summary
summ <- summary(reg)
summ
#> BGGM: Bayesian Gaussian Graphical Models
#> ---
#> Type: binary
#> Formula: ~ 1
#> ---
#> Call:
#> estimate(Y = Y, type = "binary", iter = 250, progress = TRUE)
#> ---
#> Coefficients:
#>
#> 1:
#> Node Post.mean Post.sd Cred.lb Cred.ub
#> 2 -0.092 0.310 -0.690 0.556
#> 3 -0.079 0.333 -0.634 0.685
#> 4 0.014 0.336 -0.586 0.620
#>
#> 2:
#> Node Post.mean Post.sd Cred.lb Cred.ub
#> 1 -0.101 0.271 -0.651 0.387
#> 3 0.160 0.346 -0.585 0.798
#> 4 0.264 0.266 -0.296 0.734
#>
#> 3:
#> Node Post.mean Post.sd Cred.lb Cred.ub
#> 1 -0.074 0.310 -0.613 0.600
#> 2 0.158 0.368 -0.645 0.811
#> 4 0.157 0.286 -0.500 0.670
#>
#> 4:
#> Node Post.mean Post.sd Cred.lb Cred.ub
#> 1 0.022 0.310 -0.539 0.602
#> 2 0.290 0.289 -0.282 0.814
#> 3 0.149 0.294 -0.541 0.647
#>
# }