Docsity

CL1 Estimation for Ordinal Regression with Weighted Scores Method, Lecture notes of Biostatistics

Toggle sidebar
bg1
Package ‘weightedScores’
March 23, 2020
Version 0.9.5.3
Date 2020-03-20
Title Weighted Scores Method for Regression Models with Dependent Data
Author Aristidis K. Nikoloulopoulos [aut, cre],
Harry Joe [aut]
Maintainer Aristidis K. Nikoloulopoulos <[email protected]>
Depends R (>= 2.0.0), mvtnorm, rootSolve
Description
The weighted scores method and composite likelihood information criteria as an intermedi-
ate step for variable/correlation selection for longitudinal ordinal and count data in Nikoloulopou-
los, Joe and Chaganty (2011) <doi:10.1093/biostatistics/kxr005>, Nikoloulopou-
los (2016) <doi:10.1002/sim.6871> and Nikoloulopoulos (2017) <arXiv:1510.07376>.
License GPL (>= 2)
NeedsCompilation yes
Repository CRAN
Date/Publication 2020-03-23 17:20:02 UTC
Rtopics documented:
weightedScores-package .................................. 2
approxbvncdf ........................................ 3
arthritis ........................................... 4
bcl.............................................. 5
childvisit .......................................... 6
cl1.............................................. 7
clic.............................................. 10
godambe........................................... 14
iee.............................................. 18
iee.ord............................................ 20
marglik ........................................... 21
margmodel ......................................... 23
mvn.deriv .......................................... 24
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download CL1 Estimation for Ordinal Regression with Weighted Scores Method and more Lecture notes Biostatistics in PDF only on Docsity!

Package ‘weightedScores’

March 23, 2020

Version 0.9.5.

Date 2020-03-

Title Weighted Scores Method for Regression Models with Dependent Data

Author Aristidis K. Nikoloulopoulos [aut, cre], Harry Joe [aut]

Maintainer Aristidis K. Nikoloulopoulos

Depends R (>= 2.0.0), mvtnorm, rootSolve

Description The weighted scores method and composite likelihood information criteria as an intermedi- ate step for variable/correlation selection for longitudinal ordinal and count data in Nikoloulopou- los, Joe and Chaganty (2011) , Nikoloulopou- los (2016) and Nikoloulopoulos (2017) .

License GPL (>= 2)

NeedsCompilation yes

Repository CRAN

Date/Publication 2020-03-23 17:20:02 UTC

R topics documented:

weightedScores-package.................................. 2 approxbvncdf........................................ 3 arthritis........................................... 4 bcl.............................................. 5 childvisit.......................................... 6 cl1.............................................. 7 clic.............................................. 10 godambe........................................... 14 iee.............................................. 18 iee.ord............................................ 20 marglik........................................... 21 margmodel......................................... 23 mvn.deriv.......................................... 24

2 weightedScores-package

mvnapp........................................... 28 scoreCov.......................................... 30 solvewtsc.......................................... 31 toenail............................................ 34 weightMat.......................................... 35 wtsc............................................. 38 wtsc.wrapper........................................ 40

Index 43

weightedScores-package Weighted Scores Method for Regression Models with Dependent Data

Description

The weighted scores method and CL1 information criteria as an intermediate step for variable/correlation selection for longitudinal ordinal and count data in Nikoloulopoulos, Joe and Chaganty (2011) and Nikoloulopoulos (2016, 2017).

Details

This package contains R functions to implement:

  • The weighted scores method for regression models with dependent data and negative bino- mial (Nikoloulopoulos, Joe and Chaganty, 2011), GLM (Nikoloulopoulos, 2016) and ordinal probit/logistic (Nikoloulopoulos, 2017) margins.
  • The composite likelihood information criteria for regression models with dependent data and ordinal probit/logistic margins (Nikoloulopoulos, 2016, 2017).

Author(s)

Aristidis K. Nikoloulopoulos.

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, . https://arxiv.org/abs/1510.07376.

4 arthritis

we have

Φ 2 (x 1 , x 2 ; ρ) = Φ(x 1 )Φ(x 2 )+φ(x 1 )φ(x 2 )[ρ+ρ^2 x 1 x 2 /2+ρ^3 (x^21 −1)(x^22 −1)/6+ρ^4 (x^31 − 3 x 1 )(x^32 − 3 x 2 )/ 24

+ρ^5 (x^41 − 6 x^21 + 3)(x^42 − 6 x^22 + 3)/120 + · · ·] A good approximation is obtained truncating the series at ρ^3 term for |ρ| ≤ 0. 4 , and at ρ^5 term for

  1. 4 < |ρ| ≤ 0. 7. Higher order terms may be required for |ρ| > 0. 7.

Value

An approximation of bivariate normal cumulative distribution function.

References

Johnson, N. L. and Kotz, S. (1972) Continuous Multivariate Distributions. Wiley, New York. Pearson, K. (1901) Mathematical contributions to the theory of evolution-VII. On the correlation of characters not quantitatively measureable. Philosophical Transactions of the Royal Society of London, Series A, 195 , 1–47.

See Also

scoreCov

arthritis Rheumatoid Arthritis Clinical Trial

Description

Rheumatoid self-assessment scores for 302 patients, measured on a five-level ordinal response scale at three follow-up times.

Usage

data(arthritis)

Format

A data frame with 888 observations on the following 7 variables:

id Patient identifier variable. y Self-assessment score of rheumatoid arthritis measured on a five-level ordinal response scale. sex Coded as (1) for female and (2) for male. age Recorded at the baseline. trt Treatment group variable, coded as (1) for the placebo group and (2) for the drug group. baseline Self-assessment score of rheumatoid arthritis at the baseline. time Follow-up time recorded in months.

bcl 5

Source

Lipsitz, S.R. and Kim, K. and Zhao, L. (1994). Analysis of repeated categorical data using gener- alized estimating equations. Statistics in Medicine, 13 , 1149–1163.

Examples

data(arthritis)

bcl BIVARIATE COMPOSITE LIKELIHOOD FOR MULTIVARIATE NORMAL COPULA WITH CATEGORICAL AND COUNT REGRES- SION

Description

Bivariate composite likelihood for multivariate normal copula with categorical and count regression.

Usage

bcl(r,b,gam,xdat,ydat,id,tvec,margmodel,corstr,link) bcl.ord(r,b,gam,xdat,ydat,id,tvec,corstr,link)

Arguments

r The vector of normal copula parameters. b The regression coefficients. gam The uinivariate parameters that are not regression coefficients. That is the pa- rameter γ of negative binomial distribution or the q-dimensional vector of the univariate cutpoints of ordinal model. γ is NULL for Poisson and binary regres- sion. xdat (x 1 , x 2 ,... , xn)>, where the matrix xi, i = 1,... , n for a given unit will de- pend on the times of observation for that unit (ji) and will have number of rows ji, each row corresponding to one of the ji elements of yi and p columns where p is the number of covariates including the unit first column to account for the intercept (except for ordinal regression where there is no intercept). This xdat matrix is of dimension (N × p), where N =

∑n i=1 ji^ is the total number of observations from all units. ydat (y 1 , y 2 ,... , yn)>, where the response data vectors yi, i = 1,... , n are of pos- sibly different lengths for different units. In particular, we now have that yi is (ji × 1 ), where ji is the number of observations on unit i. The total number of observations from all units is N =

∑n i=1 ji. The ydat are the collection of data vectors yi, i = 1,... , n one from each unit which summarize all the data together in a single, long vector of length N. id An index for individuals or clusters. tvec A vector with the time indicator of individuals or clusters.

cl1 7

Usage

data(childvisit)

Format

A data frame with 292 observations on the following 6 variables.

id The child ID. age The age in months. sex The sex indicator. matsmst The maternal smoking status. quarter The time indicator. hospvis The response vector of quarterly numbers of hospital visits.

Source

Song P.X.K. (2007). Correlated Data Analysis: Modeling, Analytics, and Application. Correlated Data Analysis: Modeling, Analytics, and Application. Book Webpage/Supplementary Material. Springer, NY.

cl1 OPTIMIZATION ROUTINE FOR BIVARIATE COMPOSITE LIKELI- HOOD FOR MVN COPULA

Description

Optimization routine for bivariate composite likelihood for MVN copula.

Usage

cl1(b,gam,xdat,ydat,id,tvec,margmodel,corstr,link) cl1.ord(b,gam,xdat,ydat,id,tvec,corstr,link)

Arguments

b The regression coefficients. gam The uinivariate parameters that are not regression coefficients. That is the pa- rameter γ of negative binomial distribution or the q-dimensional vector of the univariate cutpoints of ordinal model. γ is NULL for Poisson and binary regres- sion. xdat (x 1 , x 2 ,... , xn)>, where the matrix xi, i = 1,... , n for a given unit will de- pend on the times of observation for that unit (ji) and will have number of rows ji, each row corresponding to one of the ji elements of yi and p columns where p is the number of covariates including the unit first column to account for the intercept (except for ordinal regression where there is no intercept). This xdat matrix is of dimension (N × p), where N =

∑n i=1 ji^ is the total number of observations from all units.

8 cl

ydat (y 1 , y 2 ,... , yn)>, where the response data vectors yi, i = 1,... , n are of pos- sibly different lengths for different units. In particular, we now have that yi is (ji × 1 ), where ji is the number of observations on unit i. The total number of observations from all units is N =

∑n i=1 ji. The ydat are the collection of data vectors yi, i = 1,... , n one from each unit which summarize all the data together in a single, long vector of length N. 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 unstructured 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 CL1 composite likelihood method in Zhao and Joe (2005). The univariate parameters are estimated from the sum of univariate marginal log-likelihoods and then the dependence parameters are estimated from the sum of bivariate marginal log-likelihoods with the univariate parameters fixed from the first step. Note that bcl.ord is a variant of the code for ordinal (probit and logistic) regression.

Value

A list containing the following components:

minimum The negative value of the sum of bivariate marginal log-likelihoods at CL1 esti- mates. estimate The CL1 estimates. gradient The gradient at the estimated minimum of CL1. code An integer indicating why the optimization process terminated, same as in nlm.

Author(s)

Aristidis K. Nikoloulopoulos Harry Joe

References

Zhao, Y. and Joe, H. (2005) Composite likelihood estimation in multivariate data analysis. The Canadian Journal of Statistics, 33 , 335–356.

See Also

bcl iee

10 clic

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="logit" ################################################################################

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) cat("\nest.rho: CL1 estimates\n") print(est.rho$e)

clic CL1 INFORMATION CRITERIA

Description

Composite likelihood (CL1) information criteria.

Usage

clic1dePar(nbcl,r,b,gam,xdat,id,tvec,corstr,WtScMat,link,mvncmp) clic(nbcl,r,b,gam,xdat,id,tvec,corstr,WtScMat,link,mvncmp)

Arguments

nbcl The negative value of the sum of bivariate marginal log-likelihoods at CL1 esti- mates. r The CL1 estimates of the latent correlations. b The CL1 estimates of the regression coefficients. gam The CL1 estimates of the cutpoints. xdat (x 1 , x 2 ,... , xn)>, where the matrix xi, i = 1,... , n for a given unit will de- pend on the times of observation for that unit (ji) and will have number of rows ji, each row corresponding to one of the ji elements of yi and p columns where p is the number of covariates. This xdat matrix is of dimension (N × p), where N =

∑n i=1 ji^ is the total number of observations from all units.

clic 11

id An index for individuals or clusters. tvec A vector with the time indicator of individuals or clusters. WtScMat A list containing the following components. omega: The array with the Ωi, i = 1 ,... , n matrices; delta: The array with the ∆i, i = 1,... , n matrices; X: The array with the Xi, i = 1,... , n matrices. corstr Indicates the latent correlation structure of normal copula. Choices are “exch”, “ar”, and “unstr” for exchangeable, ar(1) and unstructured correlation structure, respectively. link The link function. Choices are “logit” for the logit link function, and “probit” for the probit link function. mvncmp The method of computation of the MVN rectangle probabilities. Choices are 1 for mvnapp (faster), and 2 for pmvnorm (more accurate).

Details

First, consider the sum of univariate log-likelihoods

L 1 =

∑^ n

i=

∑^ d

j=

log f 1 (yij ; νij , γ) =

∑^ n

i=

∑^ d

j=

` 1 (νij , γ, yij ),

and then the sum of bivariate log-likelihoods

L 2 =

∑^ n

i=

j^ = (β>, γ>) be the column vector of all r = p + q univariate parameters. Differentiating L 1 with respect to a leads to the independent estimating equations or univariate composite score functions: g 1 = g 1 (a) =

∂L 1

∂a

∑^ n

i=

X> i s(1) i (a) = 0 ,

Differentiating L 2 with respect to R =

ρjk, 1 ≤ j < k ≤ d

leads to the bivariate composite score functions (Zhao and Joe, 2005):

g 2 =

∂L 2

∂R

∑^ n

i=

s(2) i (a, R) =

∑^ n

i=

s(2) i,jk(a, ρjk), 1 ≤ j < k ≤ d

where s(2) i (a, R) =

∂

j clic 13

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, . https://arxiv.org/abs/1510.07376. Varin, C. and Vidoni, P. (2005). A note on composite likelihood inference and model selection. Biometrika 92 , 519–528. Zhao, Y. and Joe, H. (2005) Composite likelihood estimation in multivariate data analysis. The Canadian Journal of Statistics, 33 , 335–356.

See Also

solvewtsc, wtsc.wrapper

Examples

################################################################################

Binary regression

################################################################################ ################################################################################

read and set up the data set

################################################################################ data(childvisit)

covariates

season1<-childvisit$q season1[season1>1]<- xdat<-cbind(childvisit$sex,childvisit$age,childvisit$m,season1)

response

ydat<-childvisit$hosp ydat[ydat>0]= ydat=2-ydat #id id<-childvisit$id #time tvec<-childvisit$q ################################################################################

select the link

################################################################################ link="logit" ################################################################################

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)

14 godambe

cat("\nest.rho: CL1 estimates\n") print(est.rho$e) cat("\nest.rho: negative CL1 log-likelhood\n") print(est.rho$m) ################################################################################

obtain the fixed weight matrices

################################################################################ WtScMat<-weightMat.ord(b=i.est$reg,gam=i.est$gam,rh=0.1961,xdat,ydat,id, tvec,corstr,link) ################################################################################

obtain the CL1 information criteria

################################################################################ out<-clic1dePar(nbcl=est.rho$m,r=est.rho$e,i.est$r,i.est$g,xdat,id,tvec,corstr,WtScMat,link,1)

godambe INVERSE GODAMBE MATRIX

Description

Inverse Godambe matrix.

Usage

godambe(param,WtScMat,xdat,ydat,id,tvec,margmodel,link) godambe.ord(param,WtScMat,xdat,ydat,id,tvec,link)

Arguments

param The weighted scores estimates of regression and not regression parameters. WtScMat A list containing the following components. omega: The array with the Ωi, i = 1 ,... , n matrices; delta: The array with the ∆i, i = 1,... , n matrices; X: The array with the Xi, i = 1,... , n matrices. xdat (x 1 , x 2 ,... , xn)>, where the matrix xi, i = 1,... , n for a given unit will de- pend on the times of observation for that unit (ji) and will have number of rows ji, each row corresponding to one of the ji elements of yi and p columns where p is the number of covariates including the unit first column to account for the intercept (except for ordinal regression where there is no intercept). This xdat matrix is of dimension (N × p), where N =

∑n i=1 ji^ is the total number of observations from all units. ydat (y 1 , y 2 ,... , yn)>, where the response data vectors yi, i = 1,... , n are of pos- sibly different lengths for different units. In particular, we now have that yi is (ji × 1 ), where ji is the number of observations on unit i. The total number of observations from all units is N =

∑n i=1 ji. The ydat are the collection of data vectors yi, i = 1,... , n one from each unit which summarize all the data together in a single, long vector of length N. id An index for individuals or clusters.

16 godambe

See Also

wtsc, solvewtsc, weightMat, wtsc.wrapper

Examples

################################################################################

Poisson regression

################################################################################ ################################################################################

read and set up the data set

################################################################################ data(childvisit)

covariates

season1<-childvisit$q season1[season1>1]<- xdat<-cbind(1,childvisit$sex,childvisit$age,childvisit$m,season1)

response

ydat<-childvisit$hosp #id id<-childvisit$id #time tvec<-childvisit$q ################################################################################

select the marginal model

################################################################################ margmodel="poisson" ################################################################################

select the correlation structure

################################################################################ corstr="exch" ################################################################################

perform CL1 estimation

################################################################################ i.est<-iee(xdat,ydat,margmodel) 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) cat("\nest.rho: CL1 estimates\n") print(est.rho$e) ################################################################################

obtain the fixed weight matrices

################################################################################ WtScMat<-weightMat(b=i.est$reg,gam=i.est$gam,rh=est.rho$e, xdat,ydat,id,tvec,margmodel,corstr) ################################################################################

obtain the weighted scores estimates

################################################################################

solve the nonlinear system of equations

ws<-solvewtsc(start=c(i.est$reg,i.est$gam),WtScMat,xdat,ydat,id, tvec,margmodel,link) cat("ws=parameter estimates\n") print(ws$r)

godambe 17

################################################################################

obtain the inverse Godambe matrix

################################################################################ acov<-godambe(ws$r,WtScMat,xdat,ydat,id,tvec,margmodel) cat("\nacov: inverse Godambe matrix with W based on first-stage wt matrices\n") print(acov) ################################################################################

Ordinal regression

################################################################################ ################################################################################

read and set up data set

################################################################################

data(arthritis) nn=nrow(arthritis) bas2<-bas3<-bas4<-bas5<-rep(0,nn) bas2[arthritis$b==2]<- bas3[arthritis$b==3]<- bas4[arthritis$b==4]<- bas5[arthritis$b==5]<- t2<-t3<-rep(0,nn) t2[arthritis$ti==3]<- t3[arthritis$ti==5]<- 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) cat("\nest.rho: CL1 estimates\n") print(est.rho$e) ################################################################################

obtain the fixed weight matrices

################################################################################ WtScMat<-weightMat.ord(b=i.est$reg,gam=i.est$gam,rh=est.rho$e,xdat,ydat,id, tvec,corstr,link) ################################################################################

obtain the weighted scores estimates

iee 19

Details

The univariate parameters are estimated from the sum of univariate marginal log-likelihoods.

Value

A list containing the following components:

coef The vector with the estimated regression parameters. gam The vector with the estimated parameters that are not regression parameters. This is NULL for Poisson and binary regression.

Author(s)

Aristidis K. Nikoloulopoulos Harry Joe

References

Cameron, A. C. and Trivedi, P. K. (1998) Regression Analysis of Count Data. Cambridge: Cam- bridge University Press.

See Also

marglik

Examples

################################################################################

read and set up data set

################################################################################ data(toenail)

covariates

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" ################################################################################

perform the IEE method

################################################################################ i.est<-iee(xdat,ydat,margmodel) cat("\niest: IEE estimates\n") print(c(i.est$reg,i.est$gam))

20 iee.ord

iee.ord Maximum Likelihood for Ordinal Model

Description

Maximum Likelihood for Ordinal Probit and Logit: Newton-Raphson minimization of negative log-likelihood.

Usage

iee.ord(x,y,link,iprint=0,maxiter=20,toler=1.e-6)

Arguments

x vector or matrix of explanatory variables. Each row corresponds to an obser- vation and each column to a variable. The number of rows of x should equal the number of data values in y, and there should be fewer columns than rows. Missing values are not allowed. y numeric vector containing the ordinal response. The values must be in the range 1,2,..., number of categories. Missing values are not allowed. link The link function.Choices are “logit” for the logit link function, and “probit” for the probit link function. iprint logical indicator, default is FALSE, for whether the iterations for numerical maximum likelihood should be printed. maxiter maximum number of Newton-Raphson iterations, default = 20. toler tolerance for convergence in Newton-Raphson iterations, default = 1.e-6.

Details

The ordinal probit model is similar to the ordinal logit model. The parameter estimate of ordinal logit are roughly 1.8 to 2 times those of ordinal probit.

Value

list of MLE of parameters and their associated standard errors, in the order cutpt1,...,cutpt(number of categ-1),b1,...b(number of covariates).

negloglik value of negative log-likelihood, evaluated at MLE gam MLE of ordered cutpoint parameters reg MLE of regression parameters cov estimated covariance matrix of the parameters

Author(s)

Aristidis K. Nikoloulopoulos Harry Joe