Skip to content

Error: object 'permuteOnce.mgcfa' not found when using parallelType = "snow" in permuteMeasEq() #95

@isaactpetersen

Description

@isaactpetersen

I'm receiving the following error when trying to set parallelType = "snow" in permuteMeasEq():
Error in get(name, envir = envir): object 'permuteOnce.mgcfa' not found

I'm using semTools_0.5-5 on Windows. The call to permuteMeasEq() works fine when I remove the call to parallelType. A reprex (with my session info) is below:

library("lavaan")
#> This is lavaan 0.6-9
#> lavaan is FREE software! Please report any bugs.
library("semTools")
#> 
#> ###############################################################################
#> This is semTools 0.5-5
#> All users of R (or SEM) are invited to submit functions or ideas for functions.
#> ###############################################################################

HS <- lavaan::HolzingerSwineford1939
HS$ageGroup <- ifelse(HS$ageyr < 13, "preteen",
                      ifelse(HS$ageyr > 13, "teen", "thirteen"))

mod.null <- c(paste0("x", 1:9, " ~ c(T", 1:9, ", T", 1:9, ", T", 1:9, ")*1"),
              paste0("x", 1:9, " ~~ c(L", 1:9, ", L", 1:9, ", L", 1:9, ")*x", 1:9))
fit.null <- cfa(mod.null, data = HS, group = "ageGroup")

mod.config <- '
visual  =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed   =~ x7 + x8 + x9
'

configuralInvarianceModel <- measEq.syntax(configural.model = mod.config,
                                           data = HS,
                                           ID.fac = "std.lv",
                                           group = "ageGroup")

configuralInvarianceSyntax <- as.character(configuralInvarianceModel)

configuralInvarianceModel_fit <- cfa(configuralInvarianceSyntax,
                                     data = HS,
                                     std.lv = TRUE,
                                     group = "ageGroup",
                                     missing = "ML",
                                     estimator = "MLR")

myAFIs <- c("chisq","cfi","rmsea","mfi","aic")
moreAFIs <- c("gammaHat","adjGammaHat")

# test configural invariance -- this works
set.seed(12345)
out.config <- permuteMeasEq(nPermute = 20,
                            con = configuralInvarianceModel_fit,
                            AFIs = myAFIs,
                            moreAFIs = moreAFIs,
                            iseed = 12345)
#>   |                                                          |                                                  |   0%  |                                                          |===                                               |   5%  |                                                          |=====                                             |  11%  |                                                          |========                                          |  16%  |                                                          |===========                                       |  21%  |                                                          |=============                                     |  26%  |                                                          |================                                  |  32%  |                                                          |==================                                |  37%  |                                                          |=====================                             |  42%  |                                                          |========================                          |  47%  |                                                          |==========================                        |  53%  |                                                          |=============================                     |  58%  |                                                          |================================                  |  63%  |                                                          |==================================                |  68%  |                                                          |=====================================             |  74%  |                                                          |=======================================           |  79%  |                                                          |==========================================        |  84%  |                                                          |=============================================     |  89%  |                                                          |===============================================   |  95%  |                                                          |==================================================| 100%

# test configural invariance -- this throws an error
set.seed(12345)
out.config <- permuteMeasEq(nPermute = 20,
                            con = configuralInvarianceModel_fit,
                            AFIs = myAFIs,
                            moreAFIs = moreAFIs,
                            parallelType = "snow",
                            iseed = 12345)
#> Your RNGkind() was changed from Mersenne-Twister to L'Ecuyer-CMRG, which is required for reproducibility  in parallel jobs.  Your RNGkind() has been returned to Mersenne-Twister but the seed has not been set.  The state of your previous RNG is saved in the slot  named 'oldSeed', if you want to restore it using  the syntax:
#> .Random.seed[-1] <- permuteMeasEqObject@oldSeed[-1]
#> Error in get(name, envir = envir): object 'permuteOnce.mgcfa' not found

sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19041)
#> 
#> Matrix products: default
#> 
#> Random number generation:
#>  RNG:     L'Ecuyer-CMRG 
#>  Normal:  Inversion 
#>  Sample:  Rejection 
#>  
#> locale:
#> [1] LC_COLLATE=English_United States.1252 
#> [2] LC_CTYPE=English_United States.1252   
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] semTools_0.5-5 lavaan_0.6-9  
#> 
#> loaded via a namespace (and not attached):
#>  [1] pillar_1.6.1         compiler_4.1.0       highr_0.9           
#>  [4] tools_4.1.0          digest_0.6.27        lattice_0.20-44     
#>  [7] evaluate_0.14        lifecycle_1.0.0      tibble_3.1.2        
#> [10] pkgconfig_2.0.3      rlang_0.4.11.9000    Matrix_1.3-4        
#> [13] reprex_2.0.0         cli_3.0.0            parallel_4.1.0      
#> [16] yaml_2.2.1           mvtnorm_1.1-2        pbivnorm_0.6.0      
#> [19] xfun_0.24            fastmap_1.1.0        coda_0.19-4         
#> [22] withr_2.4.2          styler_1.4.1         stringr_1.4.0       
#> [25] knitr_1.33           fs_1.5.0             vctrs_0.3.8         
#> [28] grid_4.1.0           stats4_4.1.0         glue_1.4.2          
#> [31] fansi_0.5.0          survival_3.2-11      rmarkdown_2.9       
#> [34] multcomp_1.4-17      TH.data_1.0-10       purrr_0.3.4         
#> [37] magrittr_2.0.1       codetools_0.2-18     MASS_7.3-54         
#> [40] splines_4.1.0        backports_1.2.1      ellipsis_0.3.2      
#> [43] htmltools_0.5.1.9005 emmeans_1.6.1        mnormt_2.0.2        
#> [46] xtable_1.8-4         sandwich_3.0-1       utf8_1.2.1          
#> [49] stringi_1.6.2        estimability_1.3     tmvnsim_1.0-2       
#> [52] crayon_1.4.1         zoo_1.8-9

Created on 2021-07-08 by the reprex package (v2.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreprex showing an error or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions