Hi and thanks for the help!
And back, I asked a question about randomly choosing values according to the probability distribution. This is connected, but I think he deserves his own post.
The vector I created in the last question was binary, now I would like to create a weighted vector (i.e. with bounded integers). I take a sample from a distribution with a zero or quasi-bulk distribution with a long tail, so there is a much higher probability of choosing zero than another value, but there is a finite probability of choosing a large value (for example, 63).
I can use rpois to select values from a poisson distribution and create a vector of a given length. This is similar to what I would like to do, so I will use it as an example.
e=seq(0:63) vec<-c(0,0,0,1,1,1) ones <- which(vec == 1L) temp=rpois((sum(vec)),e) vec[ones]<-temp
This works well for assigning a certain number of values selected from a distribution of poissons to a vector. Is there a way to make it quasipoasson or zero inflated?
source share