Learn R Programming

JGEE (version 1.1)

JGee1: Function to fit a joint generalized estimating equation model with shared regression coefficients

Description

This function fits a joint generalized estimating equation model to multivariate longitudinal data with mono-type responses where the regression coefficients are shared by the different response types.

Usage

JGee1(formula, id, data, nr, na.action = NULL, family = gaussian(link = "identity"), corstr1 = "independence", Mv = NULL, corstr2 = "independence", beta_int = NULL, R1 = NULL, R2 = NULL, scale.fix = FALSE, scale.value = 1, maxiter = 25, tol = 10^-3, silent = FALSE)

Arguments

formula
A formula expression in the form of response~predictors.
id
A vector for identifying subjects.
data
A data frame which stores the variables in formula with id variable.
nr
Number of multiple responses.
na.action
A function to remove missing values from the data. Only na.omit is allowed here.
family
A family object: a list of functions and expressions for defining link and variance functions. Families supported in JGee1 are binomial, gaussian, gamma and poisson. The links, which are not available in gee, is not available here. The default family is gaussian.
corstr1
A character string, which specifies the type of within-subject correlation structure. Structures supported in JGee1 are "AR-1","exchangeable", "fixed", "independence","stat_M_dep","non_stat_M_dep", and "unstructured". The default corstr1 type is "independence".
Mv
If either "stat_M_dep", or "non_stat_M_dep" is specified in corstr1, then this assigns a numeric value for Mv. Otherwise, the default value is NULL.
corstr2
A character string, which specifies the type of multivariate response correlation structure. Structures supported in JGee1 are "exchangeable", "independence", and "unstructured". The default corstr2 type is "independence".
beta_int
User specified initial values for regression parameters. The default value is NULL.
R1
If corstr1="fixed" and corstr2="fixed" are specified, then R1 is a square matrix of dimension maximum cluster size containing the user specified correlation. Otherwise, the default value is NULL.
R2
If corstr1="fixed" and corstr2="fixed" are specified, then R2 is a square matrix of dimension nr size containing the user specified correlation. Otherwise, the default value is NULL.
scale.fix
A logical variable; if true, the scale parameter is fixed at the value of scale.value. The default value is FALSE.
scale.value
If scale.fix=TRUE, this assignes a numeric value to which the scale parameter should be fixed.
maxiter
The number of iterations that is used in the estimation algorithm. The default value is 25.
tol
The tolerance level that is used in the estimation algorithm. The default value is 10^-3.
silent
A logical variable; if true, the regression parameter estimates at each iteration are printed. The default value is FALSE.

Value

JGee1 representing the fit.

See Also

JGee2

Examples

Run this code
## Not run: 
# data(MSCMsub)
# mydata=MSCMsub
# 
# #MSCM stduy data layout requires some arrangement for model fitting.
# 
# N=167
# nt=4
# nr=2
# 
# yvec=matrix(0,N*nt*nr,1)
# xmat=matrix(0,N*nt*nr,8)
# 
# for(i in 1:N) {
# for(j in 1:nt){
# yvec[j+(i-1)*nr*nt]=mydata[j+(i-1)*nt,2]
# yvec[j+(i-1)*nr*nt+nt]=mydata[j+(i-1)*nt,3]
# }
# }
# 
# for(i in 1:N) {
# for(j in 1:nt){
# for(k in 4:11){
# xmat[j+(i-1)*nr*nt,(k-3)]=mydata[j+(i-1)*nt,k]
# xmat[j+(i-1)*nr*nt+nt,(k-3)]=mydata[j+(i-1)*nt,k]
# }
# }
# }
# 
# id=rep(1:N, each=(nt*nr))
# mydatanew=data.frame(id,yvec,xmat)
# head(mydatanew)
# colnames(mydatanew)=c("id","resp","chlth","csex","education","employed",
# "housize","married","mhlth","race")
# head(mydatanew)
# 
# formulaj1=resp~chlth+csex+education+employed+housize+married+
# mhlth+race
# 
# fitjgee1=JGee1(formula=formulaj1,id=mydatanew[,1],data=mydatanew, nr=2, 
# na.action=NULL, family=binomial(link="logit"), corstr1="exchangeable", 
# Mv=NULL, corstr2="independence", beta_int=NULL, R1=NULL, R2=NULL, 
# scale.fix= FALSE, scale.value=1, maxiter=25, tol=10^-3, 
# silent=FALSE)
# 
# summary(fitjgee1)
# 
# names(summary(fitjgee1))
# 
# summary(fitjgee1)$working.correlation1
# ## End(Not run)

Run the code above in your browser using DataLab