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

specify input without hhid #37

Open
matthias-da opened this issue Jun 28, 2024 · 0 comments
Open

specify input without hhid #37

matthias-da opened this issue Jun 28, 2024 · 0 comments

Comments

@matthias-da
Copy link
Collaborator

matthias-da commented Jun 28, 2024

Not always there is a cluster structure (like person in households). Currently, one has to set hhid.

So,

  • when hhid is empty: error
  • when hhid is set to NULL: error
  • when hhid the person id is used: error

Thus we can't produce synthetic data without cluster structure.

library(lavaan)
data(HolzingerSwineford1939)
library(simPop)
inp <- specifyInput(data=HolzingerSwineford1939, 
                                  strata="school", hhid = ???)

Is it worth to rewrite simPop from scratch to allow both: cluster structures and no cluster structures. In my opinion: yes, very worth to do it.

First task could be to use some data set to synthesize without receiving errors. Eg. one data set with age and sex structure but without weights and clusters

library(lavaan)
data(HolzingerSwineford1939)
library(simPop)
X$weight <- 1  # should not be needed
X$grade <- factor(X$grade) # should basically numeric input, but wont work
inp <- specifyInput(data = X, hhid = "school", weight = "weight", strata = "school") # should work without specifying hhid and weight
pop <- simStructure(data=inp, method="direct", basicHHvars=c("sex", "ageyr")) 
pop <- simCategorical(pop, additional = "grade", nr_cpus = 1) # error, also when grade is used as numeric with `simContinuos`.
pop <- simContinuous(pop, additional = "x1", nr_cpus = 1, method = "multinom") # errors for all methods
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

1 participant