weightMat {weightedScores} | R Documentation |
WEIGHT MATRICES FOR THE ESTIMATING EQUATIONS
Description
Weight matrices for the estimating equations.
Usage
weightMat(b,gam,rh,xdat,ydat,id,tvec,margmodel,corstr,link)
weightMat.ord(b,gam,rh,xdat,ydat,id,tvec,corstr,link)
Arguments
b |
The regression coefficients. |
gam |
The uinivariate parameters that are not regression coefficients. That is the parameter |
rh |
The vector of normal copula parameters. |
xdat |
|
ydat |
|
id |
An index for individuals or clusters. |
tvec |
A vector with the time indicator of individuals or clusters. |
margmodel |
Indicates the marginal model. Choices are “poisson” for Poisson, “bernoulli” for Bernoulli, and “nb1” , “nb2” for the NB1 and NB2 parametrization of negative binomial in Cameron and Trivedi (1998). |
corstr |
Indicates the latent correlation structure of normal copula. Choices are “exch”, “ar”, and “unstr” for exchangeable, ar(1) and unstrucutred correlation structure, respectively. |
link |
The link function. Choices are “log” for the log link function, “logit” for the logit link function, and “probit” for the probit link function. |
Details
The fixed weight matrices based on a working
discretized MVN, of the weighted scores equations in Nikoloulopoulos et al. (2011)
where is based on
the covariance matrix of
computed from the
fitted discretized MVN model with estimated parameters
.
Note that weightMat.ord
is a variant of the code for ordinal (probit and logistic) regression.
Value
A list containing the following components:
omega |
The array with the |
delta |
The array with the |
X |
The array with the |
Author(s)
Aristidis K. Nikoloulopoulos A.Nikoloulopoulos@uea.ac.uk
Harry Joe harry.joe@ubc.ca
References
Nikoloulopoulos, A.K., Joe, H. and Chaganty, N.R. (2011) Weighted scores method for regression models with dependent data. Biostatistics, 12, 653–665. doi: 10.1093/biostatistics/kxr005.
Nikoloulopoulos, A.K. (2016) Correlation structure and variable selection in generalized estimating equations via composite likelihood information criteria. Statistics in Medicine, 35, 2377–2390. doi: 10.1002/sim.6871.
Nikoloulopoulos, A.K. (2017) Weighted scores method for longitudinal ordinal data. Arxiv e-prints, <arXiv:1510.07376>. https://arxiv.org/abs/1510.07376.
See Also
wtsc
,
solvewtsc
,
godambe
,
wtsc.wrapper
Examples
################################################################################
# binary regression
################################################################################
################################################################################
# read and set up the data set
################################################################################
data(toenail)
xdat<-cbind(1,toenail$treat,toenail$time,toenail$treat*toenail$time)
# response
ydat<-toenail$y
#id
id<-toenail$id
#time
tvec<-toenail$time
################################################################################
# select the marginal model
################################################################################
margmodel="bernoulli"
link="probit"
################################################################################
# select the correlation structure
################################################################################
corstr="ar"
################################################################################
# perform CL1 estimation
################################################################################
i.est<-iee(xdat,ydat,margmodel,link)
cat("\niest: IEE estimates\n")
print(c(i.est$reg,i.est$gam))
# est.rho<-cl1(b=i.est$reg,gam=i.est$gam,xdat,ydat,id,tvec,margmodel,corstr,link)
# cat("\nest.rho: CL1 estimates\n")
# print(est.rho$e)
# [1] 0.8941659
################################################################################
# obtain the fixed weight matrices
################################################################################
WtScMat<-weightMat(b=i.est$reg,gam=i.est$gam,rh=0.8941659,
xdat,ydat,id,tvec,margmodel,corstr,link)
################################################################################
# Ordinal regression
################################################################################
################################################################################
# read and set up data set
################################################################################
data(arthritis)
nn=nrow(arthritis)
bas2<-bas3<-bas4<-bas5<-rep(0,nn)
bas2[arthritis$b==2]<-1
bas3[arthritis$b==3]<-1
bas4[arthritis$b==4]<-1
bas5[arthritis$b==5]<-1
t2<-t3<-rep(0,nn)
t2[arthritis$ti==3]<-1
t3[arthritis$ti==5]<-1
xdat=cbind(t2,t3,arthritis$trt,bas2,bas3,bas4,bas5,arthritis$age)
ydat=arthritis$y
id<-arthritis$id
#time
tvec<-arthritis$time
################################################################################
# select the link
################################################################################
link="probit"
################################################################################
# select the correlation structure
################################################################################
corstr="exch"
################################################################################
# perform CL1 estimation
################################################################################
i.est<-iee.ord(xdat,ydat,link)
cat("\niest: IEE estimates\n")
print(c(i.est$reg,i.est$gam))
est.rho<-cl1.ord(b=i.est$reg,gam=i.est$gam,xdat,ydat,id,tvec,corstr,link)
WtScMat<-weightMat.ord(b=i.est$reg,gam=i.est$gam,rh=est.rho$e,xdat,ydat,id,tvec,corstr,link)