# NOT RUN {
## Example 1: simulate family data from population-based design using
# a Weibull distribution for the baseline hazard and inducing
# residual familial correlation through a shared gamma frailty.
set.seed(4321)
fam <- simfam(N.fam = 10, design = "pop+", variation = "frailty",
base.dist = "Weibull", frailty.dist = "gamma", depend=1,
allelefreq = 0.02, base.parms = c(0.01, 3), vbeta = c(-1.13, 2.35))
head(fam)
# }
# NOT RUN {
famID indID gender motherID fatherID proband generation majorgene secondgene
1 1 1 1 0 0 0 1 2 0
2 1 2 0 0 0 0 1 2 0
3 1 3 0 2 1 1 2 2 0
4 1 4 1 0 0 0 0 3 0
5 1 9 0 3 4 0 3 2 0
6 1 10 1 3 4 0 3 3 0
ageonset currentage time status mgene relation fsize naff weight
1 103.76925 69.19250 69.19250 0 1 4 18 2 1
2 64.88982 67.31119 64.88982 1 1 4 18 2 1
3 45.84891 47.57119 45.84891 1 1 1 18 2 1
4 269.71990 47.37403 47.37403 0 0 6 18 2 1
5 69.78355 27.80081 27.80081 0 1 3 18 2 1
6 192.09392 25.34148 25.34148 0 0 3 18 2 1
# }
# NOT RUN {
summary(fam)
plot(fam, famid = c(1:2)) # pedigree plots for families with IDs = 1 and 2
## Example 2: simulate family data from two stage design to include
# 30% of high risk families in the sample.
set.seed(4321)
fam <- simfam(N.fam = 50, design = "twostage", variation = "none", base.dist = "Weibull",
base.parms = c(0.01, 3), vbeta = c(-1.13, 2.35), hr = 0.3, allelefreq = 0.02)
summary(fam)
# }
Run the code above in your browser using DataLab