cjvanlissa / tidySEM

54 stars 7 forks source link

package appears to interfere with lavaan summary method #88

Closed ml-crowe closed 4 months ago

ml-crowe commented 4 months ago

Hello, thanks for working on this package - it is much needed. I am running into an issue where the lavaan summary method no longer works after the tidySEM package has been loaded. Reproducible syntax follows:

library(lavaan) # ver 0.6-17.1892

model <- '
  # latent variable definitions
     ind60 =~ x1 + x2 + x3
     dem60 =~ y1 + a*y2 + b*y3 + c*y4
     dem65 =~ y5 + a*y6 + b*y7 + c*y8

  # regressions
    dem60 ~ ind60
    dem65 ~ ind60 + dem60

  # residual correlations
    y1 ~~ y5
    y2 ~~ y4 + y6
    y3 ~~ y7
    y4 ~~ y8
    y6 ~~ y8
'

fit <- sem(model, data = PoliticalDemocracy)
summary(fit, fit.measures = TRUE) # performs as spected

library(tidySEM) # ver 0.2.6

summary(fit, fit.measures = TRUE) # results in error

# Error in lav_object_summary(object = object, header = header, fit.measures = fit.measures,  :
#   unused argument (remove.unused = remove.unused)

# Error persists when lavaan summary method is explicitly called
lavaan::summary(fit, fit.measures = TRUE)
cjvanlissa commented 4 months ago

Can't reproduce... on my system, this is the result:

> library(lavaan) # ver 0.6-17.1892
This is lavaan 0.6-17.1902
lavaan is FREE software! Please report any bugs.
> 
> model <- '
+   # latent variable definitions
+      ind60 =~ x1 + x2 + x3
+      dem60 =~ y1 + a*y2 + b*y3 + c*y4
+      dem65 =~ y5 + a*y6 + b*y7 + c*y8
+ 
+   # regressions
+     dem60 ~ ind60
+     dem65 ~ ind60 + dem60
+ 
+   # residual correlations
+     y1 ~~ y5
+     y2 ~~ y4 + y6
+     y3 ~~ y7
+     y4 ~~ y8
+     y6 ~~ y8
+ '
> 
> fit <- sem(model, data = PoliticalDemocracy)
> summary(fit, fit.measures = TRUE) # performs as spected
Error in lav_object_summary(object = object, header = header, fit.measures = fit.measures,  : 
  unused argument (remove.unused = remove.unused)
> library(tidySEM) # ver 0.2.6
Loading required package: OpenMx
> 
> summary(fit, fit.measures = TRUE) # results in error
Error in lav_object_summary(object = object, header = header, fit.measures = fit.measures,  : 
  unused argument (remove.unused = remove.unused)
ml-crowe commented 4 months ago

I apologize. It looks like whatever was going on may have been a version-specific issue. I just pulled the most recent versions of both packages from github rather than the cran repository and everything seems to be working appropriately at this point. Thanks for taking a look.