Skip to contents

Performs a goodness-of-fit test and calculates the Gini coefficient. The goodness-of-fit-test is calculated using stats::chisq.test.

Usage

effect_counts_one(data, col, clean = TRUE, ...)

Arguments

data

A tibble.

col

The column holding factor values.

clean

Prepare data by data_clean

...

Placeholder to allow calling the method with unused parameters from effect_counts.

Value

A volker tibble with the following statistical measures:

  • Gini coefficient: Gini coefficient, measuring inequality.

  • n: Number of cases the calculation is based on.

  • Chi-squared: Chi-Squared test statistic.

  • p: p-value for the statistical test.

  • stars: Significance stars based on p-value (*, **, ***).

Examples

library(volker)
data <- volker::chatgpt

data |>
  filter(sd_gender != "diverse") |>
  effect_counts_one(sd_gender)
#> 
#> 
#> |Statistic        | Value|
#> |:----------------|-----:|
#> |Gini coefficient |  0.10|
#> |n                |   100|
#> |Chi-squared      |  4.00|
#> |p                | 0.046|
#> |stars            |     *|