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 \eta_{ij} = a + b_i with b_i = N(0, \sigma_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 \sigma_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 stats::rnbinom().

b_size

the size parameter of the binomial distribution. Passed to the size parameter of stats::rbinom().

zero_inflation

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

Details

  • The Poisson distribution uses \lambda = e^{\eta_{ij}}.

  • The negation binomial distribution uses \mu = e^{\eta_{ij}}.

  • The binomial distribution uses \pi_{ij} = e^{\eta_{ij}}/(e^{\eta_{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 Oct. 10, 2024, 8:11 a.m.