R: Recast amounts as mixtures of end-members

endmemberCoordinates {compositions} | R Documentation

## Recast amounts as mixtures of end-members

### Description

Computes the convex combination of amounts as mixtures of `endmembers` to explain `X` as well as possible.

### Usage

        endmemberCoordinates(X,...)
        endmemberCoordinatesInv(K,endmembers,...)
        ## Default S3 method:
    endmemberCoordinates(X,
                             endmembers=diag(gsi.getD(X)), ...)
        ## S3 method for class 'acomp'
    endmemberCoordinates(X,
                        endmembers=clrInv(diag(gsi.getD(X))),...)
        ## S3 method for class 'aplus'
    endmemberCoordinates(X,endmembers,...)
        ## S3 method for class 'rplus'
    endmemberCoordinates(X,endmembers,...)
        ## S3 method for class 'rmult'
    endmemberCoordinatesInv(K,endmembers,...)
        ## S3 method for class 'acomp'
    endmemberCoordinatesInv(K,endmembers,...)
        ## S3 method for class 'rcomp'
    endmemberCoordinatesInv(K,endmembers,...)
        ## S3 method for class 'aplus'
    endmemberCoordinatesInv(K,endmembers,...)
        ## S3 method for class 'rplus'
    endmemberCoordinatesInv(K,endmembers,...)

### Arguments

`X` | a data set of amounts or compositions, to be represented in as convex combination of the `endmembers` in the given geometry
`K` | weights of the `endmembers` in the convex combination
`endmembers` | a dataset of compositions of the same class as X. The number of endmembers given must not exceed the dimension of the space plus one.
`...` | currently unused

### Details

The convex combination is performed in the respective geometry. This means that, for rcomp objects, positivity of the result is only guaranteed with endmembers corresponding to extremal individuals of the sample, or completely outside its hull. Note also that, in acomp geometry, the endmembers must necessarily be outside the hull.
The main idea behind this functions is that the composition actually observed came from a convex combination of some extremal compositions, specified by `endmembers`. Up to now, this is considered as meaningful only in rplus geometry, and under some special circumstances, in rcomp geometry. It is not meaningful in terms of mass conservation in acomp and aplus geometries, because these geometries do not preserve mass: whether such an operation has an interpretation is still a matter of debate. In rcomp geometry, the convex combination is dependent on the units of measurements, and will be completely different for volume and mass %. Even more, it is valid only if the whole composition is observed (!).

### Value

The `endmemberCoordinates` functions give a `rmult` data set with the weights (a.k.a. barycentric coordinates) allowing to build `X` as good as possible as a convex combination (a mixture) from `endmembers`. The result is of class rmult because there is no guarantee that the resulting weights are positive (although they sum up to one).
The `endmemberCoordinatesInv` functions reconstruct the convex combination from the weights `K` and the given `endmembers`. The class of `endmembers` determines the geometry chosen and the class of the result.

### Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de, Raimon Tolosana-Delgado

### References

Shurtz, Robert F., 2003. Compositional geometry and mass conservation. Mathematical Geology 35 (8), 972–937.

### Examples

    data(SimulatedAmounts)
    ep <- aplus(rbind(c(2,1,2),c(2,2,1),c(1,2,2)))
    # mix the endmembers in "ep" with weights given by "sa.lognormals"
    dat <- endmemberCoordinatesInv(acomp(sa.lognormals),acomp(ep))
    par(mfrow=c(1,2))
    plot(dat)
      plot(acomp(ep),add=TRUE,col="red",pch=19)
    # compute the barycentric coordinates of the mixture in the "end-member simplex"
    plot( acomp(endmemberCoordinates(dat,acomp(ep))))

    dat <- endmemberCoordinatesInv(rcomp(sa.lognormals),rcomp(ep))
    plot(dat)
    plot( rcomp(endmemberCoordinates(dat,rcomp(ep))))

    dat <- endmemberCoordinatesInv(aplus(sa.lognormals),aplus(ep))
    plot(dat)
    plot( endmemberCoordinates(dat,aplus(ep)))

    dat <- endmemberCoordinatesInv(rplus(sa.lognormals),rplus(ep))
    plot(dat)
    plot(endmemberCoordinates(rplus(dat),rplus(ep)))

[Package compositions version 1.40-2 Index]