rhglm {holiglm}R Documentation

Random HGLM Data

Description

A simple data generator for testing and example purposes.

Usage

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.

Value

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

See Also

Other simulation: cov_matrix()

Examples

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

[Package holiglm version 1.0.0 Index]