sem-in-r / seminr

Natural feeling domain-specific language for building structural equation models in R for estimation by covariance-based methods (like LISREL/Lavaan) or partial least squares (like SmartPLS)
58 stars 19 forks source link

PLS Bootstrap error: "there is no package called 'seminr'" #318

Open apa-22 opened 1 year ago

apa-22 commented 1 year ago

Hi there

I tried estimating a PLS model using the 'seminr' package. The function 'estimate_pls()' seems to work properly. However, I encounter the following problem when I try to bootstrapping:

boot_mpls_total <- bootstrap_model(seminr_model = mpls_total, nboot = 1000)
Bootstrapping model using seminr...
Bootstrapping encountered this ERROR: 
16 nodes produced errors; first error: there is no package called 'seminr'

Can anyone help please? I have already tried uninstalling and reinstalling the package, but I still get this error message.

soumyaray commented 1 year ago

Hi @apa-22 thanks for trying SEMinR. Please help us diagnose the problem by answering a few preliminary questions:

  1. Are you running your code in RStudio or by some other means?
  2. Your version of R? Try running: R.Version()$version.string
  3. Your version of RStudio? Select "About RStudio" from the Help menu
  4. Your version of seminr installed? Try running: packageVersion("seminr")
apa-22 commented 1 year ago

Hi @soumyaray thanks for your reply!

Here are my current settings:

  1. Yes I am using RStudio
  2. R version 4.1.1 (2021-08-10)
  3. RStudio version 2021.09.0
  4. seminr version 2.3.2

Thanks for your support!

soumyaray commented 1 year ago

@apa-22 seminr is trying to run the bootstrap using all the cores of your CPU in parallel. It seems that parallel processing, implemented by the parallel package that comes with R, is producing the error on your computer.

Questions:

  1. What operating system and version are you using?
  2. What version of the parallel package is installed in R? (Try: packageVersion("parallel"))
  3. What do you see when you try: parallel::detectCores()

Can you also try to run estimate_bootstrap() function with parameter cores=1. This will try to sequentially run the bootstrap. It will be quite slow so also set the number of bootstraps to something low: nboot=100. So:

boot_mpls_total <- bootstrap_model(seminr_model = mpls_total, nboot = 100, cores=1)
apa-22 commented 1 year ago

Hi @soumyaray thanks for your reply.

  1. Windows 10 version 1607
  2. parallel version: 4.1.1
  3. 16

I tried running your code, i.e.:

boot_mpls_total <- bootstrap_model(seminr_model = mpls_total, nboot = 100, cores=1)

but I still get the error message. This time it says "one node produced an error" instead of "16 nodes produced errors" since we set cores=1, I guess.

Bootstrapping model using seminr...
Bootstrapping encountered this ERROR: 
one node produced an error: there is no package called 'seminr'
soumyaray commented 1 year ago

Dear @apa-22 kindly let us confer and let you know what else we need to help resolve this issue. It isn't happening on other systems or for other users as we know of.