All distributions share the same latent variable ηij=a+bi with bi=N(0,σr)
generate_data(a = 0, sigma_random = 0.5, n_random = 20, n_replicate = 10, nb_size = 1, b_size = 5, zero_inflation = 0.5)
a | the intercept of the latent variable |
---|---|
sigma_random | The standard error for the random effect σr |
n_random | the number of random effect levels (groups) |
n_replicate | the number of observation per random effect level |
nb_size | the size parameter of the negative binomial distribution.
Passed to the |
b_size | the size parameter of the binomial distribution. Passed to the
|
zero_inflation | the probability the the observed value stems for the a point mass in zero |
A data.frame
ìd
the id of the random effect
eta
the latent variable
zero_inflation
use the point mass in zero
poisson
the Poisson distributed variable
zipoisson
the zero-inflated Poisson distributed variable
negbin
the negative binomial distributed variable
zinegbin
the zero-inflated negative binomial distributed variable
binom
the binomial distributed variable
The Poisson distribution uses λ=eηij
The negation binomial distribution uses μ=eηij
The binomial distribution uses πij=eηij/(eηij+1)
Other utils: plot.dispersion_check
,
plot.distribution_check
#> group_id observation_id eta zero_inflation poisson zipoisson negbin #> 1 1 1 0.5510209 FALSE 2 2 4 #> 2 2 2 1.0340814 FALSE 3 3 2 #> 3 3 3 -0.4308339 TRUE 0 0 3 #> 4 4 4 0.4349636 TRUE 1 0 3 #> 5 5 5 -0.2710201 FALSE 0 0 1 #> 6 6 6 -1.2489241 TRUE 0 0 0 #> zinegbin binom #> 1 4 5 #> 2 2 4 #> 3 0 0 #> 4 0 2 #> 5 1 1 #> 6 0 2