
Last chance! 50% off unlimited learning
Sale ends in
Simulates correlated nominal responses assuming a baseline-category logit model for the marginal probabilities.
rmult.bcl(clsize = clsize, ncategories = ncategories, betas = betas,
xformula = formula(xdata), xdata = parent.frame(),
cor.matrix = cor.matrix, rlatent = NULL)
Returns a list that has components:
the simulated
nominal responses. Element (
a data frame that includes the simulated
response variables (y), the covariates specified by xformula
,
subjects' identities (id) and the corresponding measurement occasions
(time).
the latent random variables denoted by
integer indicating the common cluster size.
integer indicating the number of nominal response categories.
numerical vector or matrix containing the value of the marginal regression parameter vector.
formula expression as in other marginal regression models but without including a response variable.
optional data frame containing the variables provided in
xformula
.
matrix indicating the correlation matrix of the
multivariate normal distribution when the NORTA method is employed
(rlatent = NULL
).
matrix with (clsize * ncategories)
columns containing
realizations of the latent random vectors when the NORTA method is not
preferred. See details for more info.
Anestis Touloumis
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
The nominal response
betas
should be provided as a numeric vector only when
betas
must be provided as a numeric matrix with
clsize
rows such that the 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 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
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.
rbin
for simulating correlated binary responses,
rmult.clm
, rmult.crm
and
rmult.acl
for simulating correlated ordinal responses.
## 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