Birth year probabilities
CalcBYprobs.Rd
Estimate the probability that an individual with unknown birth
year is born in year y
, based on BirthYears
or BY.min
and/or BY.max
of its parents, offspring, and siblings, combined with
AgePrior
(the age distribution of other parent-offspring pairs),
and/or Year.last
of its parents.
Arguments
- Pedigree
dataframe with columns id-dam-sire.
- LifeHistData
data.frame with up to 6 columns:
- ID
max. 30 characters long
- Sex
1 = female, 2 = male, 3 = unknown, 4 = hermaphrodite, other numbers or NA = unknown
- BirthYear
birth or hatching year, integer, with missing values as NA or any negative number.
- BY.min
minimum birth year, only used if BirthYear is missing
- BY.max
maximum birth year, only used if BirthYear is missing
- Year.last
Last year in which individual could have had offspring. Can e.g. in mammals be the year before death for females, and year after death for males.
"Birth year" may be in any arbitrary discrete time unit relevant to the species (day, month, decade), as long as parents are never born in the same time unit as their offspring, and only integers are used. Individuals do not need to be in the same order as in `GenoM', nor do all genotyped individuals need to be included.
- AgePrior
a matrix with probability ratios for individuals with age difference A to have relationship R, as generated by
MakeAgePrior
. IfNULL
,MakeAgePrior
is called using its default values.
Value
A matrix with for each individual (rows) in the pedigree that has a missing
birth year in LifeHistData
, or that is not included in
LifeHistData
, the probability that it is born in y
(columns).
Probabilities are rounded to 3 decimal points and may therefore not sum
exactly to 1.
Details
This function assists in estimating birth years of individuals for which these are unknown, provided they have at least one parent or one offspring in the pedigree. It is not a substitute for field-based estimates of age, only a method to summarise the pedigree + birth year based information.
WARNING
Any errors in the pedigree or lifehistory data will cause errors in the birth year probabilities of their parents and offspring, and putatively also of more distant ancestors and descendants. If the ageprior is based on the same erroneous pedigree and lifehistory data, all birth year probabilities will be affected.
See also
MakeAgePrior
to estimate effect of age on
relationships.
Examples
# exclude 20 random individuals from LH_griffin, then estimate their birth
# years from the birth years of their parents and/or offspring:
BYprobs <- CalcBYprobs(Pedigree = Ped_griffin,
LifeHistData = LH_griffin[-sample(1:200, 20),])
#> Transferring input pedigree ...
utils::head(BYprobs)
#> 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008
#> i004_2001_F 0 0 0.026 0.053 0.363 0.558 0.000 0.000 0 0 0 0
#> i005_2001_F 0 0 0.000 0.245 0.755 0.000 0.000 0.000 0 0 0 0
#> i024_2002_M 0 0 0.000 0.000 0.000 0.791 0.209 0.000 0 0 0 0
#> i034_2002_F 0 0 0.000 0.000 0.000 1.000 0.000 0.000 0 0 0 0
#> i043_2003_M 0 0 0.000 0.000 0.000 0.000 0.891 0.109 0 0 0 0
#> i044_2003_F 0 0 0.000 0.000 0.000 0.389 0.611 0.000 0 0 0 0
#> 2009 2010
#> i004_2001_F 0 0
#> i005_2001_F 0 0
#> i024_2002_M 0 0
#> i034_2002_F 0 0
#> i043_2003_M 0 0
#> i044_2003_F 0 0
# For some individuals, the most-likely birth year will not be the actual
# birth year. But with sufficient quantity and quality of information, the
# actual birth year will be among the plausible ones, and be close to the
# most-likely birth year.
if (FALSE) { # \dontrun{
# heatmap
lattice::levelplot(t(BYprobs), aspect="fill", col.regions=hcl.colors)
} # }