meanAcomp: Mean amounts and mean compositions

Description Usage Arguments Details Value Missing Policy Author(s) See Also Examples

Description

Compute the mean in the several approaches of compositional and amount data analysis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
          ## S3 method for class 'acomp'
mean(x,...,robust=getOption("robust"))
          ## S3 method for class 'rcomp'
mean(x,...,robust=getOption("robust"))
          ## S3 method for class 'aplus'
mean(x,...,robust=getOption("robust"))
          ## S3 method for class 'rplus'
mean(x,...,robust=getOption("robust"))
          ## S3 method for class 'ccomp'
mean(x,...,robust=getOption("robust"))
          ## S3 method for class 'rmult'
mean(x,...,na.action=NULL,robust=getOption("robust"))
          

Arguments

x

a classed dataset of amounts or compositions

...

further arguments to mean e.g. trim

na.action

na.action

robust

A description of a robust estimator. Possible values are FALSE or "pearson" for no robustness, or TRUE or "mcd" for a covMcd based robust location scale estimation. Additional control parameters such as list(trim=0.2) or an rrcov.control object can be given as an attribute "control".

Details

The different compositional approaches acomp, rcomp, aplus, rplus correpond to different geometries. The mean is calculated in the respective canonical geometry by applying a canonical transform (see cdt), taking ordinary meanCol and backtransforming.

The Aitchison geometries imply that mean.acomp and mean.aplus are geometric means, the first one closed. The real geometry implies that mean.rcomp and mean.rplus are arithmetic means, the first one resulting in a closed composition.

In all cases the mean is again an object of the same class.

Value

The mean is given as a composition or amount vector of the same class as the original dataset.

Missing Policy

For the additive scales (rcomp,rplus) the SZ and BDL are treated as zeros and MAR and MNAR as missing information. This is not strictly correct for MNAR.
For relative scales (acomp,aplus), all four types of missings are treated as missing information. This corresponds to the idea that BDL are truncated values (and have the correspoding effect in taking means). For SZ and MAR, only the components in the observed subcomposition are fully relevant. Finally, for MNAR the problem is again that nothing could be done without knowing the MNAR mechanism, so the analysis is limited to taking them as MAR, and being careful with the interpretation. Missing and Below Detecion Limit Policy is explained in more detail in compositions.missing.

Author(s)

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

See Also

clo, meanCol, geometricmean, acomp, rcomp, aplus, rplus

Examples

1
2
3
4
5
6
7

Example output

Loading required package: tensorA

Attaching package: 'tensorA'

The following object is masked from 'package:base':

    norm

Loading required package: robustbase
Loading required package: energy
Loading required package: bayesm
Welcome to compositions, a package for compositional data analysis.
Find an intro with "? compositions"


Attaching package: 'compositions'

The following objects are masked from 'package:stats':

    cor, cov, dist, var

The following objects are masked from 'package:base':

    %*%, scale, scale.default

       Cu        Zn        Pb 
 5.392698 14.908465 38.319017 
        Cu         Zn         Pb 
0.08918175 0.23949922 0.67131903 
attr(,"class")
[1] acomp
Warning messages:
1: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
3: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
4: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
5: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
6: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
7: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
8: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
9: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
10: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
       Cu        Zn        Pb 
0.1112224 0.2762183 0.6125594 
attr(,"class")
[1] rcomp
Warning messages:
1: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
3: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
4: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
5: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
6: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
7: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
8: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
9: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
       Cu        Zn        Pb 
 3.018042  8.105008 22.718430 
attr(,"class")
[1] aplus
       Cu        Zn        Pb 
 5.392698 14.908465 38.319017 
attr(,"class")
[1] rplus
       Cu        Zn        Pb 
 5.392698 14.908465 38.319017 
attr(,"class")
[1] "rmult"

compositions documentation built on Jan. 5, 2022, 5:09 p.m.