LEapply | R Documentation |
"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 \insertReffattore2016partiallyPOSetR.
LEapply(x, ...)
## S3 method for class 'poset'
LEapply(
x,
FUN = "MutualRankingProbability",
...,
generator = c("AllLE", "BubleyDyer"),
bubleydyer.precision = 10,
bubleydyer.nit = NULL,
bubleydyer.progressBar = TRUE,
degrees = NULL
)
x |
an environment of class |
... |
optional arguments to |
FUN |
the function, or a list of functions, to be applied to each linear extension: see 'Details'. |
generator |
a string specifying the method used to generate the linear extensions. The default value is |
bubleydyer.precision |
considered only if |
bubleydyer.nit |
considered only if |
bubleydyer.progressBar |
logical that indicates whether to show a text progress bar or not |
degrees |
to generate the lexicographic linear extensions of a product order, 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 \insertReffattore2018reducedPOSetR.
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 \insertCitebubley1999fasterPOSetR.
The average values of the argument functions FUN
over the set of linear extensions (or lexicographic ones if degrees
argument is not NULL
).
bubley1999fasterPOSetR
\insertReffattore2016partiallyPOSetR
\insertReffattore2018reducedPOSetR
\insertRefhabib2001efficientPOSetR
poset
dom <- matrix(c(
"a", "b",
"c", "b",
"b", "d"
), ncol = 2, byrow = TRUE)
p <- poset(x = dom)
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.