# R/paf_combine.R In pifpaf: Potential Impact Fraction and Population Attributable Fraction for Cross-Sectional Data

#### Documented in paf.combine

```#' @title Combine point estimates of PAF from different subpopulations
#'
#' @description Function for fast-computing an overall  \code{\link{paf}}
#'
#' @details The subpopulations considered should not contain common elements.
#'
#' @param paf_vector Vector containing \code{\link{paf}}s of each specific
#'   subpopulation.
#'
#' @param proportions Vector establishing the proportion of individuals in each
#'   subpopulation.
#'
#' @return overall_paf An overall point-estimate of \code{\link{paf}} combining all
#'   subpopulations.
#'
#' @author Rodrigo Zepeda-Tello \email{[email protected]}
#' @author Dalia Camacho-García-Formentí \email{[email protected]}
#'
#' @seealso \code{\link{paf}} for Population Attributable Fraction estimation,
#'   \code{\link{pif}} for Potential Impact Fraction estimation, and
#'   \code{\link{pif.combine}} for combining several PIF.
#'
#' @examples
#'
#' #Example 1
#' #-------------
#'
#' #Estimate PAF for each subpopulation
#' pafmen   <- paf(X = data.frame(2.7), thetahat = 0.12,
#'                 rr = function(X, theta){X*theta + 1},
#'                 Xvar = 0.11, method = "approximate")
#' pafwomen <- paf(X = data.frame(3.1), thetahat = 0.12,
#'                 rr = function(X, theta){exp(X*theta/3)},
#'                 Xvar = 0.17, method = "approximate")
#'
#' #Combine estimates
#' paf.combine(c(pafmen, pafwomen), c(0.45, 0.55))
#'
#'
#' @export

paf.combine <- function(paf_vector, proportions){

pif.combine(paf_vector, paf_vector, proportions)

}
```

## Try the pifpaf package in your browser

Any scripts or data that you put into this service are public.

pifpaf documentation built on Sept. 29, 2017, 1:03 a.m.