# Transforms Contingency Tables to Data Frames, and Analyses Them

Contingency Tables are a pain to work with when you want to run regressions. This package takes them, flattens them into a long data frame, so you can more easily analyse them! As well, you can calculate other related statistics. All of this is done so in a 'tidy' manner, so it should tie in nicely with 'tidyverse' series of packages.

# flatr

## Overview

`flatr` is a package designed to make the analysis of contingency tables easier.

Contingency tables are a popular means of presenting categorical data in textbooks, as they take up very little space, while still allowing to present all the data. However, this means makes it tough to run analysis on them. `flatr` helps ease this pain by turning i × j × k contingency tables into "tidy" data.

## Functions

• `flatten_ct()` takes an i × j × k contingency table, and turns it into a tibble.

• `goodness_of_fit()` takes a logistic or probit regression model, and does a χ2 Goodness of Fit Test. The test statistic is one of:

• $\chi^{2} = \sum_{\forall i,j}\frac{\left( O_{i,j} - E_{i,j} \right)^{2}}{E_{i,j}}$

• $G^{2} = 2\sum_{\forall i,j}O_{i,i} \ln\left( \frac{O_{i,i}}{E_{i,i}} \right)$

## Tidy Data

`flatr` is designed to work with the tidyverse series of packages. Tidy data is data in a "long" format, where each variable has its own column.

# Reference manual

install.packages("flatr")

0.1.1 by Scott D. Graham, 3 years ago

Browse source code at https://github.com/cran/flatr

Authors: Scott D. Graham

Documentation:   PDF Manual