ratio_estimation_diputados: Bootstrap estimates for diputados

View source: R/ratio_estimation.R

ratio_estimation_diputadosR Documentation

Bootstrap estimates for diputados

Description

Compute bootstrap confidence intervals using ratio estimator for each party at national level, along with proportion of votes for each stratum and party.

Usage

ratio_estimation_diputados(
  data_tbl,
  stratum,
  stratum_tbl,
  n_stratum,
  coalitions_tbl,
  assignment_tbl,
  B = 500,
  seed = NA,
  parametric = FALSE
)

Arguments

data_tbl

tibble

stratum

Unquoted variable indicating the stratum for each polling station.

stratum_tbl

Data frame with stratum variable (named exactly as in data) and number of polling stations per strata.

n_stratum

Unquoted variable indicating the number of polling stations in each stratum.

coalitions_tbl

Tibble with coalitions names and corresponding parties.

assignment_tbl

data.frame indicating the strata where coalitions apply and the candidate assigned to each. Party columns must be named party, the candidate party must be named party.

B

Number of bootstrap replicates, defaults to 50.

seed

integer value used to set the state of the random number generator (optional).

parametric

logical indicating if parametric bootstrap should be used. By default is false, indicating non-parametric bootstrap.

Value

A list including two componentes: point estimates at national level and at stratum level, and bootstrap replications of these quantities.


cotecora-team-2/quickcountmx documentation built on July 17, 2025, 5:14 a.m.