Generate samples from m sources and p parameters, n sample per source. Optionally pass the between-source hyperparameters used to generate the source parameters.

fun_rnorm_population(
  n,
  m,
  list_hyper = NULL,
  name_var = "x",
  name_source = list(mu = "mu", sigma = "sigma")
)

Arguments

n

number of samples per source

m

number of sources

list_hyper

a list containing the hyperparameters:

  • 'm_mu', 'm_sigma': the between-source mean hyperparameters

  • 's_mu', 's_sigma': the between-source sd hyperparameters A partial list will be merged. If NULL, they are generated from the N(0,1) distribution.

name_var

names for data variables (default: 'x')

name_source

named list or character vector with names for source parameters \(\mu\) and \(\sigma\) (default: list(mu = 'mu', sigma = 'sigma'))

Value

list of samples:

  • list_hyper: a list containing the hyperparameters:

  • df_sources: tibble of the Dirichlet population parameters, source column is 'source', variables start with name_source

  • df_pop: the Dirichlet data, source column is 'source', variables start with name_var

  • names_var: names of columns containing data variables

  • names_source: names of columns containing source variables

Model

The Normal-Normal model:

$$X_{ij} ~ N(\mu_i, \sigma_i^2) i = 1, \ldots, n, j = 1, \ldots, m$$ $$\mu_i ~ N(m_{\mu}, s_{\mu}^2) j = 1, \ldots, m$$ $$\sigma_i ~ N(m_{\sigma}, s_{\sigma}^2) j = 1, \ldots, m$$

See also

Other population functions: fun_rdirichlet_population()