simulate_pedigree.RdThis function simulates a pedigree with multiple generations. It generates a realistic family structure with random mating patterns and variable offspring numbers.
simulate_pedigree(
n_founders = 10,
n_generations = 4,
prob_male_mating = 0.7,
offspring_lambda = 2.5,
sex_ratio = 0.5
)Integer. Number of unrelated founders to start the pedigree (generation 0).
Integer. Number of generations to simulate after the founders.
Numeric. Probability (0-1) of a male mating. Default is 0.7.
Numeric. Expected number of offspring per mating pair (lambda parameter for Poisson distribution).
Numeric. Probability (0-1) of an individual being female.
A data frame containing the simulated pedigree with columns:
id: Unique identifier for each individual
mother: ID of the individual's mother (0 for founders)
father: ID of the individual's father (0 for founders)
sex: Character ("F" or "M")
generation: Integer indicating the generation number (0 for founders)
# Simulate a small pedigree with 5 founders and 3 generations
ped <- simulate_pedigree(
n_founders = 5,
n_generations = 3,
offspring_lambda = 2,
sex_ratio = 0.5
)
#> Warning: No males or females available in generation 0