## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(arkhaia)

## -----------------------------------------------------------------------------
x1 <- c(2, 0, 10, 11, 5)
x2 <- c(1, 1, 17, 23, 3)
x3 <- c(0, 0, 2, 81, 11)
x4 <- c(3, 18, 9, 0, 23)
x <- matrix(c(x1, x2, x3, x4), ncol = 4)
colnames(x) <- c("surface1", "subsurface1", "surface2", "subsurface2")
rownames(x) <- LETTERS[1:5]

x

## -----------------------------------------------------------------------------
CR(x[,1:2])
CR(x[,3:4])

## -----------------------------------------------------------------------------
VB(x[,1:2])
VB(x[,3:4])

## -----------------------------------------------------------------------------
# Pearson's chi-squared
VB(x[,1:2], lambda = 1)
VB(x[,3:4], lambda = 1)

## -----------------------------------------------------------------------------
x_effect_sizes <- VB_pair(x)
x_effect_sizes

## -----------------------------------------------------------------------------
# related pairs
W_contexts <- matrix(c("surface1", "surface2", "subsurface1", "subsurface2"), ncol = 2)
W_contexts

# homogeneity
x_homogeneity <- homogeneity(x_effect_sizes, related = W_contexts)

x_homogeneity

## -----------------------------------------------------------------------------
x_logOR <- log_OR_pair(x)
x_logOR

x_trace <- trace_pair(x)
x_trace

## -----------------------------------------------------------------------------
# homogeneity
x_homogeneity_logOR <- homogeneity(x_logOR, related = W_contexts, direction = "WU")
x_homogeneity_logOR

x_homogeneity_trace <- homogeneity(x_trace, related = W_contexts, direction = "WU")
x_homogeneity_trace

