Learn R Programming

compositions (version 2.0-4)

rcomparithm: 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

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.

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

Author

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

Details

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

See Also

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

Examples

Run this code
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))

Run the code above in your browser using DataLab