@@ -178,7 +178,8 @@ multilevelGPSMatch<-function(Y,W,X,Trimming,GPSM="multinomiallogisticReg"){
178
178
X11 <- matrix (X [Matchmat [,c(thiscnames )],(jj - 1 )],ncol = 2 ,byrow = FALSE )
179
179
mX11 <- apply(X11 ,1 ,mean )
180
180
C1.X1Y <- apply((X11 - mX11 )* (Y11 - mY11 ),1 ,sum )
181
- C1.X1Y <- C1.X1Y * (- PF.fit [,kk + 1 ])
181
+ if (kkk == (kk + 1 )){C1.X1Y <- C1.X1Y * (1 - PF.fit [,kk + 1 ])}
182
+ else if (kkk != (kk + 1 ))C1.X1Y <- C1.X1Y * (- PF.fit [,kk + 1 ])
182
183
Cmat [,(dim(X )[2 ]+ 1 )* (kk - 1 )+ jj ]<- C1.X1Y
183
184
}
184
185
}
@@ -190,7 +191,7 @@ multilevelGPSMatch<-function(Y,W,X,Trimming,GPSM="multinomiallogisticReg"){
190
191
for (kk in (jj + 1 ): trtnumber ){
191
192
thistrt <- trtlevels [jj ]
192
193
thattrt <- trtlevels [kk ]
193
- cname1 <- c(cname1 , paste(paste(paste(paste(paste(" EY(" ,thattrt ,sep = " " )," )" ,sep = " " )," -EY(" ,sep = " " ),thistrt ,sep = " " )," )" ,sep = " " ))
194
+ cname1 <- c(paste(paste(paste(paste(paste(" EY(" ,thattrt ,sep = " " )," )" ,sep = " " )," -EY(" ,sep = " " ),thistrt ,sep = " " )," )" ,sep = " " ))
194
195
varestimateAI2012 [cname1 ]<- varestimate [cname1 ]-
195
196
t(Cvec [jj ,]+ Cvec [kk ,])%*% vcov_coeff %*% (Cvec [jj ,]+ Cvec [kk ,])
196
197
}
0 commit comments