Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


SimCorMultRes (version 1.9.0)

rmult.bcl: Simulating Correlated Nominal Responses Conditional on a Marginal Baseline-Category Logit Model Specification

Description

Simulates correlated nominal responses assuming a baseline-category logit model for the marginal probabilities.

Usage

rmult.bcl(clsize = clsize, ncategories = ncategories, betas = betas,
  xformula = formula(xdata), xdata = parent.frame(),
  cor.matrix = cor.matrix, rlatent = NULL)

Value

Returns a list that has components:

Ysim

the simulated nominal responses. Element (i,t) represents the realization of Yit.

simdata

a data frame that includes the simulated response variables (y), the covariates specified by xformula, subjects' identities (id) and the corresponding measurement occasions (time).

rlatent

the latent random variables denoted by eitNO in Touloumis (2016).

Arguments

clsize

integer indicating the common cluster size.

ncategories

integer indicating the number of nominal response categories.

betas

numerical vector or matrix containing the value of the marginal regression parameter vector.

xformula

formula expression as in other marginal regression models but without including a response variable.

xdata

optional data frame containing the variables provided in xformula.

cor.matrix

matrix indicating the correlation matrix of the multivariate normal distribution when the NORTA method is employed (rlatent = NULL).

rlatent

matrix with (clsize * ncategories) columns containing realizations of the latent random vectors when the NORTA method is not preferred. See details for more info.

Author

Anestis Touloumis

Details

The formulae are easier to read from either the Vignette or the Reference Manual (both available here).

The assumed marginal baseline category logit model is logPr(Yit=j|xit)Pr(Yit=J|xit)=(βtj0βtJ0)+(βtjβtJ)xit=βtj0+βtjxit For subject i, Yit is the t-th nominal response and xit is the associated covariates vector. Also βtj0 is the j-th category-specific intercept at the t-th measurement occasion and βtj is the j-th category-specific regression parameter vector at the t-th measurement occasion.

The nominal response Yit is obtained by extending the principle of maximum random utility (McFadden, 1974) as suggested in Touloumis (2016).

betas should be provided as a numeric vector only when βtj0=βj0 and βtj=βj for all t. Otherwise, betas must be provided as a numeric matrix with clsize rows such that the t-th row contains the value of (βt10,βt1,βt20,βt2,...,βtJ0,βtJ). In either case, betas should reflect the order of the terms implied by xformula.

The appropriate use of xformula is xformula = ~ covariates, where covariates indicate the linear predictor as in other marginal regression models.

The optional argument xdata should be provided in ``long'' format.

The NORTA method is the default option for simulating the latent random vectors denoted by eitjNO in Touloumis (2016). In this case, the algorithm forces cor.matrix to respect the assumption of choice independence. To import simulated values for the latent random vectors without utilizing the NORTA method, the user can employ the rlatent argument. In this case, row i corresponds to subject i and columns (t1)\codencategories+1,...,t\codencategories should contain the realization of eit1NO,...,eitJNO, respectively, for t=1,,\codeclsize.

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 Transactions 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. (2016) Simulating Correlated Binary and Multinomial Responses under Marginal Model Specification: The SimCorMultRes Package. The R Journal 8, 79--91.

Touloumis, A., Agresti, A. and Kateri, M. (2013) GEE for multinomial responses using a local odds ratios parameterization. Biometrics 69, 633--640.

See Also

rbin for simulating correlated binary responses, rmult.clm, rmult.crm and rmult.acl for simulating correlated ordinal responses.

Examples

Run this code
## See Example 3.1 in the Vignette.
betas <- c(1, 3, 2, 1.25, 3.25, 1.75, 0.75, 2.75, 2.25, 0, 0, 0)
sample_size <- 500
categories_no <- 4
cluster_size <- 3
set.seed(1)
x1 <- rep(rnorm(sample_size), each = cluster_size)
x2 <- rnorm(sample_size * cluster_size)
xdata <- data.frame(x1, x2)
equicorrelation_matrix <- toeplitz(c(1, rep(0.95, cluster_size - 1)))
identity_matrix <- diag(categories_no)
latent_correlation_matrix <- kronecker(equicorrelation_matrix,
  identity_matrix)
simulated_nominal_dataset <- rmult.bcl(clsize = cluster_size,
  ncategories = categories_no, betas = betas, xformula = ~ x1 + x2,
  xdata = xdata, cor.matrix = latent_correlation_matrix)
suppressPackageStartupMessages(library("multgee"))
nominal_gee_model <- nomLORgee(y ~ x1 + x2,
  data = simulated_nominal_dataset$simdata, id = id, repeated = time,
  LORstr = "time.exch")
round(coef(nominal_gee_model), 2)

Run the code above in your browser using DataLab