Skip to contents

createSimKinships uses makeSimPed with the ped object and the allSimParents object to create a set of kinship matrices to be used in forming the Monte Carlo estimates for the kinship values.

Usage

createSimKinships(
  ped,
  allSimParents,
  pop = NULL,
  n = 10L,
  verbose = FALSE,
  twinRelations = NULL
)

Arguments

ped

The pedigree information in data.frame format

allSimParents

list made up of lists where the internal list has the offspring ID, id, a vector of representative sires (sires), and a vector of representative dams (dams).

pop

Character vector with animal IDs to consider as the population of interest. This allows you to provide a pedigree in ped that has more animals than you want to use in the simulation by defining pop with the subset of interest. The default is NULL.

n

integer value of the number of simulated pedigrees to generate.

verbose

logical vector of length one that indicates whether or not to print a message when a sire or dam is unknown and there are no representative sires or dams to draw from, so it stays NA.

twinRelations

Optional data.frame of declared twin pairs (id1, id2, code) passed straight through to the internal kinship call; only code == "MZ twin" rows affect the computed matrix. NULL (the default) is a complete no-op, matching today's behavior. See kinship's own twinRelations documentation for the full correction mechanism and precondition.

Value

A list of n kinship matrices, each from one simulated pedigree with possible parents drawn for animals with unknown parents.

Examples

library(nprcgenekeepr)
ped <- nprcgenekeepr::smallPed
simParent_1 <- list(
  id = "A",
  sires = c("s1_1", "s1_2", "s1_3"),
  dams = c("d1_1", "d1_2", "d1_3", "d1_4")
)
simParent_2 <- list(
  id = "B",
  sires = c("s2_1", "s2_2", "s2_3"),
  dams = c("d2_1", "d2_2", "d2_3", "d2_4")
)
simParent_3 <- list(
  id = "E",
  sires = c("s3_1", "s3_2", "s3_3"),
  dams = c("d3_1", "d3_2", "d3_3", "d3_4")
)
allSimParents <- list(simParent_1, simParent_2, simParent_3)
pop <- LETTERS[1:7]
simKinships <- createSimKinships(ped, allSimParents, pop, n = 10)