Closed Kyoshido closed 2 years ago
The same problem also exists for the method of distribution. The same repair can be done also for it.
Hi Jiri
sorry for the slow answers. I am mostly in holiday before a change in affiliation ;-)
Thanks a lot for the modifications. We are really happy for this.
It seems there is now a warining because of doc mismatch with function arguments. I will repair this before releasing a new version to CRAN.
Hello,
I was playing with the method of multinom for simulation of household size and had this error:
So according to the answer in https://stackoverflow.com/questions/36303404/too-many-weights-in-multinomial-logistic-regression-and-the-code-is-running-for I added argument MaxNWts which in the nnet package is in general for controlling the maximum number of weights.
Then another error appeared in lapply where we draw from original sample for each stratum
This function
The reason for this error is that in my households size, there are these sizes
You can see that I don't have size of 17 and 18.
Everything goes well until this function
because it somehow changed the sizes of households
This happened because of spSample(NH[l],probs[l,]) which is function for sample(length(p),size=n, replace=TRUE,prob=p) and here lies my problem p <- probs[l,]
But the sample is done from household sizes from 1:18 because of the length(p), which is 18 but the maximum value in p is not.
So I solved it by replacing lenght(p) with as.numeric(names(p)). This secures that only household sizes that are truly in original dataset are then sampled.
After the code can run without errors. What do you think about it?