Skip to content

Accessing latent structure in ESEM #39

Description

@Muhsam23

Dear Sacha,
I have the following problem: I have a large sample of psychometric data and I want to generate a model based on ESEM. I used your code provided in https://ftp2.uib.no/cran/web/packages/psychonetrics/psychonetrics.pdf. All seems to run normal. mod1 has a very good fit according to AIC/BIC. However, I am unsure how to access the generated model so i can try to reproduce it on a second sample. I am currently using the following code:

library("psychonetrics")
library(tidyverse)
library(lavaan)
library(semPlot)

vars <- names(data)[1:34]
mod_saturated <- ggm(data, vars = vars)
mod_saturated <- mod_saturated %>% runmodel
mod_saturated %>% parameters
labels <- c(
"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", "27", "28", "29", "30", "31", "32", "33", "34")
CIplot(mod_saturated, "omega", labels = labels, labelstart = 0.2)
mod0 <- ggm(data, vars = vars, omega = "zero")
mod0 <- mod0 %>% runmodel
mod0 %>% MIs
mod1 <- mod0 %>% stepup
mod1 <- mod1 %>% prune
mod1 %>% fit
compare(baseline = mod0, adjusted = mod1)
mod1 %>% parameters
getmatrix(mod1, "omega")

getVCOV(mod1, approximate_SEs = FALSE)

I tried using:

semPaths(mod1, "std", "est", as.expression = "nodes")

but i get:
Error: cannot find an inherited method for function ‘semPlotModel_S4’ for signature ‘object = "psychonetrics"’

Sorry for the noob question and thank you for your great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions