Learn R Programming

SimCorMultRes (version 1.4.0)

rbin: Simulating Correlated Binary Responses under Marginal Model Specification

Description

Simulates correlated binary responses assuming that a prespecified model holds for the marginal probabilities.

Usage

rbin(clsize, lin.pred, cor.matrix, intercepts, link = "probit")

Arguments

clsize
integer indicating the common cluster size.
lin.pred
matrix with clsize columns. See details for more info.
cor.matrix
matrix indicating the correlation matrix of the multivariate normal distribution in the NORTA method.
intercepts
numerical (or numeric vector of length clsize) containing the intercept(s) of the marginal model. See details for more info.
link
character string indicating the link function of the marginal model. Options include "probit", "logit", "cloglog" or "cauchit".

Value

  • Ysimthe correlated nominal multinomial responses. Element ($i$,$t$) represents the realization of $Y_{it}$.
  • correlationthe correlation matrix of the multivariate normal distribution in the NORTA method.
  • rlatentthe latent random vectors.

Details

The assumed marginal model is $$Pr(Y_{it} = 1 |x_{it})=F(\beta_{t0} +\beta^{'}_{t} x_{it})$$ where $F$ is the cumulative distribution function determined by 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$.

References

Cario, M. C. and Nelson, B. L. (1997) Modeling and generating random vectors with arbitrary marginal distributions and correlation matrix. Technical Report, Department of Industrial Engineering and Management Sciences, Northwestern University, Evanston, Illinois. Li, S. T. and Hammond, J. L. (1975) Generation of pseudorandom numbers with specified univariate distributions and correlation coefficients. IEEE Transacions on Systems, Man and Cybernetics, 5, 557--561.

See Also

For simulating correlated nominal multinomial responses use rmult.bcl and for simulating correlated ordinal multinomial responses use rmult.clm or rmult.crm.

Examples

Run this code
## 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