Skip to content
Prev 309513 / 398506 Next

replace repeated id in a pedigree list

The kinship package is out of date, use the kinship2 and coxme packages (it was split into 
two parts).  Then the problem you describe no longer exists -- the kinship function no 
longer requires each subject id to be unique across all pedigrees.

pedlist <- with(mydata, pedgiree(id, fa_id, mo_id, sex, famid=famid))
kmat <- kinship(pedlist)
fit <- coxme(Surv(time, status) ~ x1 + x2 +... + (1| famid/id), varlist=kmat)

The pedlist object contains all the families, plot(pedlist[4]) would pull out and plot the 
4th family.
The column labels of kmat will be of the form "famid/id"


To solve your original problem (though you don't need to) create a single unified id.
uid <- paste(famid, id, sep='/')
idlist <- unique(uid)

newid <- match(uid, idlist)
newmom <- match(paste(famid, mo_id, sep='/'), idlist)
newdad <- match(paste(famid, fa_id, sep='/'), idlist)


Terry Therneau
author of kinship and coxme, but not :-) the maintainer of kinship2