Why Soil Texture Percentages Can Mislead: Compositional Analysis in R

Sand, silt and clay in a soil texture triangle alongside a log-ratio plot in R

Soil texture is routinely summarized as three percentages: sand, silt and clay. They look like three ordinary quantitative variables, but they are parts of one whole. A soil cannot gain ten percentage points of clay while keeping both its sand and silt percentages unchanged. That simple fact changes the geometry of the data, the way we interpret correlations, and the predictors we choose for a model.

This lesson uses an anonymized subset of Washington State soil-health observations to show what the fixed-total constraint means, how to draw the samples on a soil triangle, and why ratios between components are often more meaningful than raw percentages.

The question and the observations

A sample’s three percentages obey

sand + silt + clay = 100

Knowing any two determines the third. The data therefore have two free compositional dimensions, even though three columns are recorded. This is closure, not a statistical discovery about soil-forming processes.

The observations come from the Washington State Department of Agriculture / Washington Soil Health Initiative’s anonymized State of the Soils Assessment teaching subset, containing measurements from 2022 and 2023. Each row describes one soil sample; producer identifiers may recur, so samples are not automatically independent farms. The bulk-density column offers a secondary illustration, not a causal study of soil management.

1. Import the soil samples and check their meaning

Before calculating a correlation, confirm the real observation unit, types, positivity and row-wise total. Positive components are required because the logarithm of zero is undefined.

# SECTION 01 — Import and check the physical sampling unit
input_file <- "01_data/washi_soil_texture_100.csv"
soil <- read.csv(input_file, stringsAsFactors = FALSE)
parts <- c("sand_percent", "silt_percent", "clay_percent")
needed <- c("sample_id", "producer_id", "texture", "bd_g_cm3", parts)

if (!all(needed %in% names(soil))) stop("Required columns are missing")
if (nrow(soil) != 100L) stop("Unexpected number of source soil samples")
if (anyNA(soil[needed])) stop("Required source fields contain missing values")
if (anyDuplicated(soil$sample_id)) stop("Sample IDs must be unique")
if (!all(vapply(soil[c(parts, "bd_g_cm3")], is.numeric, logical(1)))) {
  stop("Soil texture and bulk density must be numeric")
}
if (!all(is.finite(as.matrix(soil[c(parts, "bd_g_cm3")])))) {
  stop("Non-finite measurements found")
}
if (!all(as.matrix(soil[parts]) > 0) || !all(soil$bd_g_cm3 > 0)) {
  stop("Log-ratios require positive components and valid density")
}
if (!all(abs(rowSums(soil[parts]) - 100) < 1e-8)) {
  stop("Texture percentages do not sum to 100")
}

out_dir <- "04_outputs"
dir.create(out_dir, showWarnings = FALSE, recursive = TRUE)
cat(nrow(soil), "soil samples;", length(unique(soil$producer_id)),
    "anonymized producers\n")
100 soil samples; 82 anonymized producers

All 100 samples have positive texture components, no missing required values and row totals of exactly 100 percent. The file includes 82 anonymized producer IDs; repeated identifiers mean that a sample count should not be read as a count of independent farms. Across the samples, median sand, silt and clay contents are 38.5, 43.5, 12 percent, respectively.

2. What ordinary correlations show—and omit

A typical first step is to summarize the percentages and correlate the three columns. This can be useful descriptively, provided the correlations are not interpreted as three unconstrained variables changing independently.

# SECTION 02 — Summaries and the constrained raw-percent correlations
summary_table <- data.frame(
  variable = c(parts, "bd_g_cm3"),
  minimum = vapply(soil[c(parts, "bd_g_cm3")],
                   function(x) as.numeric(min(x)), numeric(1)),
  median = vapply(soil[c(parts, "bd_g_cm3")], median, numeric(1)),
  mean = vapply(soil[c(parts, "bd_g_cm3")], mean, numeric(1)),
  maximum = vapply(soil[c(parts, "bd_g_cm3")],
                   function(x) as.numeric(max(x)), numeric(1))
)
raw_corr <- cor(soil[parts])

write.csv(summary_table, file.path(out_dir, "01_sample_summary.csv"),
          row.names = FALSE)
write.csv(data.frame(component = rownames(raw_corr), raw_corr,
                     check.names = FALSE),
          file.path(out_dir, "02_raw_percent_correlations.csv"),
          row.names = FALSE)
print(round(raw_corr, 3))
             sand_percent silt_percent clay_percent
sand_percent        1.000       -0.913       -0.621
silt_percent       -0.913        1.000        0.248
clay_percent       -0.621        0.248        1.000

Across these samples, the sand–silt correlation is -0.913, the sand–clay correlation is -0.621, and the silt–clay correlation is 0.248. The first two associations are negative and the third is positive. All are observed within-sample descriptions, but negative associations among parts can arise partly from the 100-percent constraint. Their signs and magnitudes alone do not establish antagonistic soil processes, and closure alone does not determine every coefficient.

3. The soil triangle: one composition per point

A ternary diagram has three vertices, each representing 100% of one component. Every interior point is a complete composition. We compute each point’s planar coordinates directly from its three fractions, so no specialized plotting package is required. The colors reproduce the source’s existing texture-class labels; they do not redraw or independently validate official classification boundaries.

# SECTION 03 — Draw the sand–silt–clay triangle without extra packages
height <- sqrt(3) / 2
ternary_x <- (soil$silt_percent + soil$clay_percent / 2) / 100
ternary_y <- height * soil$clay_percent / 100
classes <- sort(unique(soil$texture))
palette <- grDevices::hcl.colors(length(classes), "Dark 3")
point_colors <- palette[match(soil$texture, classes)]

grDevices::png(file.path(out_dir, "01_texture_triangle.png"),
               width = 1800, height = 1120, res = 180)
old_par <- par(mar = c(4, 3, 4, 12), xpd = NA)
plot(NA, xlim = c(-0.09, 1.06), ylim = c(-0.13, 1.02), asp = 1,
     axes = FALSE, xlab = "", ylab = "",
     main = "Composition of 100 anonymized soil samples")
polygon(c(0, 1, 0.5), c(0, 0, height), border = "#364a50",
        lwd = 2, col = "#fbfcfa")
for (fraction in seq(0.2, 0.8, 0.2)) {
  segments((1 - fraction) / 2, height * (1 - fraction),
           1 - fraction, 0, col = "#d8e0dc", lty = 3)
  segments(fraction, 0, fraction + (1 - fraction) / 2,
           height * (1 - fraction), col = "#d8e0dc", lty = 3)
  segments(fraction / 2, fraction * height,
           1 - fraction / 2, fraction * height,
           col = "#d8e0dc", lty = 3)
}
points(ternary_x, ternary_y, pch = 19, col = point_colors, cex = 1.02)
text(0, -0.055, "100% sand", adj = 0.5, cex = 0.95)
text(1, -0.055, "100% silt", adj = 0.5, cex = 0.95)
text(0.5, 0.93, "100% clay", adj = 0.5, cex = 0.95)
legend(1.08, 0.84, legend = classes, title = "Source texture class",
       pch = 19, col = palette, bty = "n", cex = 0.73)
par(old_par)
grDevices::dev.off()
png 
  2 
A triangular sand–silt–clay plot with 100 colored observations, grid lines at twenty percent intervals, and a legend of recorded soil texture classes.
Figure 1: Each of the 100 points represents a complete sand–silt–clay mixture; most observations occupy the lower-clay part of the triangle. Colors show recorded source classes, not independently recalculated USDA classifications.

A point nearer the sand vertex has a larger sand fraction relative to the other two parts. Observed clay shares range from 2 to 42 percent, placing many observations closer to the base than to the clay vertex. Moving across the triangle simultaneously changes several percentages, which is why a single raw-variable slope can be difficult to interpret in isolation. Source texture names are used strictly as labels; this figure does not validate their agreement with USDA textural-class boundaries.

4. Visualize the closure-constrained correlations

A three-by-three correlation display makes the familiar raw-percent analysis easy to inspect. The diagonal is one by definition; the off-diagonal entries summarize the co-variation of components inside the fixed total.

# SECTION 04 — Show raw correlations as a descriptive diagnostic
heat_colors <- grDevices::colorRampPalette(
  c("#b44c62", "#faf7f1", "#278098")
)(101)
labels <- c("Sand", "Silt", "Clay")

grDevices::png(file.path(out_dir, "02_raw_correlation_heatmap.png"),
               width = 1300, height = 1050, res = 180)
old_par <- par(mar = c(5, 6, 4, 2))
plot(NA, xlim = c(0.5, 3.5), ylim = c(0.5, 3.5),
     xlab = "", ylab = "", axes = FALSE,
     main = "Raw percentage correlations (closure-constrained)")
axis(1, at = 1:3, labels = labels, tick = FALSE)
axis(2, at = 3:1, labels = labels, tick = FALSE, las = 1)
for (i in 1:3) {
  for (j in 1:3) {
    value <- raw_corr[i, j]
    color_id <- round((value + 1) * 50) + 1
    rect(j - 0.48, 4 - i - 0.48, j + 0.48, 4 - i + 0.48,
         col = heat_colors[color_id], border = "white", lwd = 3)
    text(j, 4 - i, sprintf("%.2f", value), cex = 1.22)
  }
}
par(old_par)
grDevices::dev.off()
png 
  2 
Three-by-three colored matrix reporting the observed Pearson correlations among sand, silt, and clay percentages.
Figure 2: Pearson correlations between fixed-sum soil fractions: sand–silt −0.91, sand–clay −0.62, and silt–clay +0.25. The signs describe sample shares, not experimentally isolated soil processes.

The strongest negative pair is sand versus silt (-0.913), while silt versus clay is mildly positive (0.248). A common mistake is to treat a negative correlation as evidence that one particle-size fraction physically suppresses another. Here, all three percentages are shares of the same total. Their correlations are descriptive summaries, not a basis for inferring an independent particle-size intervention.

5. Work with relative information: log-ratios

A log-ratio compares the abundance of one part relative to another. For example,

ln(sand / silt) and ln(clay / silt)

The ratio is unaffected if both components are multiplied by the same positive constant. Zero means equality of the two named parts; positive values mean the numerator exceeds the denominator. Since all components here are positive, no pseudocount is needed.

For a three-part composition, two isometric log-ratio (ILR) coordinates provide an orthonormal representation:

z₁ = (1 / √2) ln(sand / silt), z₂ = √(2/3) ln(√(sand × silt) / clay)

The first balance compares sand with silt. The second compares their geometric mean with clay. Both respond to relative texture, not to an impossible increase of one percentage while the other two stay fixed. A supplementary variation matrix measures the sample variance of pairwise log-ratios; its diagonal is zero because any part divided by itself equals one.

# SECTION 05 — Relative information: log-ratios and two ILR balances
soil$log_sand_silt <- log(soil$sand_percent / soil$silt_percent)
soil$log_clay_silt <- log(soil$clay_percent / soil$silt_percent)
soil$ilr1 <- soil$log_sand_silt / sqrt(2)
soil$ilr2 <- sqrt(2 / 3) * log(
  sqrt(soil$sand_percent * soil$silt_percent) / soil$clay_percent
)

log_parts <- log(as.matrix(soil[parts]))
logratio_variation <- matrix(0, nrow = 3, ncol = 3,
                             dimnames = list(parts, parts))
for (i in 1:3) {
  for (j in 1:3) {
    logratio_variation[i, j] <- var(log_parts[, i] - log_parts[, j])
  }
}

write.csv(data.frame(component = rownames(logratio_variation),
                     logratio_variation, check.names = FALSE),
          file.path(out_dir, "03_logratio_variation.csv"),
          row.names = FALSE)
write.csv(soil[c("sample_id", parts, "bd_g_cm3", "log_sand_silt",
                 "log_clay_silt", "ilr1", "ilr2")],
          file.path(out_dir, "04_sample_logratios.csv"),
          row.names = FALSE)
print(round(logratio_variation, 3))
             sand_percent silt_percent clay_percent
sand_percent        0.000        0.842        1.056
silt_percent        0.842        0.000        0.341
clay_percent        1.056        0.341        0.000

The largest observed pairwise log-ratio variance is sand relative to clay, 1.056. It exceeds sand relative to silt (0.842) and silt relative to clay (0.341). This indicates greater sample variability in relative sand–clay abundance, not greater sand–clay correlation or a percentage difference. All three quantities are sample variances in squared log-ratio units.

6. See how ratios distinguish the soils

The two additive log-ratios place each sample in a conventional two-dimensional scatterplot. A value of zero on the horizontal axis means sand and silt are equally represented; zero on the vertical axis means clay and silt are equal. The points are colored using the same source labels as the triangle.

# SECTION 06 — Plot relative sand and clay against the same silt reference
grDevices::png(file.path(out_dir, "03_logratio_scatter.png"),
               width = 1500, height = 1050, res = 180)
old_par <- par(mar = c(5, 5, 4, 2))
plot(soil$log_sand_silt, soil$log_clay_silt,
     pch = 19, col = grDevices::adjustcolor(point_colors, alpha.f = 0.78),
     xlab = "log(sand / silt)", ylab = "log(clay / silt)",
     main = "Log-ratios describe relative, not absolute, amounts")
abline(h = 0, v = 0, lty = 3, col = "#7c8b8a")
grid(col = "#e3e8e6", lty = 3)
par(old_par)
grDevices::dev.off()
png 
  2 
Scatterplot of log sand over silt versus log clay over silt, colored by the original texture labels.
Figure 3: Each sample is positioned by two additive log-ratios sharing silt as their reference. Values below zero on the vertical axis indicate clay less abundant than silt; horizontal position distinguishes sand-dominant from silt-dominant mixtures.

The 97 points below the horizontal zero line have less clay than silt, whereas points on the right of the vertical zero line have more sand than silt. Choosing silt as a common denominator is useful for teaching, but the numerical correlation between these additive log-ratios also depends on that denominator. Log-ratios are not a magic correlation correction. For regression and distance-based analysis, orthonormal ILR balances provide a more principled coordinate system for the same compositional information.

7. Why three raw percentages do not give three independent predictors

Suppose we use bulk density as a descriptive outcome and try to include sand, silt and clay percentages together with an intercept. Since their total is exactly 100, the design matrix has one redundant column; R cannot estimate all three raw-percent coefficients uniquely. It typically reports one coefficient as not estimable.

Two ILR balances avoid that linear algebra problem while expressing relative information. The following regression is an illustration of representation, not a claim that one texture fraction causally determines bulk density. It does not address repeated producers, confounding by soil horizon or management, missing survey design details, or uncertainty beyond the example’s selected samples.

# SECTION 07 — A rank-deficient raw model versus a two-balance example
# Three percentages plus an intercept are exactly linearly dependent.
raw_model <- lm(bd_g_cm3 ~ sand_percent + silt_percent + clay_percent,
                data = soil)
aliased <- names(coef(raw_model))[is.na(coef(raw_model))]
if (length(aliased) != 1) stop("Expected one redundant raw-percent term")

# The ILR basis has two free coordinates for the three-part composition.
ilr_model <- lm(bd_g_cm3 ~ ilr1 + ilr2, data = soil)
model_summary <- summary(ilr_model)
coefficients_table <- data.frame(
  term = rownames(model_summary$coefficients),
  estimate = model_summary$coefficients[, "Estimate"],
  standard_error = model_summary$coefficients[, "Std. Error"],
  row.names = NULL
)
fit_table <- data.frame(
  n_samples = nrow(soil),
  in_sample_r_squared = unname(model_summary$r.squared),
  in_sample_rmse_g_cm3 = sqrt(mean(residuals(ilr_model)^2)),
  aliased_raw_percent_term = paste(aliased, collapse = ", ")
)
write.csv(coefficients_table,
          file.path(out_dir, "05_ilr_model_coefficients.csv"),
          row.names = FALSE)
write.csv(fit_table, file.path(out_dir, "06_model_fit.csv"),
          row.names = FALSE)
print(fit_table)
  n_samples in_sample_r_squared in_sample_rmse_g_cm3 aliased_raw_percent_term
1       100          0.01239973            0.2160668             clay_percent
grDevices::png(file.path(out_dir, "04_model_residual_checks.png"),
               width = 1800, height = 900, res = 180)
old_par <- par(mfrow = c(1, 2), mar = c(5, 5, 4, 2))
plot(fitted(ilr_model), residuals(ilr_model), pch = 19,
     col = "#267b91", xlab = "Fitted bulk density (g/cm3)",
     ylab = "Residual (g/cm3)", main = "Residuals vs fitted")
abline(h = 0, lty = 2, col = "#b44c62", lwd = 2)
qqnorm(residuals(ilr_model), pch = 19, col = "#267b91",
       main = "Residual normal Q–Q")
qqline(residuals(ilr_model), col = "#b44c62", lwd = 2)
par(old_par)
grDevices::dev.off()
png 
  2 

The two-balance model’s in-sample R-squared is 0.0124: about 1.24 percent of the observed bulk-density variation is described by the fitted linear combination. Its in-sample residual RMSE is 0.216 g/cm³. These summarize fit to the same samples, not held-out prediction accuracy or causal evidence. In the raw-percentage model the aliased term is clay_percent; its identity follows from the column order. The estimated ILR slopes are 0.0043 and 0.0397 g/cm³ per one-unit coordinate increase, with standard errors 0.0410 and 0.0466, respectively. These coefficients are small compared with their sampling-error estimates, and their standard errors assume more independence than repeated producers may justify.

Two adjacent diagnostic plots: residuals versus fitted soil bulk density and a normal quantile–quantile plot.
Figure 4: Residuals remain widely scattered across a narrow range of fitted bulk densities. The normal Q–Q plot shows a marked lower-tail departure, so a simple normal-error interpretation should be treated cautiously.

The residual plot shows substantial unexplained bulk-density variation across the narrow fitted-value range. In the normal Q–Q panel, lower-tail points depart visibly below the reference line, raising questions about the Gaussian error approximation and unusually low-density observations. These diagnostics cannot identify the cause of the departures. Because anonymized producers may contribute multiple samples and the observational sampling frame is incompletely specified, conventional independent-error standard errors should not be promoted to population-wide significance claims. The composition transformation solves closure geometry, not design bias, causal identification or out-of-sample generalization.

8. Keep the analysis reproducible

# SECTION 08 — Save an inspectable record of the R environment
writeLines(capture.output(sessionInfo()),
           file.path(out_dir, "07_R_session_info.txt"))
cat("Saved six CSV tables, four PNG figures, and the R session record.\n")
Saved six CSV tables, four PNG figures, and the R session record.

The key discipline is straightforward: start with the physical measurement and sampling unit, verify closure and positivity, identify the relative scientific comparison, then choose coordinates suitable for that comparison. A ternary map communicates the full soil mixture, log-ratios describe proportions coherently, and model diagnostics keep interpretation tied to what the data can actually support.

Practical takeaways

  • Three percentage columns describe one soil mixture. Only two compositional degrees of freedom are available.
  • Raw correlations are constrained summaries. Negative values do not, on their own, reveal a physical mechanism.
  • Log-ratios compare what matters: relative shares. For strictly positive compositions, there is no need to add an arbitrary constant.
  • ILR balances give two usable modeling coordinates. A different ratio basis can change coefficient meanings even when the underlying compositional information is equivalent.
  • Scientific design still matters. The ILR model explains only 1.24 percent of the observed bulk-density variation in sample; repeated producers, anonymized geography, source class labels and observational sampling limit generalization. Log-ratios do not repair those limits.

Data source and further reading

Data acknowledgment: Washington Soil Health Initiative, Washington State Department of Agriculture and collaborators. The anonymized example is distributed in the public soils R package repository; its data documentation describes the demonstration dataset. These are historical 2022–2023 observations, not a statewide representative probability sample. Permissions for commercial redistribution of the underlying measurements should be confirmed separately from the software license.

For foundational compositional geometry, see Aitchison (1982), The Statistical Analysis of Compositional Data and Egozcue and colleagues (2003), Isometric Logratio Transformations for Compositional Data Analysis. The USDA-NRCS Field Book for Describing and Sampling Soils documents official textural classification. This tutorial teaches log-ratio reasoning with source labels; it does not independently reclassify every sample or construct a general-purpose bulk-density predictor.

Comments