simulate.PlackettLuce | R Documentation |
PlackettLuce
fitted objectsSimulate from PlackettLuce
fitted objects
## S3 method for class 'PlackettLuce'
simulate(
object,
nsim = 1L,
seed = NULL,
multinomial = FALSE,
max_combinations = 20000,
...
)
object |
an object representing a fitted model. |
nsim |
number of response vectors to simulate. Defaults to |
seed |
an object specifying if and how the random number
generator should be initialised. Either |
multinomial |
use multinomial sampling anyway? Default is
|
max_combinations |
a positive number. Default is
|
... |
additional optional arguments. |
If multinomial
is FALSE
(default) and there are no
tie parameters in the object (i.e. length(object$ties) == 1
),
then rankings are sampled by ordering exponential random variates
with rate 1 scaled by the estimated item-worth parameters
object$coefficients
(see, Diaconis, 1988, Chapter 9D for
details).
In all other cases, the current implementation uses direct
multinomial sampling, and will throw an error if there are more
than max_combinations
combinations of items that the sampler
has to decide from. This is a hard-coded exit to prevent issues
relating to the creation of massive objects in memory.
If length(object$ties) > 1
the user's setting for
multinomial
is ignored and simulate.PlackettLuce
operates as if
multinomial
is TRUE
.
A data.frame
of rankings
objects of the same
dimension as object$rankings
.
Diaconis (1988). Group Representations in Probability and Statistics. Institute of Mathematical Statistics Lecture Notes 11. Hayward, CA.
R <- matrix(c(1, 2, 0, 0,
4, 1, 2, 3,
2, 1, 1, 1,
1, 2, 3, 0,
2, 1, 1, 0,
1, 0, 3, 2), nrow = 6, byrow = TRUE)
colnames(R) <- c("apple", "banana", "orange", "pear")
mod <- PlackettLuce(R)
simulate(mod, 5)
s1 <- simulate(mod, 3, seed = 112)
s2 <- simulate(mod, 2, seed = 112)
identical(s1[1:2], s2[1:2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.