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

Error: 'subscript endogenous_items must be a simple vector, not a matrix' #331

Closed JDottt closed 1 year ago

JDottt commented 1 year ago

Dear seminr,

I have thoroughly enjoyed using your hugely functional package for finishing up my thesis, however I have recently revised my model and have been unable to run the predict_pls function - this is quite important for my analyses.

The error I'm getting is, 'Error in ordered_data[trainIndexes, endogenous_items]: Can't subset columns with endogenous_items. x Subscript endogenous_items must be a simple vector, not a matrix'.

I have tried cloning the pls_predict code and executing this, which worked before. However I haven't had much luck this time round. Any idea where or what the endogeneity is, or if I can change the matrix to a simple vector as it says?

I was wondering if you could highlight where I could amend this so I can finish my analyses? Just to note my seminr model is a mediated model - I also have an unmediated model, and have tried this too, but the error is different:

'error in sample.int(length(x), size, replace, prob): invalid 'size' argument.

Hope you can help with this, have had so much fun and success with seminr thus far.