2

I want to extract the individual group chi square values from lavaan output that is provided when conducting multiple, known group sem models. Only the total chi square is provided as a fitMeasure, and the chi square values are not treated as individual estimates in parameterEstimates. There doesn't appear to be any other automated method for extracting this information.

I have been able to use the capture.output() function, and from there I can find the heading for the chi square values, and count the number of lines of values based on the number of groups + 1. Then I can use strsplit() to split on spaces and finally grab the value. I can write a function for this, but I don't want to reinvent the wheel here, so if anyone knows of a built-in argument or existing function I would be much obliged.

Progman
  • 16,827
  • 6
  • 33
  • 48

2 Answers2

2

With lavInspect() and lavTech() you can extract information from fitted lavaan objects. You can for example extract the chisquare value using:

  x<-lavInspect(model, "fit")
  x["chisq"]
L. Bakker
  • 147
  • 1
  • 13
Oscar Kjell
  • 1,599
  • 10
  • 32
1
lavInspect(model, "test")$standard$stat.group
Yiu Chung Wong
  • 147
  • 1
  • 2
  • 11