Scaling and Centering of Compositional Data
Arguments
- x
A
CompositionMatrix
object.- center
A
logical
scalar or anumeric
vector giving the center to be substracted.- scale
A
logical
scalar or a length-onenumeric
vector giving a scaling factor for multiplication.
Value
A CompositionMatrix
object.
References
Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall, p. 64-91.
Boogaart, K. G. van den & Tolosana-Delgado, R. (2013). Analyzing Compositional Data with R. Berlin Heidelberg: Springer-Verlag. doi:10.1007/978-3-642-36809-7 .
See also
Other statistics:
aggregate()
,
condense()
,
covariance()
,
dist
,
mahalanobis()
,
margin()
,
mean()
,
pip()
,
quantile()
,
variance()
,
variance_total()
,
variation()
Examples
## Data from Aitchison 1986
data("hongite")
## Coerce to compositional data
coda <- as_composition(hongite)
## Center and scale
scaled <- scale(coda, center = TRUE, scale = TRUE)
mean(scaled)
#> A B C D E
#> 0.2 0.2 0.2 0.2 0.2
head(scaled)
#> <CompositionMatrix: 6 x 5>
#> A B C D E
#> S1 0.21634296 0.40851878 0.04204451 0.09427149 0.23882226
#> S2 0.19541817 0.23027129 0.17084651 0.16234092 0.24112312
#> S3 0.05406075 0.01921842 0.73935593 0.07477711 0.11258779
#> S4 0.23277503 0.24975389 0.12625644 0.20672500 0.18448965
#> S5 0.17430188 0.54016862 0.02523291 0.12375232 0.13654426
#> S6 0.25315982 0.30580853 0.05187680 0.30958887 0.07956597