Skip to contents

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 'explore'
coef(object, iter = NULL, progress = TRUE, ...)

Arguments

object

An Object of class explore.

iter

Number of iterations (posterior samples; defaults to the number in the object).

progress

Logical. Should a progress bar be included (defaults to TRUE) ?

...

Currently ignored.

Value

An object of class coef, containting two lists.

  • betas A list of length p, each containing a p - 1 by iter matrix of posterior samples

  • object An object of class explore (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

# data
Y <- ptsd[,1:4]

##########################
### example 1: ordinal ###
##########################

# fit model (note + 1, due to zeros)
fit <- explore(Y + 1,
               type = "ordinal",
               iter = 250,
               progress = FALSE)

# summarize the partial correlations
reg <- coef(fit, progress = FALSE)

# summary
summ <- summary(reg)

summ
#> BGGM: Bayesian Gaussian Graphical Models 
#> --- 
#> Type: ordinal 
#> Formula: ~ 1 
#> --- 
#> Call: 
#> explore(Y = Y + 1, type = "ordinal", iter = 250, progress = FALSE)
#> --- 
#> Coefficients: 
#>  
#> B1: 
#>  Node Post.mean Post.sd Cred.lb Cred.ub
#>    B2     0.242   0.103   0.009   0.428
#>    B3     0.141   0.120  -0.104   0.375
#>    B4     0.399   0.093   0.206   0.565
#> 
#> B2: 
#>  Node Post.mean Post.sd Cred.lb Cred.ub
#>    B1     0.223   0.096   0.007   0.400
#>    B3     0.544   0.091   0.342   0.693
#>    B4     0.013   0.091  -0.176   0.192
#> 
#> B3: 
#>  Node Post.mean Post.sd Cred.lb Cred.ub
#>    B1     0.112   0.094  -0.072   0.296
#>    B2     0.483   0.083   0.313   0.626
#>    B4     0.280   0.091   0.105   0.453
#> 
#> B4: 
#>  Node Post.mean Post.sd Cred.lb Cred.ub
#>    B1     0.399   0.091   0.202   0.566
#>    B2     0.016   0.099  -0.174   0.213
#>    B3     0.343   0.105   0.151   0.549
#> 
# }