"LEapply"
is composed of three main elements: (i) the linear extensions generator, (ii) the application of the argument functions to the linear extensions and (iii) the computation of the averages of the results, for each function separately; see fattore2016partiallyPOSetR.
LEapply(x, ...)# S3 method for poset
LEapply(
x,
FUN = "MutualRankingProbability",
...,
generator = c("AllLE", "BubleyDyer"),
bubleydyer.precision = 10,
bubleydyer.nit = NULL,
bubleydyer.progressBar = TRUE,
degrees = NULL
)
The average values of the argument functions FUN
over the set of linear extensions (or lexicographic ones if degrees
argument is not NULL
).
an environment of class poset
, see poset
for details.
optional arguments to FUN
.
the function, or a list of functions, to be applied to each linear extension: see 'Details'.
a string specifying the method used to generate the linear extensions. The default value is "AllLE"
. See section 'Details' below.
considered only if "BubleyDyer"
generator is selected. It corresponds to the number of digit precision of the frequencies in the sampling distributions of linear extensions.
considered only if "BubleyDyer"
generator is selected. Number of iterations in the Bubley-Dyer algorithm, if NULL (default) it is set as indicated in Bubley and Dyer (1999) depending on the value of bubleydyer.precision
and the number of elements of the poset.
logical that indicates whether to show a text progress bar or not
to generate the lexicographic linear extensions of a product order, the poset x
describes the dominance (e.g. relative importance) between ordinal variables and degrees
is a numerical vector specifying the number of degrees of each variable, represented by in the poset.
Argument FUN
must be either a function or a list of functions, each one depending on a vector of characters representing the names of the elements of the poset.
If degrees
is not NULL
but a numerical vector as long as the number of elements in the poset, the poset elements are considered as ordinal variables. Therefore degrees
represents their number of degrees that are represented as integer numbers starting from 0. In this case, LEapply
generates the lexicographical linear extensions of the product order of the ordeinal variables. Its elements are called profiles and they are obtained by the combination of the degrees of variables separated by a dash. For details about lexicographical linear extensions and profiles see fattore2018reducedPOSetR.
Some functions are already implemented in the C++
library and they can be called by their names. Currently, such functions are "MutualRankingProbability"
, "Separation"
, and "AverageHeight"
.
Each function in FUN
must return a numerical or logical matrix.
Each function can depend on additional arguments that can be passed through ...
; such additional arguments must be the same for all the functions in the list.
Argument generator
specifies the linear extension generation algorithm. The available generators are "AllLE"
, that produces all of the linear extensions of the input poset, and "BubleyDyer"
, which samples uniformly from the set of linear extensions, through an MCMC algorithm bubley1999fasterPOSetR.
bubley1999fasterPOSetR
fattore2016partiallyPOSetR
fattore2018reducedPOSetR
habib2001efficientPOSetR
poset
dom <- matrix(c(
"a", "b",
"c", "b",
"b", "d"
), ncol = 2, byrow = TRUE)
p <- poset(x = dom)
if (FALSE) {
LEapply(
x = p,
FUN = "MutualRankingProbability",
generator = "AllLE",
degrees = c(3, 2, 3, 2)
)
a_rank_dist <- function(le) {
return(matrix(le == "a"))
}
LEapply(x = p, FUN = a_rank_dist)}
Run the code above in your browser using DataLab