Open matticervin opened 3 years ago
hey. I am not sure what the issue could be as it runs for me.
library(BGGM)
y = BGGM::ptsd
fit = explore(Y = as.matrix(y), type = "mixed")
perhaprs your data are characters which would not work
Thanks! I troubleshooted my way forward to find that the issue was that a binary variable (1/0) was coded as a factor. When I indicate that the variable is numeric, the estimate/explore functions run. They also run if I keep it the variable as a factor but change the 0-1 coding to a 1-2 coding. I will examine the different approaches affect the estimates.
I recently got a new computer and installed the most recent versions of R (& R Studio) and BGGM. Now earlier scripts where I use BGGM won't runt.
For example, this code:
fit <- BGGM::explore(df2, type = "mixed", prior_sd = 0.25, iter = 5000, progress = TRUE, impute = TRUE, seed = 1)
Gives this error message:
BGGM: Posterior Sampling Error in BGGM::explore(df2, type = "mixed", prior_sd = 0.25, iter = 5000, : Not a matrix.
I tried to do this:
fit <- BGGM::explore(as.matrix(df2), type = "mixed", prior_sd = 0.25, iter = 5000, progress = TRUE, impute = TRUE, seed = 1)
Which gives this error code:
BGGM: Posterior Sampling Error in BGGM::explore(as.matrix(df2), type = "mixed", prior_sd = 0.25, : Not compatible with requested type: [type=character; target=double].