I’d like to simulate ordinal data for later analysis with
brms. At its simplest, I have an ordinal predictor with an ordinal outcome, which I would analyse using something like this:
fit1 <- brm(ordinal_outcome ~ mo(ordinal_predictor), data = d, family = cumulative())
The Estimating Monotonic Effects with brms vignette uses the following code to simulate an ordinal predictor with a continuous outcome.
income_options <- c("below_20", "20_to_40", "40_to_100", "greater_100") income <- factor(sample(income_options, 100, TRUE), levels = income_options, ordered = TRUE) mean_ls <- c(30, 60, 70, 75) ls <- mean_ls[income] + rnorm(100, sd = 7) dat <- data.frame(income, ls)
How can I simulate a data set with an ordinal predictor and an ordinal outcome?
- Operating System: macOS 12.5.1
- brms Version: 2.17.0