arithcent() is an S3 generic for computing the arithmetic mean of R objects,
with methods for the following classes:
igcmatcatdist
Arguments
- p
An R object gathering a number
nof objects of same nature. Currently, there is a method forigcmatcatdistmatrix, i.e., a matrix of categorical distribution; see catdist.- weight
A positive vector of length
n. The arithmetic mean is balanced by weighting each row ofpwith the corresponding element ofweight.
Examples
p <- igccatdist(dbinom(0:4, size = 4, prob = 0.5))
q <- igccatdist(rep(1/5, times = 5))
matp <- matrix(c(p, q), nrow = 2)
matptest <- igcmatcatdist(p = matp)
arithcent(p = matptest)
#> [1] 0.15625 0.31250 0.13125 0.20000 0.20000
#> attr(,"class")
#> [1] "igccatdist"
#> attr(,"mass")
#> [1] 1