knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(QCAcluster) library(knitr) # nicer html tables
We use the data from Thiem (2011) for illustrating how the function wop()
calculates the weights of partitions. The weight of a partition is defined on the level of individual models and can be calculated for the consistency and coverage value of a model that has been derived from the pooled data. The weight of a partition for the consistency value of the pooled solution is calculated by applying the consistency formula only to the cases that belong to a partition. The weight of partition is calculated in absolute terms by calculating separately its contribution to the numerator and denominator of the formula. When one divides the partition-specific absolute contribution to the numerator by the contribution to the denominator, then one receives the partition-specific consistency or coverage score (depending on the type of formula).
The arguments of the functions are:
n_cut
: Frequency threshold for pooled dataincl_cut
: Inclusion threshold (a.k.a. consistency threshold) for pooled datasolution
: Either C
for conservative solution (a.k.a. complex solution) or P
for parsimonious solutionamb_selector
: Numerical value for selecting a single model in the presence of model ambiguity. Models are numbered according to their order produced by minimize by the QCA package. # load data (see data description for details) data("Thiem2011") # calculate weight of partitions wop_pars <- wop( dataset = Thiem2011, units = "country", time = "year", cond = c("fedismfs", "homogtyfs", "powdifffs", "comptvnsfs", "pubsupfs", "ecodpcefs"), out = "memberfs", n_cut = 6, incl_cut = 0.8, solution = "P", amb_selector = 1) kable(wop_pars)
When one aggregates the partition-specific absolute weights for the between-dimension or within-dimension, one gets the absolute value for the pooled solution. We illustrate this with the following chunk
# sum over all cross-sections for consistency denominator sum(wop_pars[wop_pars$type == "between", ]$denom_cons) # sum over all time series for coverage numerator sum(wop_pars[wop_pars$type == "within", ]$num_cov)
On the basis of the absolute weights, one can calculate the relative weight of a partition by dividing its absolute contribution by the corresponding value for the pooled solution.
# relative contribution of cross sections to denominator for consistency wop_between <- wop_pars[wop_pars$type == "between", ] wop_between$rel_denom_cons <- round(wop_between$denom_cons / sum(wop_between$denom_cons), digits = 2) kable(wop_between)
The weight of partitions for intermediate solutions is produced with wop_inter()
. We use data from Schwarz 2016 to illustrate the function.
# load data (see data description for details) data("Schwarz2016") # calculating weight of partitions Schwarz_wop_inter <- partition_min_inter( Schwarz2016, units = "country", time = "year", cond = c("poltrans", "ecotrans", "reform", "conflict", "attention"), out = "enlarge", n_cut = 1, incl_cut = 0.8, intermediate = c("1", "1", "1", "1", "1")) kable(Schwarz_wop_inter)
Yihui Xie (2021): knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.33.
Yihui Xie (2015): Dynamic Documents with R and knitr. 2nd edition. Chapman and Hall/CRC. ISBN 978-1498716963
Yihui Xie (2014): knitr: A Comprehensive Tool for Reproducible Research in R. In Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors, Implementing Reproducible Computational Research. Chapman and Hall/CRC. ISBN 978-1466561595
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.