generate_data: Generate dummy data with several distributions

View source: R/generate_data.R

generate_dataR Documentation

Generate dummy data with several distributions

Description

All distributions share the same latent variable η_{ij} = a + b_i with b_i = N(0, σ_r)

Usage

generate_data(
  a = 0,
  sigma_random = 0.5,
  n_random = 20,
  n_replicate = 10,
  nb_size = 1,
  b_size = 5,
  zero_inflation = 0.5
)

Arguments

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 size parameter of NegBinomial

b_size

the size parameter of the binomial distribution. Passed to the size parameter of \link[stats]{Binomial}

zero_inflation

the probability the the observed value stems for the a point mass in zero

Details

  • The Poisson distribution uses λ = e^{η_{ij}}

  • The negation binomial distribution uses μ = e^{η_{ij}}

  • The binomial distribution uses π_{ij} = e^{η_{ij}}/(e^{η_{ij}}+ 1)

Value

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

See Also

Other utils: plot.dispersion_check(), plot.distribution_check()

Examples

set.seed(20181202)
head(generate_data())

inbo/inlatools documentation built on Sept. 17, 2022, 2:13 p.m.