diff --git a/DESCRIPTION b/DESCRIPTION index 7272d09..787049f 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,7 @@ Depends: tern (>= 0.9.5) Imports: checkmate (>= 2.1.0), - emmeans (>= 1.4.5), + emmeans (>= 1.10.4), formatters (>= 0.5.8), geeasy, geepack, diff --git a/NEWS.md b/NEWS.md index b17ef98..912e67c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # tern.gee 0.1.4.9004 +* Up version `emmeans` package version to 1.10.4. + # tern.gee 0.1.4 * Change package maintainer to Joe Zhu. diff --git a/R/lsmeans.R b/R/lsmeans.R index 0fef130..18e57f2 100644 --- a/R/lsmeans.R +++ b/R/lsmeans.R @@ -4,6 +4,7 @@ #' @param conf_level (`proportion`)\cr confidence level #' @param weights (`string`)\cr type of weights to be used for the least square means, #' see [emmeans::emmeans()] for details. +#' @param specs (`string` or `formula`) specifications passed to [emmeans::emmeans()] #' @param ... additional arguments for methods #' #' @return A `data.frame` with least-square means and contrasts. Additional @@ -21,6 +22,7 @@ lsmeans <- function(object, conf_level = 0.95, weights = "proportional", + specs = object$vars$arm, ...) { UseMethod("lsmeans", object) } @@ -30,8 +32,8 @@ lsmeans <- function(object, lsmeans.tern_gee_logistic <- function(object, conf_level = 0.95, weights = "proportional", + specs = object$vars$arm, ...) { - specs <- as.formula(paste("~", object$vars$arm)) prop_emm <- emmeans::emmeans( object = object, specs = specs, @@ -41,7 +43,7 @@ lsmeans.tern_gee_logistic <- function(object, ) prop_df <- cbind( - data.frame(stats::confint(prop_emm))[, c(object$vars$arm, "prob", "SE", "asymp.LCL", "asymp.UCL")], + data.frame(stats::confint(prop_emm))[, c(object$vars$arm, "prob", "SE", "lower.CL", "upper.CL")], n = as.list(prop_emm)$extras[, ".wgt."] ) names(prop_df) <- c(object$vars$arm, "prop_est", "prop_est_se", "prop_lower_cl", "prop_upper_cl", "n") @@ -57,7 +59,7 @@ lsmeans.tern_gee_logistic <- function(object, or_df <- or_df[or_df$comparator == ref_level, ] or_df <- rbind(NA, or_df) or_df[1L, object$vars$arm] <- ref_level - or_df <- or_df[, c(object$vars$arm, "odds.ratio", "asymp.LCL", "asymp.UCL")] + or_df <- or_df[, c(object$vars$arm, "odds.ratio", "lower.CL", "upper.CL")] or_df <- cbind(or_df, log(or_df[, -1L]), conf_level) names(or_df) <- c( object$vars$arm, diff --git a/man/lsmeans.Rd b/man/lsmeans.Rd index 210a3df..bf22a95 100644 --- a/man/lsmeans.Rd +++ b/man/lsmeans.Rd @@ -5,9 +5,21 @@ \alias{lsmeans.tern_gee_logistic} \title{Extract Least Square Means from a GEE Model} \usage{ -lsmeans(object, conf_level = 0.95, weights = "proportional", ...) +lsmeans( + object, + conf_level = 0.95, + weights = "proportional", + specs = object$vars$arm, + ... +) -\method{lsmeans}{tern_gee_logistic}(object, conf_level = 0.95, weights = "proportional", ...) +\method{lsmeans}{tern_gee_logistic}( + object, + conf_level = 0.95, + weights = "proportional", + specs = object$vars$arm, + ... +) } \arguments{ \item{object}{(\code{tern_gee})\cr result of \code{\link[=fit_gee]{fit_gee()}}.} @@ -17,6 +29,8 @@ lsmeans(object, conf_level = 0.95, weights = "proportional", ...) \item{weights}{(\code{string})\cr type of weights to be used for the least square means, see \code{\link[emmeans:emmeans]{emmeans::emmeans()}} for details.} +\item{specs}{(\code{string} or \code{formula}) specifications passed to \code{\link[emmeans:emmeans]{emmeans::emmeans()}}} + \item{...}{additional arguments for methods} } \value{