Skip to contents

Extracts the response values for each super-cell in a partition, returning a list where each element contains all response values belonging to that cell.

Usage

cell.y.values(partition, y)

Arguments

partition

Numeric vector of cluster membership assignments (1-based indexing). Each element indicates which super-cell the corresponding vertex belongs to.

y

Numeric vector of response values, same length as partition.

Value

A named list with one element per super-cell. Each element is a numeric vector containing all response values for vertices in that super-cell. List names correspond to the super-cell identifiers.

Details

This function provides access to the raw response values within each super-cell of a partition, enabling custom statistical analyses beyond summary statistics. Unlike compute.super.cell.stats, which returns aggregated summaries, this function returns the complete vector of values for each cell. The result is useful for visualization, distribution analysis, or computing custom statistics that require access to individual observations.

The function preserves NA values in the response vector, allowing the caller to decide how to handle missing data. Super-cells are identified by their unique values in the partition vector, and the returned list is indexed by these identifiers.

See also

compute.super.cell.stats for computing summary statistics rather than extracting raw values.

Examples

if (FALSE) { # \dontrun{
## Extract values for each super-cell
cell.values <- cell.y.values(partition = sptb.phylo.super.cells,
                              y = rel.sptb.hat.winsorized)

## Examine distribution in a specific cell
hist(cell.values[[3]], main = "Cell 3 Response Distribution")

## Compute custom statistic (e.g., coefficient of variation)
cv.by.cell <- sapply(cell.values, function(vals) {
  sd(vals, na.rm = TRUE) / mean(vals, na.rm = TRUE)
})

## Compare distributions across cells
boxplot(cell.values, xlab = "Super-Cell", ylab = "Response Value")
} # }