Closed zq8890 closed 2 years ago
@zq8890 sorry, that error was unclear. I'm updating it now and will push a new WeMix to GitHub once it passes all the tests.
However, you do not need to wait for it because the issue is that you need one set of weights for each level. I would recommend making weights of one and saying they are conditional (set cWeights=TRUE
).
So, I think this should work, but I don't have access to your data, so I don't know if it will.
data1$one <- 1
m1 <- mix(bmipct ~ ageyrs_ + (1|CHILDID), data = data1, weights = c("one", "W9C29P_9A0"), cWeights=TRUE))
This assumes that each student with complete data is sampled with probability one, after the student is sampled.
Hello - i'm using the WeMix package to apply complex survey weights to a multilevel analysis. The weight variable is W9C29P_9A0. I am getting the errors below. The first error - I'm not sure what the problem is. For the warning message, it says all the data (all 70,476 observations) are missing, however this is not true. I can open the data set and see it is not all missing.
Error in apply(data[, weights] <= 0, 1, any) : dim(X) must have a positive length In addition: Warning message: In mix(bmipct ~ ageyrs_ + (1 | CHILDID), data = data1, weights = c("W9C29P_9A0")) : There were 70476 rows with missing data. These have been removed.