Extract a submatrix from a CorrelationMatrix object based on analysis numbers or hypothesis indices.
Examples
library(tibble)
# Create sample data and correlation matrix
event_data <- tibble(
H1 = c(1, 2, 1, 1, 2, 1),
H2 = c(1, 2, 2, 1, 2, 2),
Analysis = c(1, 1, 1, 2, 2, 2),
Event = c(155, 160, 85, 305, 320, 170)
)
corr_matrix <- generate_corr(event_data)
corr_obj <- CorrelationMatrix(
matrix = corr_matrix,
n_hypotheses = 2L,
n_analyses = 2L
)
# Extract subset for analysis 1 only
subset_corr <- subset_correlation_matrix(corr_obj, analysis = 1)
