rhglm function

Random HGLM Data

Random HGLM Data

A simple data generator for testing and example purposes.

rhglm( n, beta, sigma = diag(length(beta) - 1L), family = gaussian(), truncate_mu = FALSE, as_list = FALSE, ... )

Arguments

  • n: the number of observations to be created.
  • beta: a numeric vector giving the magnitude of the coefficients (the first element is assumed to be the intercept).
  • sigma: a positive-definite symmetric matrix giving the covariance structure of the covariates (passed to MASS::mvrnorm).
  • family: the family of the inverse link.
  • truncate_mu: a logical giving if mu should be truncated if necessary.
  • as_list: a logical (default is FALSE), if TRUE a list is returned otherwise a data.frame is returned.
  • ...: addtional optional parameters. The arguments are passed to the random variables generating function of the response.

Returns

A data.frame (or list) containing the generated data.

Examples

rhglm(10, 1:5) rhglm(10, 1:5, family = binomial())

See Also

Other simulation: cov_matrix()

  • Maintainer: Benjamin Schwendinger
  • License: GPL-3
  • Last published: 2024-12-20

Useful links