rbin(clsize, lin.pred, cor.matrix, intercepts, link = "probit")
clsize
columns. See details for more info.clsize
) containing the intercept(s) of the marginal model. See details for more info."probit"
, "logit"
, "cloglog"
or "cauchit"
.link
. For subject $i$, $Y_{it}$ is the $t$-th multinomial response and $x_{it}$ is the associated covariates vector. Finally, $\beta_{t0}$ and $\beta_{t}$ is the intercept and the regression parameter vector at the $t$-th measurement occasion.
The binary variable $Y_{it}$ takes the value 1 if and only if the corresponding latent random variable is less than or equal to $\beta_{0t}+\beta^{'}_{t}x_{it}$. Otherwise $Y_{it}$ is set equal to 0. See vignete for more info.
The sample is equal to the number of rows in lin.pred
. Row $i$ corresponds to subject $i$. The ($i,t$)-th element of lin.pred
equals $\beta^{'}_{t} x_{it}$.
When $\beta_{t0}=\beta_{0}$ for all $t$, then intercepts
should be provided as a single number. Otherwise, intercepts
must be provided as a numerical vector such that the $t$-th element is the intercept at measurement occasion $t$.rmult.bcl
and for simulating correlated ordinal multinomial responses use rmult.clm
or rmult.crm
.## See vignette for the sampling scheme.
set.seed(1)
N <- 500
clsize <- 4
intercepts <- 1
cor.matrix <- toeplitz(c(1, 0.85, 0.5, 0.15))
lin.pred <- matrix(rnorm(N), N, clsize)
Y <- rbin(clsize, lin.pred, cor.matrix, intercepts, "probit")
head(Y$Ysim)
Run the code above in your browser using DataLab