% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pedanalysis.R
\name{pedpartial}
\alias{pedpartial}
\title{Calculate Partial Inbreeding}
\usage{
pedpartial(ped, ancestors = NULL, top = 20)
}
\arguments{
\item{ped}{A \code{tidyped} object.}

\item{ancestors}{Character vector. IDs of ancestors to calculate partial 
inbreeding for. If NULL, the top ancestors by marginal contribution are used.}

\item{top}{Integer. Number of top ancestors to include if \code{ancestors} is NULL.}
}
\value{
A \code{data.table} with the first column as \code{Ind} and subsequent 
  columns representing the partial inbreeding ($pF$) from each ancestor.
}
\description{
Decomposes individuals' inbreeding coefficients into marginal contributions from 
specific ancestors. This allows identifying which ancestors or lineages are 
responsible for the observed inbreeding.
}
\details{
The sum of all partial inbreeding coefficients for an individual (including 
contributions from founders) equals $1 + f_i$, where $f_i$ is the total 
inbreeding coefficient. This function specifically isolates the terms in 
the Meuwissen & Luo (1992) decomposition that correspond to the selected ancestors.
}
\examples{
\donttest{
library(data.table)
tp <- tidyped(inbred_ped)
# Calculate partial inbreeding originating from specific ancestors
target_ancestors <- inbred_ped[is.na(Sire) & is.na(Dam), Ind]
pF <- pedpartial(tp, ancestors = target_ancestors)
print(tail(pF))
}

}
\references{
Lacey, R. C. (1996). A formula for determining the partial inbreeding coefficient, 
\eqn{F_{ij}}. Journal of Heredity, 87(4), 337-339.

Meuwissen, T. H., & Luo, Z. (1992). Computing inbreeding coefficients in 
large populations. Genetics Selection Evolution, 24(4), 305-313.
}
