combine_replicates: Combine imputed replicates according to calculate totals....

View source: R/combine_replicates.R

combine_replicatesR Documentation

Combine imputed replicates according to calculate totals. Combination is done using the standard approach that makes use of the laws of total expectation and total variance.

Description

Combine imputed replicates according to calculate totals. Combination is done using the standard approach that makes use of the laws of total expectation and total variance.

Usage

combine_replicates(
  violation,
  replicates_obs_data,
  replicates_data,
  strata_vars = NULL,
  conflict_filter = TRUE,
  forced_dis_filter = FALSE,
  edad_minors_filter = FALSE,
  include_props = FALSE,
  digits = 2
)

Arguments

violation

Violation to be analyzed. Options are "homicidio", "secuestro", "reclutamiento" and "desaparicion".

replicates_obs_data

The data frame that results from applying summary_observed.

replicates_data

A data frame containing replicates data.

strata_vars

Variable with all observations (without missing values).

conflict_filter

Filter that indicates if the data is filtered using the "is_conflict" rule.

forced_dis_filter

Filter that indicates if the data is filtered using the "is_forced_dis" rule.

edad_minors_filter

Optional filter by age (edad) < 18.

include_props

A logical value indicating whether or not to include the proportions from the calculations before merging with summary_observed's output.

digits

Number of decimal places to round the results to. Default value is 2.

Value

A data frame with 5 or more columns: name of variable(s), observed the number of observations in each category for every variable, imp_lo the lower bound of the 95% confidence interval, imp_hi the upper bound of the 95% confidence interval, and imp_mean the point estimate of the mean value.

Examples


local_dir <- system.file("extdata", "right", package = "verdata")
replicates_data <- read_replicates(local_dir, "reclutamiento", c(1, 2),
version = "v1")
replicates_obs_data <- summary_observed("reclutamiento", replicates_data,
strata_vars = "sexo", conflict_filter = FALSE, forced_dis_filter = FALSE,
edad_minors_filter = FALSE, include_props = FALSE, digits = 2)
tab_combine <- combine_replicates("reclutamiento", replicates_obs_data,
replicates_data, strata_vars = 'sexo', conflict_filter = TRUE,
forced_dis_filter = FALSE, edad_minors_filter = FALSE, include_props = FALSE,
digits = 2)


verdata documentation built on June 8, 2025, 11:46 a.m.