Skip to contents

Generate correlation matrix based on event counts

Usage

generate_corr(event)

Arguments

event

Event count of each hypothesis at each analysis, including event count of the intersection of hypotheses. It contains 4 columns: H1, H2, Analysis, Event. H1 needs to be listed as 1, 2, 3, etc. as numbers.

Value

A correlation matrix.

Examples

# Build the transition matrix
m <- matrix(c(
  0, 0.5, 0.5,
  0.5, 0, 0.5,
  0.5, 0.5, 0
), nrow = 3, byrow = TRUE)
# initialize weights
w <- c(1 / 3, 1 / 3, 1 / 3)

# Input event count of intersection of paired hypotheses - Table 2
event <- tibble::tribble(
  ~H1, ~H2, ~Analysis, ~Event,
  1, 1, 1, 155,
  2, 2, 1, 160,
  3, 3, 1, 165,
  1, 2, 1, 85,
  1, 3, 1, 85,
  2, 3, 1, 85,
  1, 1, 2, 305,
  2, 2, 2, 320,
  3, 3, 2, 335,
  1, 2, 2, 170,
  1, 3, 2, 170,
  2, 3, 2, 170
)

# Generate correlation from events
gs_corr <- generate_corr(event)