1. Central Tendency and Variance Vectors
Raw numbers must be compressed into tracking indicators to communicate clinical realities. Central tendency metrics—like the mean (average) and median (middle point)—locate the center of your data distribution. Spread metrics—like variance and standard deviation—quantify how much your sample vectors drift away from that central point.
The Missing Value Trap
If a single cell within your data vector contains an unrecorded value or missing tracker (represented as NA), R mathematical algorithms will evaluate the final function output as NA. You must explicitly pass the 'na.rm = TRUE' flag to drop missing positions during calculation.
2. Group-Wise Data Stratification
Evaluating an entire patient group as a single block often masks critical insights. Stratification involves splitting continuous indicators by categorical variables (such as separating drug efficacy by a 'placebo' or 'active' treatment assignment). This enables you to compare separate subset distributions directly.
# Statistical calculations handling missing parameters:
# Compute global sample metrics safely
avg_weight <- mean(patients$weight_kg, na.rm = TRUE)
var_weight <- var(patients$weight_kg, na.rm = TRUE)
# Stratified subset summaries
placebo_mean <- mean(patients$weight_kg[patients$group == "Placebo"], na.rm = TRUE)
treated_mean <- mean(patients$weight_kg[patients$group == "Treated"], na.rm = TRUE)