-
Notifications
You must be signed in to change notification settings - Fork 3
/
06-resposetransformation.Rmd
30 lines (24 loc) · 1.53 KB
/
06-resposetransformation.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Transformation of the particle-size data
------------------------------------------------------------------------
Sand, silt and clay contents are reported as proportions that sum to 100%. However, models formulated for each of these fractions do not guarantee that their individual predictions sum to 100%. To avoid this compositional constraint, the particle-size data ($V = {clay, silt, sand}$) for both depths ($l = {A: 0–0.2 m, B: 0.8–1.0 m}$) were transformed using the additive log-ratio ($alr$) transformation (Odeh et al., 2003):
$$Y_{l,i} = \frac{V_{l,i}}{V_{l,r}} \quad \forall \quad i = 1,2,.. (r -1) \quad \forall \quad l \in (A,B)$$
where $Y_{l,i}$ is the resulting transformed variable, $V_{l,i}$ is the ith variable of the set of compositional variables (silt and clay contents) at depth $l$, $V_{l,r}$ designates a reference compositional variable at depth
$l$ and $r$ is the total number of compositional variables. In ou paper, we used the sand content as reference ($V_{l,r}$).
``` r
## The above equation can be simply applied in two lines of code
## Calibration dataset
## alr for silt contnet
train$alr_Silt <- log(train$Silt/train$Sand)
## alr for clay contnet
train$alr_Clay <- log(train$Clay/train$Sand)
## Validation dataset
## alr for silt contnet
valida$alr_Silt <- log(valida$Silt/valida$Sand)
## alr for clay contnet
valida$alr_Clay <- log(valida$Clay/valida$Sand)
## Prediction dataset
## alr for silt contnet
pred$alr_Silt <- log(pred$Silt/pred$Sand)
## alr for clay contnet
pred$alr_Clay <- log(pred$Clay/pred$Sand)
```