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

predict_pls: Subscript `endogenous_items` must be a simple vector, not a matrix #333

Open anh-huynhlt opened 12 months ago

anh-huynhlt commented 12 months ago

Hi, I'm trying to apply predict_pls, but I get this error:

Parallel encountered this ERROR: Can't subset columns with endogenous_items. ✖ Subscript endogenous_items must be a simple vector, not a matrix.Error in parallel::stopCluster(cl) : object 'cl' not found

It's strange that I encounter an error with the parallel process since I want to use k-fold cross-validation. I tried specifying noFolds = 10 and cores=NULL, but I still get the same error. Here are my codes.

###### Measurement model 

mm_em <- constructs(composite("VVLT", multi_items("vvlt", 1:4)),
                       composite("VEOU", multi_items("veou", 1:2)),
                       composite("VRA", multi_items("vra", 1:2)),
                      composite("VINT", multi_items("vint", 1:3)))

###### Structural model 

inner_model_em <- relationships(paths(from = c("VVLT", "VEOU", "VRA"), to = "VINT"))

###### Estimate the model

em <- estimate_pls(data = data, 
                   measurement_model = mm_em,
                   structural_model = inner_model_em,
                   inner_weights = path_weighting)

###### PLSpredict

pred <- predict_pls(model = em, technique = predict_DA, noFolds = 10, reps = 10, cores = NULL)

Thanks a lot!