mkmSet | R Documentation |
The function returns all the partitions of a multi-index, that is a vector of non-negative integers. Note that these partitions correspond to the subdivisions of a multiset having the input multi-index as multiplicities.
mkmSet(vPar = NULL, vOutput = FALSE)
vPar |
vector of non-negative integers |
vOutput |
optional boolean variable. If equal to |
The mkmSet
function finds all the vectors, different from the zero vector, whose
sum (in column) is equal to the vector (in column) of nonnegative integers given in input. When the input
vector is just an integer, let's say n
, the function returns the partitions of n
.
Each partition is paired with the number of set partitions having that partition as their class.
For example, if n=3
the output is
[[1,1,1],1], [[1,2],3], [[3],1] , |
where 1+1+1=1+2=3
. From this output, the subdivisions of a multiset with multiplicity 3 can be
recovered. For example, the subdivisions of [a,a,a]
are [[a], [a], [a]]
corresponding to
[1,1,1]
, [[a], [a,a]]
corresponds to [1,2]
and [[a,a,a]]
corresponds to
[3]
. When the input vector is a multi-index, the function returns all the partitions of the
multi-index. For example, if the input is (2,1) then the function returns
0 1 1 0 2 1 1 2
1 0 0 1 0 0 1 1
with multiplicities 1, 1, 2, 1 respectively, which corresponds to the output (the columns become rows)
of the mkmSet
function when the flag variable vOutput
is set equal to TRUE
[( 0 1 )( 1 0 )( 1 0 ), 1 ] |
[( 0 1 )( 2 0 ), 1 ] |
[( 1 0 )( 1 1 ), 2 ] |
[( 2 1 ), 1 ] |
From this output, the subdivisions of a multiset with multiplicity (2,1) can be easily recovered.
For example the previous partitions correspond to the following subdivisions of the multiset
[a,a,b]
[[b], [a], [a]] |
[[b], [a,a]] |
[[a], [a,b]] |
[[a,a,b]] |
The mkmSet
function is the core of the kStatistics
package. The strategy to find
all the partitions of a multi-index is described in the refereed papers. To find the multiplicities of the
multi-index partitions see the countP
function.
list |
two-dimensional list: in the first there is the partition, while in the second there is its multiplicity |
Called by the nKS
, nKM
, nPS
and nPM
functions in
the kStatistics
package.
In the output list, the sum of all multiplicities is the Bell Number whereas the sum of all
multiplicities of the partitions with the same lenght is the Stirling number of the second kind.
For example, mkmSet(4, TRUE)
returns
[( 1 )( 1 )( 1 )( 1 ), 1 ] |
[( 1 )( 1 )( 2 ), 6 ] |
[( 2 )( 2 ), 3 ] |
[( 1 )( 3 ), 4 ] |
[( 4 ), 1 ] |
Observe that 3 + 4 = 7 = S(4,2)
, where 4 is the input integer, 2 is the length of the
partitions [1,3]
and [2,2]
and S(i,j)
denotes the Stirling numbers of the second
kind, see also the nStirling2
function. Similarly, we have 1 = S(4,4) = S(4,1)
and 6 = S(4,3)
. Note that 1 + 6 + 4 + 3 + 1 = 15 = Bell(4)
which is the number of
partitions of the integer 4.
Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it
E. Di Nardo, G. Guarino, D. Senato (2008) An unifying framework for k-statistics, polykays and their generalizations. Bernoulli. 14(2), 440-468. (download from https://arxiv.org/pdf/math/0607623.pdf)
E. Di Nardo, G. Guarino, D. Senato (2008) Symbolic computation of moments of sampling distributions. Comp. Stat. Data Analysis. 52(11), 4909-4922. (download from https://arxiv.org/abs/0806.0129)
mCoeff
,
countP
,
nStirling2
,
intPart
,
ff
# Return [ [[1,1,1],1], [[1,2],3], [[3],1] ] # 3 is the multiplicity of a multiset with 3 elements all equal mkmSet(3) # Return [ [[1,1],[1,0],2], [[1,0],[1,0],[0,1],1],[[2,0],[0,1],1], [[2,1],1] ] # (2,1) is the multiplicity of a multiset with 2 equal elements and a third distinct element mkmSet(c(2,1)) # OR (same output) mkmSet(c(2,1), FALSE) # Returns the same output of the previous example but in a compact form. mkmSet(c(2,1), TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.