Skip to content

Instantly share code, notes, and snippets.

@cmrnp
Created November 30, 2022 06:15
Show Gist options
  • Save cmrnp/bcccec7b0c6bd042ac45674fa05db15d to your computer and use it in GitHub Desktop.
Save cmrnp/bcccec7b0c6bd042ac45674fa05db15d to your computer and use it in GitHub Desktop.
library(dplyr)
library(glmmTMB)
nobs <- 100
ngroup <- 5
dat <- tibble(
x = sample(1:3, size = nobs, replace = TRUE, prob = c(0.15, 0.5, 0.35)),
y = runif(nobs),
z = case_when(
x == 1 ~ 0,
x == 2 ~ y,
x == 3 ~ 1
),
g = rep(seq_len(ngroup), length.out = nobs)
)
glmmTMB(z ~ (1|g), data = dat, family = ordbeta)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment