  In this article, we combine replication pricing with expectation pricing for
derivative trades that are partially collateralized by cash. The derivatives
are replicated by underlying assets and cash, using repurchasing agreement
(repo) and margining, which incur funding costs. We derive a partial
differential equation (PDE) for the derivatives price, obtain and decompose its
solution into the risk-free value of the derivative plus credit valuation
adjustment (CVA) and funding valuation adjustment (FVA). For most derivatives,
as we shall show, CVAs can be evaluated analytically or semi-analytically,
while FVAs, as well as the derivatives values, will have to be solved
recursively through numerical procedures due to their interdependence. In
numerical demonstrations, continuous and discrete margin revisions are
considered, respectively, for an equity call option and a vanilla interest-rate
swaps.
