Closed isaactpetersen closed 5 months ago
I prefer not to install the mountain of tidyverse packages on my computer. Your reprex does not need the bind_rows()
function:
populationData <- data.frame(rbind(
cbind(populationData_group1, group = 1),
cbind(populationData_group2, group = 2)))
This took me 5 hours to track down a very obscure little bug. I hope no one has been using a large sample as a sampling frame ("population" with the rawData=
argument) because the population values were never correctly obtained. But no error would be returned with continuous data, so it took a case like this with categorical data to (only indirectly) reveal that there was a problem somewhere (without much of a clue what the problem was). Essentially, sim()
tried to use your analysis model as the population model because nothing was provided to generate=
. In 2020 (3baefc0) I already avoided that from happening when rawData=
was provided, but it was only catching it for the case when rawData=
was a list of pre-generated sample data sets (i.e., when n=
and nReps=
are NULL
). I just added a check for the case when rawData=
is specified with n=
and nReps=
, indicating that rawData=
is a single sampling frame to draw subsamples from. So you can install the development version to avoid this bug now.
This took me 5 hours
I didn't mean to make that sound like a guilt trip. Thanks for uncovering this.
Thanks for fixing this and sorry it took so long to diagnose! I just checked and verified that it works now. Greatly appreciate your help and your work on this package! Thanks again.
I'm trying to perform a Monte Carlo simulation with ordinal data. The analysis model fits fine in lavaan. However, once I try to perform the simulation using
sim()
, I receive the following error:Here's a reprex:
Created on 2024-05-03 with reprex v2.1.0