Learn R Programming

kin.cohort (version 0.7)

simulations: simulation of kin cohort studies

Description

Functions to simulate data for kin-cohort analysis

Usage

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)
"summary"(object,...)

Arguments

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 kin.cohort.sample and data.frame
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

Value

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 )

Details

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.

Examples

Run this code
## 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)

Run the code above in your browser using DataLab