Learn R Programming

bullseye

The goal of bullseye is to provide a tidy data structure and visualisations for multiple or grouped variable correlations, general association measures and other pairwise scores suitable for numerical, ordinal and nominal variables.

Installation

You can install the development version of bullseye from GitHub with:

# still in progress
# install.packages("devtools")
# devtools::install_github("cbhurley/bullseye")

Build a pairwise data structure

library(bullseye)
irisc <- pairwise_scores(iris, by = "Species") 
irisc
#> # A tibble: 24 × 6
#>    x            y            score   group      value pair_type
#>    <chr>        <chr>        <chr>   <fct>      <dbl> <chr>    
#>  1 Petal.Length Sepal.Length pearson setosa     0.267 nn       
#>  2 Petal.Width  Sepal.Length pearson setosa     0.278 nn       
#>  3 Sepal.Length Sepal.Width  pearson setosa     0.743 nn       
#>  4 Petal.Length Sepal.Width  pearson setosa     0.178 nn       
#>  5 Petal.Width  Sepal.Width  pearson setosa     0.233 nn       
#>  6 Petal.Length Petal.Width  pearson setosa     0.332 nn       
#>  7 Petal.Length Sepal.Length pearson versicolor 0.754 nn       
#>  8 Petal.Width  Sepal.Length pearson versicolor 0.546 nn       
#>  9 Sepal.Length Sepal.Width  pearson versicolor 0.526 nn       
#> 10 Petal.Length Sepal.Width  pearson versicolor 0.561 nn       
#> # ℹ 14 more rows

This calculates correlations for every level of species in the data.

For other methods for calculating pairwise variable scores see the vignette “Calculating pairwise scores using bullseye”.

Visualise the correlations

plot_pairwise(irisc)

The glyph shows the overall or ungrouped correlation in the center, and the grouped correlations in the wedges. These are setosa, versicolor, virginica starting from the top and going anti-clockwise. Use

plot_pairwise(irisc, interactive=TRUE)

to see the groups represented by the wedges. The ungrouped Pearson correlation of Sepal.Width with the other three variables is negative, but the correlations for each of the Species is positive.

A second visualisation is offered also:

plot_pairwise_linear(irisc)

For more visualisation examples see the vignette “Visualising pairwise scores using bullseye”.

Copy Link

Version

Install

install.packages('bullseye')

Monthly Downloads

413

Version

0.1.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Catherine Hurley

Last Published

January 28th, 2025

Functions in bullseye (0.1.2)

pair_nmi

Normalized mutual information
pair_tauC

Stuarts's tau C for association between ordinal factors.
pair_tauB

Kendall's tau B for association between ordinal factors.
pair_methods

Pairwise score functions available in the package
pair_polychor

Polychoric correlation
plot_pairwise_linear

Pairwise plot in a linear layout
pair_uncertainty

Uncertainty coefficient for association between factors.
pair_tauW

Kendall's W for association between ordinal factors.
plot.pairwise

Plot method for class pairwise.
pair_ace

Alternating conditional expectations correlation
bullseye-package

bullseye: Visualising Multiple Pairwise Variable Correlations and Other Scores
pairwise

A generic function to create a data structure for every variable pair in a dataset
pairwise_multi

Calculates multiple scores
pairwise_scores

Calculates scores or conditional scores for a dataset
plot_pairwise

Pairwise plot in a matrix layout
pair_polyserial

Polyserial correlation
pairwise_by

Constructs a pairwise result for each level of a by variable.
ace_cor

Calculates ace based transformations and correlation, handling missing values and factors.
pair_control

Default scores calculated by pairwise_scores
pair_cor

Pearson, Spearman or Kendall correlation
pair_cancor

Canonical correlation
pair_chi

Pearson's Contingency Coefficient for association between factors.
pair_mine

MINE family values
as.matrix.pairwise

Converts a pairwise to a symmetric matrix. Uses the first entry for each (x,y) pair.
pair_scagnostics

Graph-theoretic scagnostics values
pair_tauA

Kendall's tau A for association between ordinal factors.
pair_dcor

Distance correlation
pair_gkGamma

Goodman Kruskal's Gamma for association between ordinal factors.
pair_gkTau

Goodman Kruskal's Tau for association between ordinal factors.