Learn R Programming

SimCorMultRes (version 1.4.0)

rmult.bcl: Simulating Correlated Nominal Multinomial Responses under a Marginal Baseline Category Logit Model

Description

Simulates correlated nominal multinomial responses assuming that a baseline category logit model holds for the marginal probabilities.

Usage

rmult.bcl(clsize, ncategories, lin.pred, cor.matrix)

Arguments

clsize
integer indicating the common cluster size.
ncategories
integer indicating the number of nominal response categories.
lin.pred
matrix with clsize x ncategories columns. See details for more info.
cor.matrix
matrix indicating the correlation matrix of the multivariate normal distribution in the NORTA method.

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 baseline category logit model is $$log \frac{Pr(Y_{it}=j |x_{it})}{Pr(Y_{it}=I |x_{it})}=(\beta_{t0j}-\beta_{t0I}) + (\beta^{'}_{tj}-\beta^{'}_{tI}) x_{it}=\beta^{*}_{t0j}+ \beta^{*'}_{tj} x_{it}$$ For subject $i$, $Y_{it}$ is the $t$-th multinomial response and $x_{it}$ is the associated covariates vector. Finally, $\beta_{t0j}$ and $\beta^{'}_{tj}$ is the $j$-th category specific intercept and regression parameter vector corresponding to the $t$-th measurement occasion respectively. The multinomial response $Y_{it}$ is obtained by extending the principle of maximum random utility (McFadden, 1974) to correlated latent continuous variables. See vignette for more info. The sample size is equal to the number of the rows in lin.pred. Row $i$ corresponds to subject $i$. Columns $(t-1)*\code{ncategories}+1,...,t*\code{ncategories}$ correspond to the linear predictors $\beta_{t01}+ \beta^{'}_{t1} x_{it},...,\beta_{t0I}+ \beta^{'}_{tI} x_{it}$, respectively, for $t=1,\ldots,\code{clsize}$. The algorithm forces cor.matrix to respect the local independence assumption between the alternatives.

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. McFadden, D. (1974) Conditional logit analysis of qualitative choice behavior. New York: Academic Press, 105--142. Touloumis, A., Agresti, A. and Kateri, M. (2013) GEE for multinomial responses using a local odds ratios parameterization. Biometrics, 69, 633--640.

See Also

For simulating correlated ordinal multinomial responses use rmult.clm or rmult.crm, and for simulating correlated binary responses use rbin.

Examples

Run this code
## See vignette for the sampling scheme.
set.seed(1)
N <- 500
ncategories <- 4
clsize <- 3
Xmat <- matrix(rnorm(N), N, ncategories)
betas <- c(1, 2, 3, 4, 5, 6)
lin.pred <- matrix(c(betas[c(2, 4, 6)], 0), N, 4, byrow=TRUE) * Xmat +
           matrix(c(betas[c(1, 3, 5)], 0), N, 4, byrow=TRUE)
lin.pred <- matrix(lin.pred, N, ncategories*clsize)
cor.matrix <- diag(1, 12)

## Fit a GEE model (Touloumis et al., 2013) to estimate the regression coefficients,
## i.e., the beta stars. 
library(multgee)
Y <- rmult.bcl(clsize, ncategories, lin.pred, cor.matrix)$Ysim
data <- cbind(c(t(Y)), c(t(Xmat[,-ncategories])))
data <- data.frame(data)
data$id <- rep(1:N, each=clsize)
data$time <- rep(1:clsize, N)
colnames(data) <- c("y", "x", "id", "time")
fitmod <- nomLORgee(y~x, id=id, repeated=time, data=data, add=0.01)
coef(fitmod)

Run the code above in your browser using DataLab