familycheck.RdGiven a family id vector, also compute the familial grouping from first principles using the parenting data, and compare the results.
familycheck(famid, id, father.id, mother.id, newfam)a vector of family identifiers
a vector of unique subject identifiers
vector containing the id of the biological father
vector containing the id of the biological mother
the result of a call to makefamid.
If this has allready been computed by the user,
adding it as an argument shortens the running time somewhat.
a data frame with one row for each unique family id in the
famid argument.
Components of the output are
the family id, as entered into the data set
number of subjects in the family
number of them that appear to be unrelated to anyone else in the entire pedigree set. This is usually marry-ins with no children (in the pedigree), and if so are not a problem.
number of unique "new" family ids. If this is 0, it means that no one in this "family" is related to anyone else (not good); 1 = everythings is fine; 2+= the family appears to be a set of disjoint trees. Are you missing some of the people?
number of other families that had a unique famid, but are actually joined to this one. 0 is the hope. If there are any joins, then an attribute "join" is attached. It will be a matrix with famid as row labels, new-family-id as the columns, and the number of subjects as entries.
The makefamid function is used to create a
de novo family id from the parentage data, and this is compared to the
family id given in the data.
# use 2 sample peds
data(sample.ped)
pedAll <- with(sample.ped, pedigree(id, father, mother, sex,
affected=cbind(affected, avail), famid=ped))
## check them giving separate ped ids
fcheck.sep <- with(sample.ped, familycheck(ped, id, father, mother))
fcheck.sep
#> famid n unrelated split join
#> 1 1 41 1 1 0
#> 2 2 14 0 1 0
## check assigning them same ped id
fcheck.combined <- with(sample.ped, familycheck(rep(1,nrow(sample.ped)), id, father, mother))
fcheck.combined
#> famid n unrelated split join
#> 1 1 55 1 2 0
#make person 120's father be her son.
sample.ped[20,3] <- 131
fcheck1.bad <- try({with(sample.ped, familycheck(ped, id, father, mother))}, silent=FALSE)
#> Error in kindepth(id, father.id, mother.id) :
#> Impossible pedegree: someone is their own ancestor
## fcheck1.bad is a try-error