Description Usage Arguments Value Author(s) Examples
View source: R/f_convenience_getmatrix.R
This function will extract an estimated matrix, and will either return a single matrix for single group models or a list of such matrices for multiple group models.
1 |
x |
A |
matrix |
String indicating the matrix to be extracted. |
group |
Integer indicating the group for the matrix to be extracted. |
A matrix of parameter estimates, of a list of such matrices for multiple group models.
Sacha Epskamp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Load bfi data from psych package:
library("psychTools")
data(bfi)
# Also load dplyr for the pipe operator:
library("dplyr")
# Let's take the agreeableness items, and gender:
ConsData <- bfi %>%
select(A1:A5, gender) %>%
na.omit # Let's remove missingness (otherwise use Estimator = "FIML)
# Define variables:
vars <- names(ConsData)[1:5]
# Let's fit a full GGM:
mod <- ggm(ConsData, vars = vars, omega = "full")
# Run model:
mod <- mod %>% runmodel
# Obtain network:
mod %>% getmatrix("omega")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.