Description Usage Arguments Details Value Examples
Functions to simulate data for kin-cohort analysis
1 2 3 4 5 6 7 | kc.simul(nfam, f, hr, rand = 0, mean.sibs = 2, mean.desc = 1.5,
a.age = 8, b.age = 80, a.cancer = 3, b.cancer = 180 )
sample.caco(object, p.cases = 1, caco.ratio = 1, verbose = TRUE)
## S3 method for class 'kin.cohort.sample'
summary(object,...)
|
nfam |
number of families to be generated |
f |
allele frequency |
hr |
hazard ratio for disease carriers relative noncarriers |
rand |
variance of random effect for cancer incidence (ratio of hr) |
mean.sibs |
mean number of sibllings and descendants (~Poisson) |
mean.desc |
mean number of sibllings and descendants (~Poisson) |
a.age |
shape parameter for age (~Weibull) |
b.age |
scale parameter for age (~Weibull) |
a.cancer |
shape parameter for cancer incidence (~Weibull) |
b.cancer |
scale parameter for cancer incidence (~Weibull) |
object |
object of class |
p.cases |
proportion of cases (affected) to include in sample. if more than 1, the exact number is assumed |
caco.ratio |
ratio of controls per case to include in sample |
verbose |
show the number of cases and controls sampled |
... |
additional arguments |
kc.simul
will generate a cohort of probands of size nfam
. Default parameters simulate a typical cancer study. Each of them will be assigned: a carrier
status with probability f^2+2f(1-f); a current age
drawn from a Weibull distribution with parameters a.age
and b.age
; an age at diagnosis (agecancer
) drawn from
a Weibull distribution with parameters a.cancer
and b.cancer
, if noncarrier. For carries, the scale (b.cancer
) is
shifted to get the desired hazard ratio (hr
). If rand
>0, then a family specific random effect is also added, drawn from a normal distribution with mean 0 and sd rand
.
If agecancer
< age
then the disease status (cancer
) will be 1, 0 otherwise.
First degree relatives are generated for each proband: two parents, a random number of sibblings (drawn from a Poisson withe mean mean.sibs
), and
a random number of descendants (drawn from a Poisson with mean mean.desc
). Each of them is assiggned a carrier
status with probability according
to mendelian transmission conditional of the proband carrier status.
Current age
for relatives are generated conditional on the proband's age, with random draws from normal distribution. Age at diagnosis (agecancer
) is assumed independent, except for the optional family random effect.
Gender is assigned at random with probability 0.5 for all individuals.
Note that the simulation of residual familial correlation with a random effect (rand$>0
) does not mantain the desired hazard ratio (hr
).
The generic function summary
will show the number and proportion of carriers and affected subjects in the sample.
sample.caco
will sample (from a simulation generated by kc.simul
) a subset of cases (afected probands) and controls (unaffected probands) and their relatives. Currently only random sampling of controls is implemented (no matching). Sampling fraction is controled by caco.ratio
.
Currently, only one gene and one disease are simulated.
object of class kin.cohort.sample
and data.frame
with fields
famid |
family id |
rel |
relative type (0=proband, 1=parents, 2=sibblings, 3=descendants) |
age |
current age of each subject |
gender |
gender (0=male, 1=female) |
carrier |
carrier status of proband (0=noncarrier, 1=carrier), common for all family members |
cancer |
affected (0=no, 1=yes) |
agecancer |
age at diagnosis or current age if not affected |
real.carrier |
carrier status or relatives (0=noncarrier, 1=carrier ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ## Not run:
set.seed(7)
## cohort
s<-kc.simul(4000, f=0.03, hr=5)
summary(s)
## exclude probands
m.coh<- kc.marginal(s$agecancer, s$cancer, factor(s$carrier), s$rel,
knots=c(30,40,50,60,70,80,90), f=0.03)
m.coh
## relatives only
r.coh<- coxph(Surv(agecancer,cancer)~real.carrier, data=s)
print(exp(coef(r.coh)))
## probands only
p.coh<- coxph(Surv(agecancer,cancer)~carrier, data=s)
print(exp(coef(p.coh)))
## case-control
s.cc<- sample.caco(s)
summary(s.cc)
## exclude probands
m.caco<- kc.marginal(s.cc$agecancer, s.cc$cancer, factor(s.cc$carrier),
s.cc$rel, knots=c(30,40,50,60,70,80,90), f=0.03)
m.caco
## relatives only
r.caco<- glm(cancer~real.carrier, family=binomial, data=s.cc, subset=(s.cc$rel!=0))
print(exp(coef(r.caco)[2]))
## probands only
p.caco<- glm(cancer~carrier, family=binomial, data=s.cc, subset=(s.cc$rel==0))
print(exp(coef(p.caco)[2]))
## End(Not run)
|
Loading required package: survival
Simulated population for kin-cohort analysis
Probands: 4000
Affected probands: 392 ( 9.8 %)
Carrier probands: 225 ( 5.6 %)
Affected probands by carrier status
Noncarriers: 313 ( 7.8 %)
Carriers: 79 ( 2.0 %)
Relatives: 22047
Affected relatives: 2039 ( 9.2 %)
Carrier relatives: 1890 ( 8.6 %)
Affected relatives by carrier status
Noncarriers: 1449 ( 6.6 %)
Carriers: 590 ( 2.7 %)
Warning messages:
1: Probands excluded from this analysis
2: In any(rel.codes) : coercing argument of type 'double' to logical
3: In any(rel.codes) : coercing argument of type 'double' to logical
Kin-cohort analysis
Marginal Likelihood method
Person Years table
events p.years 0 p.years 1 p.years
<30 146 659420.0 126 622919.0 20 36501.0
[30-40) 178 214507.0 160 202712.0 18 11795.0
[40-50) 241 203367.0 201 192336.5 40 11030.5
[50-60) 333 180418.0 291 170662.5 42 9755.5
[60-70) 410 146393.5 355 138858.0 55 7535.5
[70-80) 355 103288.5 316 98507.0 39 4781.5
[80-90) 252 56526.5 216 54130.0 36 2396.5
90 + 124 22234.0 114 21345.5 10 888.5
Total 2039 1586154.5 1779 1501470.5 260 84684.0
x10e5 py 128.5 118.5 307.0
Allele frequency = 0.03
Cumulative Risk
0 1 Cum.RR 1
<30 0.00545 0.02567 4.70584
<40 0.01284 0.04733 3.68471
<50 0.02166 0.10454 4.82617
<60 0.03679 0.16561 4.50121
<70 0.05874 0.26426 4.49897
<80 0.08612 0.36327 4.21843
<90 0.11746 0.53216 4.53076
Average Hazard Ratio
1
5.20185
Logrank test p-value
[1] 0
real.carrier
5.253444
carrier
3.114672
392 cases and 392 controls have been selected
Simulated population for kin-cohort analysis
Probands: 784
Affected probands: 392 ( 50.0 %)
Carrier probands: 95 ( 12.1 %)
Affected probands by carrier status
Noncarriers: 313 ( 39.9 %)
Carriers: 79 ( 10.1 %)
Relatives: 4334
Affected relatives: 430 ( 9.9 %)
Carrier relatives: 502 ( 11.6 %)
Affected relatives by carrier status
Noncarriers: 264 ( 6.1 %)
Carriers: 166 ( 3.8 %)
Warning messages:
1: Probands excluded from this analysis
2: In any(rel.codes) : coercing argument of type 'double' to logical
3: In any(rel.codes) : coercing argument of type 'double' to logical
Kin-cohort analysis
Marginal Likelihood method
Person Years table
events p.years 0 p.years 1 p.years
<30 34 129645.5 27 114119.5 7 15526.0
[30-40) 36 42273.5 24 37256.0 12 5017.5
[40-50) 43 40483.0 27 35744.0 16 4739.0
[50-60) 72 36418.0 54 32103.0 18 4315.0
[60-70) 80 29893.5 54 26503.5 26 3390.0
[70-80) 78 21623.5 61 19294.5 17 2329.0
[80-90) 53 12815.0 33 11441.0 20 1374.0
90 + 34 5483.0 29 4912.0 5 571.0
Total 430 318635.0 309 281373.5 121 37261.5
x10e5 py 135.0 109.8 324.7
Allele frequency = 0.03
Cumulative Risk
0 1 Cum.RR 1
<30 0.00670 0.01938 2.89247
<40 0.01206 0.05889 4.88379
<50 0.01804 0.11392 6.31430
<60 0.03309 0.17240 5.20947
<70 0.04973 0.28226 5.67531
<80 0.07734 0.36826 4.76181
<90 0.09891 0.54036 5.46303
Average Hazard Ratio
1
6.22882
Logrank test p-value
[1] 0
real.carrier
6.677128
carrier
5.93131
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.