compute_normalize: Trajectory similarity: variable normalization

View source: R/similarity.R

compute_normalizeR Documentation

Trajectory similarity: variable normalization

Description

Performs per-state normalization by dividing state values by: range (max-min) or sd (standard deviation). none means no normalization is performed.

Usage

compute_normalize(res_mat, method = c("none", "range", "sd"), ref_stats = NULL)

Arguments

res_mat

Trajectory matrix, first column must be time while others are states.

method

State normalization method, one of "none", "range", "sd".

ref_stats

Optional list containing pre-computed normalization statistics (e.g., from a previous call to compute_normalize). Must include: - For method = "range": mins and maxs vectors - For method = "sd": means and sds vectors

Value

Normalized trajectory matrix with attribute "ref_stats" containing normalization parameters.

Examples

mat <- cbind(time = 1:10, matrix(runif(30, 0, 10), ncol = 3))

# Range normalization with automatic stat computation
norm_mat1 <- compute_normalize(mat, "range")

# Reuse stats for another matrix
mat2 <- cbind(time = 1:10, matrix(runif(30, 5, 15), ncol = 3))
norm_mat2 <- compute_normalize(mat2, "range", attr(norm_mat1, "ref_stats"))

clockSim documentation built on April 11, 2025, 5:40 p.m.