Skip to contents

gsim_pedigree_records() creates one scalar-long model view from a supplied gsim_pedigree() domain. Missing traits and times are represented by absent rows, never imputed phenotypes. The fixed design is returned as sorted, one-based sparse triplets rather than a dense matrix.

Usage

gsim_pedigree_records(
  pedigree,
  model = c("single_trait", "multitrait", "longitudinal"),
  fixed_effects = NULL,
  genetic_covariance = NULL,
  residual_covariance = NULL,
  residual_variances = NULL,
  random_regression_rank = 3L,
  basis_function = NULL,
  minimum_records = 1L,
  maximum_records = 5L,
  residual_groups = 3L,
  prediction_records = FALSE,
  permute_record_order = TRUE,
  seed = NULL
)

Arguments

pedigree

A gsim_pedigree object.

model

One of "single_trait", "multitrait", or "longitudinal".

fixed_effects

Optional finite vector with one value per generated design column, unnamed in design order or named by all design columns.

genetic_covariance

Genetic covariance (single/multitrait) or random- regression coefficient covariance (longitudinal).

residual_covariance

Residual covariance for single/multitrait models.

residual_variances

Longitudinal residual-group variances.

random_regression_rank

Basis rank from one to three.

basis_function

Optional longitudinal function accepting the time vector and returning a finite matrix with random_regression_rank columns. NULL uses the documented shifted-Legendre basis.

minimum_records, maximum_records

Longitudinal observed records per phenotyped animal.

residual_groups

Positive number of residual groups.

prediction_records

Whether to return longitudinal prediction records.

permute_record_order

Reproducibly permute scalar record order.

seed

Optional nonnegative integer seed.

Value

An object of class gsim_pedigree_records with the original pedigree, scalar records, sparse fixed-design triplets, optional basis and prediction records, model truth, settings, diagnostics, and deterministic checksums.

Details

Latent animal values are deterministic recursive solver-workload values. They are deliberately not claimed to be exact draws from a numerator relationship covariance: truth$exact_relationship_draw is FALSE, and covariance recovery is not a validation target. They are appropriate for comparing solvers supplied with identical equations and right-hand sides.

A supplied seed calls set.seed() and the call then advances the caller's RNG state. Optional longitudinal prediction records contain animal, time, basis and fitted truth, but no residual or phenotype.

Examples

ped <- gsim_pedigree(n_generations = 4, animals_per_generation = 20, seed = 1)
dat <- gsim_pedigree_records(ped, model = "longitudinal",
                             prediction_records = TRUE, seed = 2)
head(dat$records)