An open API service indexing awesome lists of open source software.

https://github.com/amoneva/cacc

An R Package to compute Conjunctive Analysis of Case Configurations (CACC), Situational Clustering Tests, and Main Effects
https://github.com/amoneva/cacc

criminology data-analysis r social-science

Last synced: about 1 year ago
JSON representation

An R Package to compute Conjunctive Analysis of Case Configurations (CACC), Situational Clustering Tests, and Main Effects

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r}
#| include: false

knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# `cacc`: Conjunctive Analysis of Case Configurations

[![CRAN status](https://www.r-pkg.org/badges/version/cacc)](https://CRAN.R-project.org/package=cacc)

[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)

[![R-CMD-check](https://github.com/amoneva/cacc/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/amoneva/cacc/actions/workflows/R-CMD-check.yaml)

An R Package to compute Conjunctive Analysis of Case Configurations (CACC), Situational Clustering Tests, and Main Effects

## Overview

A set of functions to conduct Conjunctive Analysis of Case Configurations (CACC) (Miethe, Hart & Regoeczi, 2008), to identify and quantify situational clustering in dominant case configurations (Hart, 2019), and to determine the main effects of specific variable values on the probabilities of outcome (Hart, Rennison & Miethe, 2017). Initially conceived as an exploratory technique for multivariate analysis of categorical data, CACC has developed to include formal statistical tests that can be applied in a wide variety of contexts. This technique allows examining composite profiles of different units of analysis in an alternative way to variable-oriented methods.

## Installation

To install cacc, you can run:

```{r install}
#| eval: false

# Install {cacc} from CRAN
install.packages("cacc")
```

You can also install the development version of cacc from [GitHub](https://github.com/) with:

```{r install-devel}
#| eval: false

# Check if the `devtools` package needs to be installed
if (!require("devtools")) install.package("devtools")

# Install {cacc} from GitHub
devtools::install_github("amoneva/cacc")
```

## Examples

```{r load}
#| warning: false

# Load {cacc} and the {tidyverse}
library(cacc)
library(tidyverse)
```

```{r explore}
# Explore the dataset
onharassment |> glimpse()
```

### CACC

```{r cacc}
# Calculate the CACC matrix
cacc_matrix <- onharassment |>
cacc(
ivs = sex:privacy,
dv = rep_victim
)

# Look at the first few rows
cacc_matrix |> head()
```

### Situational Clustering Tests

```{r chi}
# Compute a Chi-Square Goodness-of-Fit Test
cacc_matrix |> cluster_xsq()
```

```{r sci}
# Compute a Situational Clustering Index (SCI)
cacc_matrix |> cluster_sci()

# Plot a Lorenz Curve to visualize the SCI
cacc_matrix |> plot_sci()
```

### Main Effects

```{r effect}
# Compute the main effects for a specific variable value
cacc_matrix |>
main_effect(
iv = sex,
value = "female",
# Set to `FALSE` for a numeric vector of effects
summary = TRUE
)

# Plot the distribution of the main effect
cacc_matrix |>
plot_effect(
iv = sex,
value = "female"
)
```

## References

- Hart, T. C. (2019). Identifying Situational Clustering and Quantifying Its Magnitude in Dominant Case Configurations: New Methods for Conjunctive Analysis. *Crime & Delinquency, 66*(1), 143-159. https://doi.org/10.1177/0011128719866123
- Hart, T. C., Rennison, C. M., & Miethe, T. D. (2017). Identifying Patterns of Situational Clustering and Contextual Variability in Criminological Data: An Overview of Conjunctive Analysis of Case Configurations. *Journal of Contemporary Criminal Justice, 33*(2), 112–120. https://doi.org/10.1177/1043986216689746
- Miethe, T. D., Hart, T. C., & Regoeczi, W. C. (2008). The Conjunctive Analysis of Case Configurations: An Exploratory Method for Discrete Multivariate Analyses of Crime Data. *Journal of Quantitative Criminology, 24*, 227–241. https://doi.org/10.1007/s10940-008-9044-8