From 2e1acb5bf48b8692a6874f4076be4e7f673c00cf Mon Sep 17 00:00:00 2001 From: Atsusaka Date: Thu, 28 Nov 2024 14:29:08 -0600 Subject: [PATCH] add vignetter for rpluce --- vignettes/v6-simulate-data.Rmd | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vignettes/v6-simulate-data.Rmd diff --git a/vignettes/v6-simulate-data.Rmd b/vignettes/v6-simulate-data.Rmd new file mode 100644 index 0000000..700c7ae --- /dev/null +++ b/vignettes/v6-simulate-data.Rmd @@ -0,0 +1,25 @@ +--- +title: "6. Simulating Ranking Data" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{6. Simulating Ranking Data} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +In this vignette, we describe our helper function `rpluce` to simulate ranking data based on the Plackett-Luce model, also known as the rank-order logit or random utility model. To draw from the PL, `rpluce` requires a vector of probabilities that `t` items will be selected as the first choice, respectively. For each unit, the output provides a full ordering of `t` items with distinct alphabet letters. + +```{r} +draw <- rpluce(n = 50, + t = 4, + prob = c(0.4, 0.2, 0.2, 0.2)) + +head(draw) +```