bootstrap_diputados: Bootstrap replicates to estimate diputados results

View source: R/ratio_estimation.R

bootstrap_diputadosR Documentation

Bootstrap replicates to estimate diputados results

Description

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

Usage

bootstrap_diputados(
  data_tbl,
  stratum,
  stratum_tbl,
  n_stratum,
  coalitions_tbl,
  B = 50,
  seed = NA,
  samples_table = FALSE,
  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.

B

Number of bootstrap replicates, defaults to 50.

seed

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

samples_table

logical indicating if the function should return the samples as a list of tibbles for bootstrap samples

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.