rmult.crm: Simulating Correlated Ordinal Responses Conditional on a...

View source: R/rmult.crm.R

rmult.crmR Documentation

Simulating Correlated Ordinal Responses Conditional on a Marginal Continuation-Ratio Model Specification

Description

Simulates correlated ordinal responses assuming a continuation-ratio model for the marginal probabilities.

Usage

rmult.crm(clsize = clsize, intercepts = intercepts, betas = betas,
  xformula = formula(xdata), xdata = parent.frame(), link = "logit",
  cor.matrix = cor.matrix, rlatent = NULL)

Arguments

clsize

integer indicating the common cluster size.

intercepts

numerical vector or matrix containing the intercepts of the marginal continuation-ratio model.

betas

numerical vector or matrix containing the value of the marginal regression parameter vector associated with the covariates (i.e., excluding intercepts).

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.

link

character string indicating the link function of the marginal continuation-ratio model. Options include 'probit', 'logit', 'cloglog' or 'cauchit'. Required when rlatent = NULL.

cor.matrix

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

rlatent

matrix with clsize rows and ncategories columns containing realizations of the latent random vectors when the NORTA method is not employed. See details for more info.

Details

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

The assumed marginal continuation-ratio model is

Pr(Y_{it}=j |Y_{it} \ge j,x_{it})=F(\beta_{tj0} +\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_{tj0} is the j-th category-specific intercept at the t-th measurement occasion and \beta_{tj} is the j-th category-specific regression parameter vector at the t-th measurement occasion.

The ordinal response Y_{it} is determined by extending the latent variable threshold approach of Tutz (1991) as suggested in Touloumis (2016).

When \beta_{tj0}=\beta_{j0} for all t, then intercepts should be provided as a numerical vector. Otherwise, intercepts must be a numerical matrix such that row t contains the category-specific intercepts at the t-th measurement occasion.

betas should be provided as a numeric vector only when \beta_{t}=\beta 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 \beta_{t}. 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 e^{O2}_{itj} in Touloumis (2016). In this case, the algorithm forces cor.matrix to respect the local independence assumption. 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 (t-1)*\code{ncategories}+1,...,t*\code{ncategories} should contain the realization of e^{O2}_{it1},...,e^{O2}_{itJ}, respectively, for t=1,\ldots,\code{clsize}.

Value

Returns a list that has components:

Ysim

the simulated ordinal responses. Element (i,t) represents the realization of Y_{it}.

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 e^{O2}_{it} in Touloumis (2016).

Author(s)

Anestis Touloumis

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.

Touloumis, A. (2016) Simulating Correlated Binary and Multinomial Responses under Marginal Model Specification: The SimCorMultRes Package. The R Journal (forthcoming).

Tutz, G. (1991) Sequential models in categorical regression. Computational Statistics & Data Analysis 11, 275–295.

See Also

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

Examples

## See Example 3.3 in the Vignette.
set.seed(1)
sample_size <- 500
cluster_size <- 4
beta_intercepts <- c(-1.5, -0.5, 0.5, 1.5)
beta_coefficients <- 1
x <- rnorm(sample_size * cluster_size)
categories_no <- 5
identity_matrix <- diag(1, (categories_no - 1) * cluster_size)
equicorrelation_matrix <- toeplitz(c(0, rep(0.24, categories_no - 2)))
ones_matrix <- matrix(1, cluster_size, cluster_size)
latent_correlation_matrix <- identity_matrix +
  kronecker(equicorrelation_matrix, ones_matrix)
simulated_ordinal_dataset <- rmult.crm(clsize = cluster_size,
  intercepts = beta_intercepts, betas = beta_coefficients, xformula = ~x,
  cor.matrix = latent_correlation_matrix, link = "probit")
head(simulated_ordinal_dataset$Ysim)

AnestisTouloumis/SimCorMultRes documentation built on March 19, 2024, 9:55 p.m.