Closed TDJorgensen closed 2 weeks ago
reprex to test it:
fit <- cfa("visual =~ x1 + a*x2 + b*x3",
constraints = 'ab := a*b',
data = HolzingerSwineford1939)
vcov(fit) # default is unchanged, 6 x 6
vcov(fit, standardized = "std.all") # 6 by 6
vcov(fit, standardized = "std.all", type = "user") # 7 by 7
vcov(fit, standardized = "std.all", free.only = FALSE) # 8 by 8
I’m working on some lavaan.mi functionality in
semTools::monteCarloCI()
, which requires the fullvcov()
for a standardized solution. When I last visited, I worked out a hack forstandardizedSolution.mi()
by creating a fake lavaan object with pooled results inside it. That object can also be passed to the workhorse:But that is not a public function. I explored 2 possibilities to call it indirectly via public functions, both of which have a limitation I need to circumvent:
lavInspect(fit, "vcov.std.all")
only setsfree.only=TRUE
, without any way to pass more arguments via...
becauselavInspect()
only has awhat=
argument. It does not seem optimal to create even morewhat=
options with long names to allow for the combination with defined/joint output.vcov()
method does not have afree.only=
argument (type="free"
only indicates whether user-defined parameters are included), nor astandardized=
argument. This seems like a better candidate, because there are already some other undocumented arguments (which CRAN doesn't seem to care about, since you define the method within thesetMethod()
call).This PR adds these 2 arguments to your
vcov()
method to pass them tolav_object_inspect_vcov()
. I left these new arguments undocumented (like the existing ones) to avoid advertising them.