Skip to contents

gsim_pedigree() creates a linear-storage pedigree domain for pedigree-model and sparse-solver validation. It never constructs a relationship matrix. The returned pedigree table is in reproducibly arbitrary external order; canonical_order is topological and mapping links both orders.

Usage

gsim_pedigree(
  n_animals = NULL,
  n_generations = 5L,
  animals_per_generation = 200L,
  founder_generations = 2L,
  sires_per_generation = NULL,
  dams_per_generation = NULL,
  overlapping_generation_probability = 0.2,
  unknown_sire_probability = 0.02,
  unknown_dam_probability = 0.02,
  new_founder_probability = 0.01,
  unphenotyped_probability = 0.15,
  permute_external_order = TRUE,
  seed = NULL
)

Arguments

n_animals

Optional total number of animals. When supplied, animals are distributed as evenly as possible over n_generations.

n_generations

Number of generations.

animals_per_generation

Generation size when n_animals is NULL.

founder_generations

Number of initial all-founder generations.

sires_per_generation, dams_per_generation

Maximum sizes of the sex-specific parent pools from each eligible generation. NULL selects a small scaling default.

overlapping_generation_probability

Probability of choosing an available parent from two generations back rather than one.

unknown_sire_probability, unknown_dam_probability

Parent-specific missingness probabilities.

new_founder_probability

Probability that a later animal has neither recorded parent.

unphenotyped_probability

Probability that an animal is marked as unavailable for observed-record generation.

permute_external_order

Reproducibly permute the returned pedigree rows.

seed

Optional nonnegative integer seed.

Value

An object of class gsim_pedigree containing the externally ordered pedigree, canonical and external ID vectors, an explicit order mapping, settings, diagnostics, and deterministic checksums.

Details

A supplied seed calls set.seed() and the call then advances the caller's RNG state. Without a seed, the current R RNG stream is used. RNGkind() and the supplied seed are recorded.

Examples

ped <- gsim_pedigree(n_generations = 5, animals_per_generation = 40,
                     sires_per_generation = 6, dams_per_generation = 12,
                     seed = 101)
head(ped$pedigree)