Skip to content

Instantly share code, notes, and snippets.

@cmrnp
Created August 31, 2022 05:36
Show Gist options
  • Save cmrnp/ae0bc850c45047465f1b3c34c4c2a1f6 to your computer and use it in GitHub Desktop.
Save cmrnp/ae0bc850c45047465f1b3c34c4c2a1f6 to your computer and use it in GitHub Desktop.
Using emmeans with metafor objects - "quick and dirty reference grid"
# Using emmeans with metafor objects - "quick and dirty reference grid"
# usage:
# emmeans(qdrg_metafor(my_metafor_object), "categorical_var")
qdrg_metafor <- function(object) {
coefs <- coef(object)
names(coefs)[1] <- "(Intercept)"
vcovs <- vcov(object)
rownames(vcovs)[1] <- "(Intercept)"
colnames(vcovs)[1] <- "(Intercept)"
qdrg(
formula = formula(object),
coef = coefs,
vcov = vcovs,
data = object$data
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment