Title: | Estimate Power and Required Sample Size in QCA |
---|---|
Description: | Researchers working with Qualitative Comparative Analysis (QCA) can use the package to estimate power of a sufficient term using permutation tests. A term can be anything: A condition, conjunction or disjunction of any combination of these. The package further allows users to plot the estimation results and to estimate the number of cases required to achieve a certain level of power, given a prespecified null and alternative hypothesis. Reference for the article introducing power estimation for QCA is: Rohlfing, Ingo (2018) <doi:10.1017/pan.2017.30> (ungated version: <doi:10.17605/OSF.IO/PC4DF>). |
Authors: | Ingo Rohlfing [aut, cre], Holger Doering [aut], Ayjeren Rozyjumayeva [aut] |
Maintainer: | Ingo Rohlfing <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-11-17 04:10:35 UTC |
Source: | https://github.com/ingorohlfing/qcapower |
qcapower
returns a power estimate with regard to the consistency
of a term, given information about the required parametersqcapower
allows you to estimate power for a term. Probability
is the probability of rejecting the null hypothesis that no set relation
is in plaace when it is in place, in fact. A term can be a single condition,
a conjunction, or a disjunction of any combination of the two.
qcapower( cases, null_hypo, alt_hypo, sims = 1000, perms = 10000, alpha = 0.05, cons_threshold = 0.01, set_seed = 135 )
qcapower( cases, null_hypo, alt_hypo, sims = 1000, perms = 10000, alpha = 0.05, cons_threshold = 0.01, set_seed = 135 )
cases |
Number of cases. In fuzzy-set QCA, equal to total number of cases in the analysis |
null_hypo |
Null hypothesis (H0). Consistency value separating consistent from inconsistent terms. It is the highest possible consistency value that would let you conclude that no set relation is given. |
alt_hypo |
Alternative hypothesis (H1). Expected, actual consistency value of term. |
sims |
Number of simulations for calculating power |
perms |
Number of permutations of hypothetical dataset per simulation run |
alpha |
Level of alpha at which statistical significance of H0 is tested |
cons_threshold |
Degree of tolerance in generating hypothetical data
with consistency equaling |
set_seed |
Parameter for achieving reproducibility of estimate |
A dataframe with rows equaling the number of sims
.
power
is the power estimate and is identical for each rows.
powercum
is the running power estimate up to this row. quant
is the 5%-quantile of the permuted distributions. See the vignette for
more information.
power_data <- qcapower(cases = 20, null_hypo = 0.8, alt_hypo = 0.95, sims = 10, perms = 1000) head(power_data)
power_data <- qcapower(cases = 20, null_hypo = 0.8, alt_hypo = 0.95, sims = 10, perms = 1000) head(power_data)
qp_cases
calculates the number of cases needed for a particular
power level. It is based on the presimulated data using qcapower
.
See the vignette for more details.
qp_cases(power_target, null_hypo, alt_hypo)
qp_cases(power_target, null_hypo, alt_hypo)
power_target |
Desired level of power |
null_hypo |
Null hypothesis (H0). Consistency value separating consistent from inconsistent terms. |
alt_hypo |
Alternative hypothesis (H1). Expected, actual consistency value of term. |
An integer showing how many cases are needed to achieve the target level of power.
qp_cases(0.1, null_hypo = 0.8, alt_hypo = 1)
qp_cases(0.1, null_hypo = 0.8, alt_hypo = 1)
qp_cases_brute
calculates the number of cases needed for a particular
power level. The function starts with the number of cases given by start_value
and iteratively simulates power and adjusts the number of cases
until the power_target
is met or the max_value
has been reached.
Running the function can take a lot of time. Use qp_cases
to
qp_cases_brute( power_target, start_value = 2, max_value = 100, progress = TRUE, ... )
qp_cases_brute( power_target, start_value = 2, max_value = 100, progress = TRUE, ... )
power_target |
Power level target |
start_value |
Default number of cases for initial search |
max_value |
Default maximum number of cases for search |
progress |
Show progress of calculation (default |
... |
|
An integer showing how many cases are needed to achieve the target level of power.
## Not run: qp_cases_brute(power_target = 0.9, null_hypo = 0.80, alt_hypo = 1) qp_cases_brute(power_target = 0.9, null_hypo = 0.80, alt_hypo = 1, start_value = 20, max_value = 50, perms = 500) ## End(Not run)
## Not run: qp_cases_brute(power_target = 0.9, null_hypo = 0.80, alt_hypo = 1) qp_cases_brute(power_target = 0.9, null_hypo = 0.80, alt_hypo = 1, start_value = 20, max_value = 50, perms = 500) ## End(Not run)
Depending on the number of cases, the permuted distributions of consistency values can differ narrowly or widely in terms of their location on the spectrum and their shape.
qp_quant_plot(power_est, title = FALSE)
qp_quant_plot(power_est, title = FALSE)
power_est |
Dataframe containing simulation results (see
|
title |
Option for adding title to plot (default |
Creates a sina plot with ggforce
A sina plot using the cases to visualize the density distribution ('gg' object).
sim_data <- qp_sina_data qp_quant_plot(sim_data)
sim_data <- qp_sina_data qp_quant_plot(sim_data)
qp_run_plot
allows you to plot the running power estimate to
determine whether sims
is sufficiently large to derive a reliable
estimate
qp_run_plot(power_est, title = FALSE)
qp_run_plot(power_est, title = FALSE)
power_est |
Dataframe containing the simulation results (see
|
title |
Option for adding title to plot (default |
Creates a plot with ggplot2
A line plot ('gg' object).
power_data <- qcapower(cases = 20, null_hypo = 0.8, alt_hypo = 0.95, sims = 10, perms = 1000) qp_run_plot(power_data) # Using data with 10000 estimates data(qp_sina_data) qp_run_plot(qp_sina_data)
power_data <- qcapower(cases = 20, null_hypo = 0.8, alt_hypo = 0.95, sims = 10, perms = 1000) qp_run_plot(power_data) # Using data with 10000 estimates data(qp_sina_data) qp_run_plot(qp_sina_data)
A dataset containing power simulations for different number of cases and different values for null- and alternative hypothesis
qp_sim_power
qp_sim_power
A dataframe with simulation parameters and calculated power
number of cases
null hypothesis (H0)
alternative hypothesis
number of simulations
number of permutations
calculate power
A dataset containing the estimated 5%-quantiles from a power simulation with 1000 simulations each with 10000 permutations. The value for the alternative hypothesis was set to 1.
qp_sina_data
qp_sina_data
A dataframe with 1000 rows and 6 variables:
power estimate over 1000 simulations
running power estimate for ith simulation
null hypothesis (H0), set to 0.8 (irrelevant here)
alternative hypothesis (H1), set to 1
number of cases, set to 10
estimated 5%-quantiles per simulations