Skip to contents

This function performs a chi-squared contingency table test on dropout for a given question in the data. Note that the input data should be in the format as computed by compute_stats(). The test can be performed on either all conditions (excluding total) or on select conditions.

Usage

do_chisq(do_stats, chisq_question, sel_cond_chisq, p_sim = TRUE)

Arguments

do_stats

data.frame of dropout statistics as computed by compute_stats().

chisq_question

numeric Which question to compare dropout at.

sel_cond_chisq

vector (same class as in conditions variable in original data set) selected conditions.

p_sim

boolean Simulate p value parameter (by Monte Carlo simulation)? Defaults to TRUE.

Value

Returns test results from chisq.test between experimental conditions at defined question.

See also

add_dropout_idx() and compute_stats() which are necessary for the proper data structure.

Examples

do_stats <- compute_stats(add_dropout_idx(dropRdemo, 3:54),
by_cond = "experimental_condition",
no_of_vars = 52)

do_chisq(do_stats, 47, c(12, 22), TRUE)
#> $`Test result`
#> 
#> 	Pearson's Chi-squared test with simulated p-value (based on 2000
#> 	replicates)
#> 
#> data:  test_table
#> X-squared = 4.8802, df = NA, p-value = 0.03598
#> 
#> 
#> $`Dropout at question 47`
#>           participants
#> conditions dropout remaining
#>         12      15        42
#>         22      28        33
#>