Package mmm. R topics documented: February 20, Type Package

Similar documents
Forecasting multivariate longitudinal binary data with marginal and marginally specified models

Package mlmmm. February 20, 2015

Package sscor. January 28, 2016

Package rnmf. February 20, 2015

Package threeboost. February 20, 2015

Package gma. September 19, 2017

Package gwqs. R topics documented: May 7, Type Package. Title Generalized Weighted Quantile Sum Regression. Version 1.1.0

Package SEMModComp. R topics documented: February 19, Type Package Title Model Comparisons for SEM Version 1.0 Date Author Roy Levy

Package gtheory. October 30, 2016

Introduction to mtm: An R Package for Marginalized Transition Models

Package ebal. R topics documented: February 19, Type Package

Package ShrinkCovMat

Package EnergyOnlineCPM

Package sbgcop. May 29, 2018

Introduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data

Package JointModel. R topics documented: June 9, Title Semiparametric Joint Models for Longitudinal and Counting Processes Version 1.

Package matrixnormal

Package wgeesel. July 23, 2017

SAS Macro for Generalized Method of Moments Estimation for Longitudinal Data with Time-Dependent Covariates

Package jmcm. November 25, 2017

Package cccrm. July 8, 2015

Package TwoStepCLogit

Package MultisiteMediation

Package rarhsmm. March 20, 2018

Package LCAextend. August 29, 2013

Package symmoments. R topics documented: February 20, Type Package

Package drgee. November 8, 2016

Package QuantifQuantile

STAT 526 Advanced Statistical Methodology

Package zic. August 22, 2017

Gaussian copula regression using R

Package SimCorMultRes

The nltm Package. July 24, 2006

Package severity. February 20, 2015

Package riv. R topics documented: May 24, Title Robust Instrumental Variables Estimator. Version Date

Package ltsbase. R topics documented: February 20, 2015

Package darts. February 19, 2015

Model and Working Correlation Structure Selection in GEE Analyses of Longitudinal Data

Package ARCensReg. September 11, 2016

Package HIMA. November 8, 2017

Package SpatialNP. June 5, 2018

Package reinforcedpred

Package accelmissing

Package weightquant. R topics documented: December 30, Type Package

Package krige. August 24, 2018

Package BayesNI. February 19, 2015

Package metafuse. October 17, 2016

Package spcov. R topics documented: February 20, 2015

Analysis of Longitudinal Data. Patrick J. Heagerty PhD Department of Biostatistics University of Washington

Package rgabriel. February 20, 2015

Package spef. February 26, 2018

Package effectfusion

Package flexcwm. R topics documented: July 11, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.0.

Package ICGOR. January 13, 2017

Package BNN. February 2, 2018

Package lmm. R topics documented: March 19, Version 0.4. Date Title Linear mixed models. Author Joseph L. Schafer

Package AID. R topics documented: November 10, Type Package Title Box-Cox Power Transformation Version 2.3 Date Depends R (>= 2.15.

Package penmsm. R topics documented: February 20, Type Package

Package CPE. R topics documented: February 19, 2015

Package anoint. July 19, 2015

Package clogitboost. R topics documented: December 21, 2015

Package msir. R topics documented: April 7, Type Package Version Date Title Model-Based Sliced Inverse Regression

Package CovSel. September 25, 2013

Package ensemblebma. R topics documented: January 18, Version Date

Package flexcwm. R topics documented: July 2, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.1.

GMM Logistic Regression with Time-Dependent Covariates and Feedback Processes in SAS TM

Package leiv. R topics documented: February 20, Version Type Package

Longitudinal Data Analysis Using Stata Paul D. Allison, Ph.D. Upcoming Seminar: May 18-19, 2017, Chicago, Illinois

Package robustrao. August 14, 2017

Package bhrcr. November 12, 2018

Package dhsic. R topics documented: July 27, 2017

Package ICBayes. September 24, 2017

Package scio. February 20, 2015

Package r2glmm. August 5, 2017

Package face. January 19, 2018

Package noncompliance

INTRODUCTION TO MULTILEVEL MODELLING FOR REPEATED MEASURES DATA. Belfast 9 th June to 10 th June, 2011

Package crrsc. R topics documented: February 19, 2015

Package icmm. October 12, 2017

Package tspi. August 7, 2017

Package ssanv. June 23, 2015

Package sgr. February 20, 2015

Package misctools. November 25, 2016

Package covtest. R topics documented:

Package dhga. September 6, 2016

Package ensemblebma. July 3, 2010

Package covsep. May 6, 2018

Package ProDenICA. February 19, 2015

Package MACAU2. R topics documented: April 8, Type Package. Title MACAU 2.0: Efficient Mixed Model Analysis of Count Data. Version 1.

Longitudinal Data Analysis Using SAS Paul D. Allison, Ph.D. Upcoming Seminar: October 13-14, 2017, Boston, Massachusetts

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Package ProbForecastGOP

Package ENA. February 15, 2013

Package EMMIX. November 8, 2013

Package CoxRidge. February 27, 2015

Package InferenceSMR

The sbgcop Package. March 9, 2007

GEE for Longitudinal Data - Chapter 8

Package sklarsomega. May 24, 2018

Package GORCure. January 13, 2017

Transcription:

Package mmm February 20, 2015 Type Package Title an R package for analyzing multivariate longitudinal data with multivariate marginal models Version 1.4 Date 2014-01-01 Author Ozgur Asar, Ozlem Ilk Depends gee Maintainer Ozgur Asar <o.asar@lancaster.ac.uk> Description fits multivariate marginal models for multivariate longitudinal data for both continuous and discrete responses License GPL (>= 2) NeedsCompilation no Repository CRAN Date/Publication 2014-01-01 05:19:53 R topics documented: mmm-package........................................ 2 mmm............................................ 2 motherstress........................................ 8 multilongcount....................................... 9 multilonggaussian..................................... 10 Index 12 1

2 mmm mmm-package mmm: an R package for analyzing multivariate longitudinal data with multivariate marginal models Description Details fits multivariate marginal models for multivariate longitudinal data for both continuous and discrete responses Asar, O., Ilk, O. (2013). mmm: an R package for analyzing multivariate longitudinal data with multivariate marginal models, Computer Methods and Programs in Biomedicine, 112, 649-654. Package: mmm Type: Package Version: 1.4 Date: 2013-01-01 License: GPL (>=2) mmm an R function to fit the multivariate marginal models to analyze multivariate longitudinal data Description fits multivariate marginal models to analyze multivariate longitudinal data, for both continuous and discrete responses Usage mmm(formula, id, data = NULL, correlation = NULL, initestim = NULL, tol = 0.001, maxiter = 25, family = "gaussian", corstruct = "independence", Mv = 1, silent = TRUE, scale.fix = FALSE, scale.value = 1) Arguments formula id data a formula expression, see the examples given below. a vector for identification of the clusters. an optional data frame.

mmm 3 correlation initestim tol maxiter family corstruct Mv silent scale.fix scale.value a user specified square matrix for the working correlation matrix, appropriate when corstr="fixed". user specified initials for the parameter estimates. the tolerance which specifies the convergency of the algorithm. the maximum number of iterations to be consumed by the algorithm. 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 handles multivariate longitudinal binary data, family=poisson handles multivariate longitudinal count data, family=gaussian handles multivariate longitudinal (normal type) continous data and family=gamma handles multivariate longitudinal (gamma type) continous data. a character string which defines the structure of the working correlation matrix. For details see the gee documentation. specifies the lag value, e.g. specification of "corstr=ar-m" and "Mv=1" indicates AR(1). a logial variable which decides the print of the iterations. a logical variable for fixing the scale parameter to a user specified value. a user specified scale parameter value, appropriate when scale.fix=true. Value Returns an onject of the results. See the examples given below. Note Version 1.1. Author(s) Ozgur Asar, Ozlem Ilk References Asar, O. (2012). On multivariate longitudinal binary data models and their applications in forecasting. MS Thesis, Middle East Technical University. Available online at http://www.lancaster.ac.uk/pg/asar/thesis- Ozgur-Asar Asar, O., Ilk, O. (2013). mmm: an R package for analyzing multivariate longitudinal data with multivariate marginal models, Computer Methods and Programs in Biomedicine, 112, 649-654. 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.

4 mmm See Also gee Examples ######################### ## Binary data example ## ######################### data(motherstress) fit1<-mmm(formula=cbind(stress,illness)~married+education+ employed+chlth+mhlth+race+csex+housize+bstress+billness+ week,id=motherstress$id,data=motherstress,family=binomial,corstruct="exchangeable") summary(fit1) ######################## ## Count data example ## ######################## ## First we illustrate how the data set is simulated ## Then the R script to analyze the data set by mmm is given ## Note: no need to run the script to generate the data set, unless of interest ## Not run: ### Generating the data by the help of corcounts package # loading the package corcounts library("corcounts") # setting the seed to 12 set.seed(12) # number of subjects in the study n1 <- 500 # defining the response and covariate families (Poi indicates Poisson distribution) margins <- c("poi","poi","poi","poi","poi","poi","poi","poi","poi") # the means of the responses and covariate. while 5 and 8 are the means of the responses # 20 is the mean of the time independent covariate mu <- c(5, 8, 20, 5, 8, 5, 8, 5, 8) # the correlation structure which corcounts uses to generate correlated count data # (unstr indicates unstructured correlation structure) corstr <- "unstr" # the correlation matrix corcounts assumes the correlated count data have corpar<-matrix(c(1,0.4,0.6,0.9,0.37,0.8,0.34,0.7,0.31, 0.4,1,0.6,0.37,0.9,0.34,0.8,0.31,0.7, 0.6,0.6,1,0.6,0.6,0.6,0.6,0.6,0.6, 0.9,0.37,0.6,1,0.4,0.9,0.37,0.8,0.34, 0.37,0.9,0.6,0.4,1,0.37,0.9,0.34,0.8,

mmm 5 0.8,0.34,0.6,0.9,0.37,1,0.4,0.9,0.37, 0.34,0.8,0.6,0.37,0.9,0.4,1,0.37,0.9, 0.7,0.31,0.6,0.8,0.34,0.9,0.37,1,0.4, 0.31,0.7,0.6,0.34,0.8,0.37,0.9,0.4,1),ncol=9,byrow=T) # generating the correlated count data by rcounts function avaiable in corcounts data1 <- rcounts(n=n1,margins=margins,mu=mu,corstr=corstr,corpar=corpar) ### The reconstruction of the generated correlated count data to ### the longitudinal data (long) format # seperating the bivariate responses measured at the first time # point and the time independent covariate time11<-data1[,1:3] # seperating the bivariate responses measured at the second time # point and combining them with the time independent covariate time12<-cbind(data1[,4:5],data1[,3]) # seperating the bivariate responses measured at the third time # point and combining them with the time independent covariate time13<-cbind(data1[,6:7],data1[,3]) # seperating the bivariate responses measured at the fourth time # point and combining them with the time independent covariate time14<-cbind(data1[,8:9],data1[,3]) # combining the data for all the time points data12<-rbind(time11,time12,time13,time14) # constructing the time variable time1<-matrix(rep(seq(1:4),each=n1)) # constructing the id variable id1<-matrix(rep(seq(1:n1),4)) # combining the id of the subjects, the simulated data and the time variable data13<-cbind(id1,data12,time1) # reconstructing the data subject by subject which mmm expects it has data14<-null for (i in 1:n1) data14<-rbind(data14,data13[data13[,1]==i,]) ### Data manipulations on the covariates # taking natural logarithm of the time independent covariate data14[,4]<-log(data14[,4]) # standardizing time variable data14[,5]<-scale(data14[,5]) # adding the interaction of the time independent covariate # and time as a new covariate

6 mmm multilongcount<-as.data.frame(cbind(data14,data14[,4]*data14[,5])) names(multilongcount)<-c("id","resp1","resp2","x","time","x.time") ## End(Not run) ### R script to analyze the count data set ### It is already stored in mmm pacakge data(multilongcount) fit2<-mmm(formula=cbind(resp1,resp2)~x+time+x.time, id=multilongcount$id,data=multilongcount,family=poisson,corstruct="unstructured") summary(fit2) ############################# ## Continuous data example ## ############################# ## First we illustrate how the data set is simulated ## Then the R script to analyze the data set by mmm is given ## Note: no need to run the script to generate the data set, unless of interest ## Not run: ### Generating the data by the help of mvtnorm package # loading package mvtnorm library("mvtnorm") # number of subjects in the study n2<-500 # setting the seed to 12 set.seed(12) # specifying the correlation matrix which mvtnorm assumes the correlated data have cormat<-matrix(c(1,0.4,0.6,0.9,0.37,0.8,0.34,0.7,0.31, 0.4,1,0.6,0.37,0.9,0.34,0.8,0.31,0.7, 0.6,0.6,1,0.6,0.6,0.6,0.6,0.6,0.6, 0.9,0.37,0.6,1,0.4,0.9,0.37,0.8,0.34, 0.37,0.9,0.6,0.4,1,0.37,0.9,0.34,0.8, 0.8,0.34,0.6,0.9,0.37,1,0.4,0.9,0.37, 0.34,0.8,0.6,0.37,0.9,0.4,1,0.37,0.9, 0.7,0.31,0.6,0.8,0.34,0.9,0.37,1,0.4, 0.31,0.7,0.6,0.34,0.8,0.37,0.9,0.4,1),ncol=9,byrow=T) # variances of the responses and time independent covariate # while 0.97 and 1.1 correspond to the variances of the bivariate responses # 4 corresponds to the variance of the time independent covariate variance<-c(0.97,1.1,4,0.97,1.1,0.97,1.1,0.97,1.1) # constructing the (diaonal) standard deviation matrix std<-diag(sqrt(variance),9) # constructing the variance covariance matrix, sigma

mmm 7 sigma<-std # generating the correlated continuous data utilizing rmvnorm function available # in mvtnorm ; method="svd" indicates use of singular value decomposition method data2<-rmvnorm(n2,mean = rep(0,nrow(sigma)),sigma=sigma,method="svd") ### The reconstruction of the generated correlated continuous data to the ### longitudinal data (long) format # seperating the bivariate responses measured at first time point # and the time independent covariate time21<-data2[,1:3] # seperating the bivariate responses measured at second time point # and combining them with the time independent covariate time22<-cbind(data2[,4:5],data2[,3]) # seperating the bivariate responses measured at third time point # and combining them with the time independent covariate time23<-cbind(data2[,6:7],data2[,3]) # seperating the bivariate responses measured at fourth time point # and combining them with the time independent covariate time24<-cbind(data2[,8:9],data2[,3]) # combining the data for all the time points data22<-rbind(time21,time22,time23,time24) # constructing the time variable time2<-matrix(rep(seq(1:4),each=n2)) # constructing the id variable id2<-matrix(rep(seq(1:n2),4)) # combining the id of the subjects, the generated data and the time variable data23<-cbind(id2,data22,time2) # reconstructing the data subject by subject which mmm expects it has data24<-null for (i in 1:n2) data24<-rbind(data24,data23[data23[,1]==i,]) ### Data manipulations on the covariates # standardizing the time variable data24[,5]<-scale(data24[,5]) # adding the interaction of the time independent covariate # and time as a new covariate multilonggaussian<-as.data.frame(cbind(data24,data24[,4]*data24[,5])) names(multilonggaussian)<-c("id","resp1","resp2","x","time","x.time") ## End(Not run)

8 motherstress ### R script to analyze the continuous data set ### It is already stored in mmm pacakge data(multilonggaussian) fit3<-mmm(formula=cbind(resp1,resp2)~x+time+x.time, id=multilonggaussian$id,data=multilonggaussian,family=gaussian,corstruct="unstructured") summary(fit3) motherstress Mother s Stress and Children s Morbidity Study Description Usage Format A data frame with 2004 observations on the following 14 variables. motherstress is a longitudinal dataset which includes daily information of the participants. There are 167 mothers and children enrolled in the study. data(motherstress) The details of the columns of the data frame are given below. id a vector for subject id stress a vector for mother s stress at time t:1=presence, 0=absence illness a vector for children s illness at time t: 1=presence, 0=absence married a vector for marriage status of mother: 1=married, 0=other education a vector for mother s education level: 0=high school or less, 1=high school graduate employed a numeric vector for mother s employment status: 1=employed, 0=unemployed chlth a vector for children s health status at baseline: 0=very poor/poor, 1=fair, 2=good, 3=very good mhlth a vector for mother s health status at baseline: 0=very poor/poor, 1=fair, 2=good, 3=very good race a vector for child s race: 1=non-white, 0=white csex a vector for child s gender: 1=female, 0=male housize a vector for the size of the household: 0=2-3 people, 1=more than 3 people bstress a vector for the baseline stress for the period of day 1 to 16; calculated as the mean of the stress status of the subjects in the period of day 1 to 16 billness a vector for the baseline illness for the period of day 1 to 16; calculated as the mean of the illness status of the subjects in the period of day 1 to 16 week a numeric vector for time: (day-22)/7

multilongcount 9 Details The original data contains the information of the mothers and children in the study for 28 days. Because of the weak serial correlation in the period of day 1 to 16, it is ignored. Only the period of day 17 to 28 is included here. To catch the specific characteristic of the mothers and children, the averages of the stress and illness status of them are added as new covariates; bstress and billness. While the covariates have no missing observation, responses have very low percentages of missing values, 0.97 Source http://faculty.washington.edu/heagerty/books/analysislongitudinal/datasets.html References Alexander, C. S., Markowitz, R. (1986). Maternal employment and use of pediatric clinic services. Medical Care, 24(2), 134-147. Diggle, P. J., Heagerty, P., Liang, K. Y., Zeger, S. L. (2002). Analysis of Longitudinal Data. New York: Oxford University Press. Zeger, S. L., Liang, K. L (1986). Longitudinal data analysis for discrete and continous outcomes. Biometrics, 42, 121-130. Examples data(motherstress) head(motherstress,10) require(graphics) mosaicplot(~motherstress$employed+motherstress$housize+motherstress$stress,color=true) multilongcount Multivariate Longitudinal Count Data Description A data frame with 2000 observations on the following 6 variables. multilongcount is a simulated bivariate longitudinal count dataset assuming there are 500 subjects in the study whose data are collected at 4 equally-spaced time points. Usage data(multilongcount)

10 multilonggaussian Format A data frame with 2000 observations on the following 6 variables. ID a numeric vector for subject ID resp1 a numeric vector for the first longitudinal count response resp2 a numeric vector for the second longitudinal count response X a numeric vector for the covariate, X time a numeric vector for the time point at which observations are collected X.time a numeric vector for the interaction between X and time Details The covariates, X and time are the standardized values indeed. The related interaction is calculated by using these standardized values. X is a time-independent covariate. The R script to generate the data set is given in the Examples section of the mmm function. References Asar, O. (2012). On multivariate longitudinal binary data models and their applications in forecasting. MS Thesis, Middle East Technical University Erhardt, V. (2009). corcounts: Generate Correlated Count Random Variable. R package version 1.4. URL http://cran.r-project.org/package=corcounts. Examples data(multilongcount) plot(multilongcount$x,multilongcount$resp1) multilonggaussian Multivariate Longitudinal Continuous (Gaussian) Data Description A data frame with 2000 observations on the following 6 variables. multilonggaussian is a simulated bivariate longitudinal continuous dataset assuming there are 500 subjects in the study whose data are collected at 4 equally-spaced time points. Usage data(multilonggaussian)

multilonggaussian 11 Format Details A data frame with 2000 observations on the following 6 variables. ID a numeric vector for subject ID resp1 a numeric vector for the first longitudinal count response resp2 a numeric vector for the second longitudinal count response X a numeric vector for the covariate, X time a numeric vector for the time point at which observations are collected X.time a numeric vector for the interaction between X and time The covariates, X and time are the standardized values indeed. The related interaction is calculated by using these standardized values. X is a time-independent covariate. The R script to generate the data set is given in the Examples section of the mmm function. References Asar, O. (2012). On multivariate longitudinal binary data models and their applications in forecasting. MS Thesis, Middle East Technical University Genz, A., Bretz, F., Miwa, T., Mi, X., Leisch, F., Scheipl, F., Hothorn, T. (2011). mvtnorm: Multivariate Normal and t Distributions. R package version 0.9-96. URL http://cran.r-project.org/package=mvtnorm. Examples data(multilonggaussian) plot(multilonggaussian$x,multilonggaussian$resp1)

Index Topic datasets motherstress, 8 multilongcount, 9 multilonggaussian, 10 Topic generalized estimating equations mmm, 2 gee, 3, 4 mmm, 2 mmm-package, 2 motherstress, 8 multilongcount, 9 multilonggaussian, 10 12