Learn R Programming

mmm2 (version 1.0)

mmm2: Function to fit multivariate marginal models with shared regression parameters

Description

fits multivariate marginal models with shared regression parameters for both continous and discrete responses

Usage

mmm2(data, nresp, rtype = TRUE, interaction = NULL, coefnames = NULL,
family = "gaussian", tol = 0.001, maxiter = 25, corstr = "independence", 
Mv = 1, silent = TRUE)

Arguments

data
a data frame or matrix. Id of the subjects should be placed in the first column, multivariate responses should be placed in the columns next to id variable and the covariates which are to be included in the model should be placed in the columns next to th
nresp
number of multivariate responses.
rtype
a logical variable which determines the inclusion of response type indicator variables as new covariates. The default is set to TRUE which corresponds to the inclusion of response types by placing them right after the last covariate in the design matrix.
interaction
expects a vector of integers which includes the column number of the covariates (by considering only the covariate matrix, not the whole data) which are to be interacted with the response type indicator variables. These interactions are added as new covar
coefnames
a list of names of the coefficients which provides better output.
family
an object which defines the link and variance function. The possible choices are same with the ones in the "gee" package. For details see the gee documentation. Note that family=binomial
tol
the tolerance which specifies the convergency of the algorithm.
maxiter
the maximum number of iterations to be consumed by the algorithm.
corstr
a character string which defines the structure of the working correlation matrix. For details see the gee documentation.
Mv
specifies the lag value, e.g. specification of "corstr=AR-M" and "Mv=1" indicates AR(1).
silent
a logical variable which decides the print of the iterations.

Value

  • list1A list which includes the output of the multivariate marginal modeling. For the details of manipulation of the output, see the example below.

Details

The mmm2 function utilizes the gee package within. Therefore, installation and loading of that package is mandatory. mmm2 loads it automatically.

References

Ilk, O., Daniels, M. (2007). Marginalized transition random effects models for multivariate longitudinal binary data. Canadian Journal of Statistics, 35, 105-123. Liang, K. L., Zeger, S. L. (1986). Longitudinal data analysis using generalized linear models. Biometrika, 73, 13-22. Shelton, B. J., Gilbert, G. H., Liu, B., Fisher, M. (2004). A SAS macro for the analysis of multivariate longitudinal binary outcomes. Computer Methods and Programs in Biomedicine, 76, 163-175. Zeger, S. L., Liang, K. L (1986). Longitudinal data analysis for discrete and continous outcomes. Biometrics, 42, 121-130.

See Also

gee

Examples

Run this code
data(mscm)
coefnames<-c("intercept","married","education",
"employed","chlth","mhlth","race","csex","housize",
"bstress","billness","week","resptype","married*resptype",
"education*resptype","employed*resptype","chlth*resptype",
"mhlth*resptype","race*resptype","csex*resptype",
"housize*resptype","bstress*resptype","billness*resptype",
"week*resptype")
# mmm2 automatically assign 0 to response type indicator
# variable for response=stress and 1 to it for response=illness
mmm2.fit<-mmm2(data=mscm,nresp=2,interaction=seq(1:11),coefnames=coefnames,
family=binomial(link=logit), corstr="exchangeable")
round(summary(mmm2.fit)$coef,3)

Run the code above in your browser using DataLab