Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent error when using rstarts #411

Open
winterstat opened this issue Jan 24, 2025 · 1 comment
Open

Inconsistent error when using rstarts #411

winterstat opened this issue Jan 24, 2025 · 1 comment

Comments

@winterstat
Copy link

I recently read De Jonckere & Rosseel (2025)'s BRM paper on using random starting values. I want to use this option in a larger simulation study but I'm running into an error. The problem with the error is that it doesn't consistently show up under fixed conditions. Here is the error:

 ‘Error in x.noerror[sapply(x.rstarts, "attr", "converged")] : invalid subscript type 'list' ’

I'm also playing around with the bounds argument, and I think that is the cause of these errors. The example below, using that seed, should replicate the issue (note that I'm generating a random covariance matrix on purpose):

library(lavaan)
library(clusterGeneration)

set.seed(123)
p <- 24
temp_mat <- genPositiveDefMat(dim = 24, covMethod ="onion", eta=1, rangeVar=c(1,1))$Sigma
colnames(temp_mat) <- rownames(temp_mat) <- paste0("x", seq(1:p))

mod1 <- '
f1 =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + 
x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 +
x17 + x18 + x19 + x20 + x21 + x22 + x23 + x24
'

mod1b.fit <- cfa(mod1, sample.cov = temp_mat, 
                 bounds = "pos.var",             
                 rstarts = 10,
                 sample.nobs = 1000)

Any ideas what's going on? If the answer is that random starts and variance bounds don't combine, then that's also fine!

Thanks!

@yrosseel
Copy link
Owner

yrosseel commented Feb 4, 2025

Indeed. Thanks for reporting this. The rstarts= and bounds= options did not like each other. I believe this is now fixed in the github version of lavaan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants