Skip to content

Commit

Permalink
Add proper names to 'vcov' list elements in ranef.rma.mv().
Browse files Browse the repository at this point in the history
  • Loading branch information
wviechtb committed Nov 20, 2024
1 parent 6aeb8da commit 02056a0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions R/ranef.rma.mv.r
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ranef.rma.mv <- function(object, level, digits, transf, targs, verbose=FALSE, ..
#########################################################################

out <- NULL
vcov <- NULL

if (verbose)
message(mstyle$message("\nComputing the inverse marginal var-cov and hat matrix ... "), appendLF = FALSE)
Expand Down Expand Up @@ -83,6 +84,9 @@ ranef.rma.mv <- function(object, level, digits, transf, targs, verbose=FALSE, ..
out <- vector(mode="list", length=x$sigma2s)
names(out) <- x$s.names

vcov <- vector(mode="list", length=x$sigma2s)
names(vcov) <- x$s.names

for (j in seq_len(x$sigma2s)) {

if (verbose)
Expand Down Expand Up @@ -128,7 +132,7 @@ ranef.rma.mv <- function(object, level, digits, transf, targs, verbose=FALSE, ..
out[[j]] <- pred

if (isTRUE(ddd$vcov))
vcov <- c(vcov, list(vpred))
vcov[[j]] <- vpred

}

Expand Down Expand Up @@ -223,15 +227,16 @@ ranef.rma.mv <- function(object, level, digits, transf, targs, verbose=FALSE, ..

pred <- pred[r.order,]

out <- c(out, list(pred))
#names(out)[length(out)] <- paste(x$g.names, collapse=" | ")
names(out)[length(out)] <- paste0(x$formulas[[1]], collapse="")

if (isTRUE(ddd$vcov)) {
vpred <- vpred[r.order, r.order]
vcov <- c(vcov, list(vpred))
names(vcov)[length(vcov)] <- paste0(x$formulas[[1]], collapse="")
}

out <- c(out, list(pred))
#names(out)[length(out)] <- paste(x$g.names, collapse=" | ")
names(out)[length(out)] <- paste0(x$formulas[[1]], collapse="")

if (verbose)
message(mstyle$message("Done!"))

Expand Down Expand Up @@ -294,15 +299,16 @@ ranef.rma.mv <- function(object, level, digits, transf, targs, verbose=FALSE, ..

pred <- pred[r.order,]

out <- c(out, list(pred))
#names(out)[length(out)] <- paste(x$h.names, collapse=" | ")
names(out)[length(out)] <- paste0(x$formulas[[2]], collapse="")

if (isTRUE(ddd$vcov)) {
vpred <- vpred[r.order, r.order]
vcov <- c(vcov, list(vpred))
names(vcov)[length(vcov)] <- paste0(x$formulas[[2]], collapse="")
}

out <- c(out, list(pred))
#names(out)[length(out)] <- paste(x$h.names, collapse=" | ")
names(out)[length(out)] <- paste0(x$formulas[[2]], collapse="")

if (verbose)
message(mstyle$message("Done!"))

Expand Down

0 comments on commit 02056a0

Please sign in to comment.