# NOT RUN {
#Read in age-specific hazards
data(AgeSpecific_Hazards)
#Simulate pedigree ascertained for multiple affected individuals
set.seed(2)
ex_RVped <- sim_RVped(hazard_rates = hazard(hazardDF = AgeSpecific_Hazards),
GRR = 20,
RVfounder = TRUE,
FamID = 1,
founder_byears = c(1900, 1905),
ascertain_span = c(1995, 2015),
num_affected = 2,
stop_year = 2017,
recall_probs = c(1, 1, 0))
# Observe: ex_RVped is a list containing two ped objects
summary(ex_RVped)
# The first is the original pedigree prior
# to proband selection and trimming
plot(ex_RVped[[1]])
# The second is the ascertained pedigree which
# has been trimmed based on proband recall
plot(ex_RVped[[2]])
summary(ex_RVped[[2]])
# NOTE: by default, RVfounder = FALSE.
# Under this setting pedigrees segregate a causal
# variant with probability equal to carrier_prob.
#---------------------------------------------------#
# Simulate Pedigrees with Multiple Disease Subtypes #
#---------------------------------------------------#
# Simulating pedigrees with multiple subtypes
# Import subtype-specific hazards rates for
# Hodgkin's lymphoma and non-Hodgkin's lymphoma
data(SubtypeHazards)
head(SubtypeHazards)
my_hazards <- hazard(SubtypeHazards,
subtype_ID = c("HL", "NHL"))
# Simulate pedigree ascertained for at least two individuals
# affected by either Hodgkin's lymphoma or non-Hodgkin's lymphoma.
# Set GRR = c(20, 1) so that individuals who carry a causal variant
# are 20 times more likely than non-carriers to develop "HL" but have
# same risk as non-carriers to develop "NHL".
set.seed(45)
ex_RVped <- sim_RVped(hazard_rates = my_hazards,
GRR = c(20, 1),
RVfounder = TRUE,
FamID = 1,
founder_byears = c(1900, 1905),
ascertain_span = c(1995, 2015),
num_affected = 2,
stop_year = 2017,
recall_probs = c(1, 1, 0))
plot(ex_RVped[[2]], cex = 0.6)
# Note that we can modify the ascertainment criteria so that
# at least 1 of the two disease-affected relatives are affected by
# the "HL" subtype by supplying c("HL", 1) to the sub_criteria
# argument.
set.seed(69)
ex_RVped <- sim_RVped(hazard_rates = my_hazards,
GRR = c(20, 1),
RVfounder = TRUE,
FamID = 1,
founder_byears = c(1900, 1905),
ascertain_span = c(1995, 2015),
num_affected = 2,
stop_year = 2017,
recall_probs = c(1, 1, 0),
sub_criteria = list("HL", 1))
plot(ex_RVped[[2]], cex = 0.6)
# }
Run the code above in your browser using DataLab