R: Arithmetic operations for compositions in a real geometry

rcomparithm {compositions} | R Documentation

## Arithmetic operations for compositions in a real geometry

### Description

The real compositions form a manifold of the real vector space. The induced operations +,-,*,/ give results valued in the real vector space, but possibly outside the simplex.

### Usage

    convex.rcomp(x,y,alpha=0.5)
    ## Methods for class "rcomp"
    ##   x+y
    ##   x-y
    ##   -x
    ##   x*r
    ##   r*x
    ##   x/r

### Arguments

`x` | an rcomp composition or dataset of compositions
`y` | an rcomp composition or dataset of compositions
`r` | a numeric vector of size 1 or nrow(x)
`alpha` | a numeric vector of size 1 or nrow(x) with values between 0 and 1

### Details

The functions behave quite like `+.rmult`.
The convex combination is defined as: `x*alpha + (1-alpha)*y`

### Value

`rmult`-objects containing the given operations on the simplex as subset of the R^D. Only the convex combination `convex.rcomp` results in an `rcomp`-object again, since only this operation is closed.

### Note

For `*` the arguments x and y can be exchanged.

### Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

### See Also

`+.rmult`, `+.acomp`,`cpt`, `rcomp`, `rmult`

### Examples

    rcomp(1:5)* -1 + rcomp(1:5)
    data(SimulatedAmounts)
    cdata <- rcomp(sa.lognormals)
    plot( tmp <- (cdata-mean(cdata))/msd(cdata) )
    class(tmp)
    mean(tmp)
    msd(tmp)
    var(tmp)
    plot(convex.rcomp(rcomp(c(1,1,1)),sa.lognormals,0.1))

[Package compositions version 1.40-5 Index]