Learn R Programming

kStatistics (version 1.0)

countP: Multiplicity of a subdivision

Description

Computes the multiplicity of a subdivision of a multiset.

Usage

countP( v )

Arguments

v

array or list

Value

positive integer

multiplicity of researched item

Details

The subdivisions of a multiset are obtained as follows: assume all distinct the elements of the multiset, determine all set partitions and then replace each element in each block with the original one. For example, the partitions of the set [a1, a2, a3] are [[a1], [a2], [a3]], [[a1,a2], [a3]], [[a1,a3], [a2]], [[a2,a3], [a1]], [[a1,a2,a3]]. Replace a1<-a, a2<-a, a3<-a. The label does not matter. The subdivisions are [[a], [a], [a]], [[a,a], [a]], [[a,a], [a]], [[a,a], [a]], [[a,a,a]]. A short notation for the output is [[1,1,1],1], [[1,2],3], [[3],1]. The function countP( c(1,2) ) returns 3, that is the multiplicity of the subdivision [[a,a], [a]]. If in the multiset, there is more than one element, we pass a list. For example, for the multiset [a,a,a,a,b,b], the multiplicity of the subdivision [[a,a,b], [a], [a], [b]] is obtained by calling countP( list(c(2,1), c(1,0), c(1,0), c(0,1)) ), where c(i,j) denotes a block with instances i and j for a and b respectively.

References

E. Di Nardo, G. Guarino and D. Senato (2008) An unifying framework for k-statistics, polykays and their generalizations. Bernoulli. Vol. 14(2), 440-468. (download from http://www.elviradinardo.it/lavori1.html)

See Also

mkmSet, umSet, mCoeff, nStirling2, intPart, df

Examples

Run this code
# NOT RUN {
countP(c(1,2))
# returns the multiplicity of [[a],[aa]]  

countP(c(4,2))
# returns the multiplicity of [[a,a,a,a],[a,a]]  

countP( list(c(2,0), c(1,0), c(1,0), c(0,1),c(0,2)) )
# returns the multiplicity of [[aa],[a],[a],[b],[bb]] 

# }

Run the code above in your browser using DataLab