Skip to content

Commit

Permalink
Use block inverse in random effects model fitting
Browse files Browse the repository at this point in the history
  • Loading branch information
melff committed Dec 14, 2024
1 parent 0f5664a commit 220dbd4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/R/mmclogit-fitPQLMQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,13 @@ PQLMQL_innerFit <- function(parms,aux,model.struct,method,estimator,control){
Phi <- lapply(Psi,safeInverse)

ZWZiSigma <- ZWZ + iSigma
K <- solve(ZWZiSigma)
if(getOption("mclogit.use_blkinv", TRUE)) {
K <- blk_inv.squareBlockMatrix(ZWZiSigma)
}
else {
K <- solve(ZWZiSigma)
}


log.det.iSigma <- Lambda2log.det.iSigma(Lambda,m)

Expand Down Expand Up @@ -558,7 +564,12 @@ PQLMQL_pseudoLogLik <- function(lambda,
iSigma <- Psi2iSigma(Psi,m)

H <- ZWZ + iSigma
K <- solve(H)
if(getOption("mclogit.use_blkinv", TRUE)) {
K <- blk_inv.squareBlockMatrix(H)
}
else {
K <- solve(H)
}

XiVX <- XWX - fuseMat(bMatCrsProd(ZWX,bMatProd(K,ZWX)))
XiVy <- XWy - fuseMat(bMatCrsProd(ZWX,bMatProd(K,ZWy)))
Expand Down

0 comments on commit 220dbd4

Please sign in to comment.