R/compare_etaShrinkageNlme.R

Defines functions compare_etaShrinkageNlme

Documented in compare_etaShrinkageNlme

#' @title Compare original and filtered ETA shrinkage
#'
#' @description Computes filtered overall ETA shrinkage from the stored
#'   subject-by-ETA data and returns a comparison table without modifying
#'   the \code{xpdb} object.
#'
#' @inheritParams update_etaShrinkageNlme
#'
#' @return A tibble with one row per processed ETA containing:
#'   \describe{
#'     \item{Eta}{ETA name}
#'     \item{n_total}{Total number of subjects for this ETA}
#'     \item{n_kept}{Number of subjects kept after filtering}
#'     \item{n_removed}{Number of subjects removed}
#'     \item{threshold_applied}{Resolved threshold used for this ETA}
#'     \item{original_shrinkage}{Shrinkage computed from all subjects}
#'     \item{filtered_shrinkage}{Shrinkage computed after filtering}
#'     \item{omega_sd}{Population omega standard deviation for this ETA}
#'   }
#'
#' @export
compare_etaShrinkageNlme <- function(xpdb,
                                     threshold = 1e-6,
                                     eta_threshold = NULL,
                                     eta_name = NULL,
                                     .problem = 1) {
  stopifnot(inherits(xpdb, "xpose_data"))

  eta_subject <- get_etaSubjectNlme(xpdb, .problem = .problem)
  omega_diag <- .get_omegaDiagNlme(xpdb, .problem = .problem)

  .compute_etaShrinkageNlme(
    eta_subject = eta_subject,
    omega_diag = omega_diag,
    threshold = threshold,
    eta_threshold = eta_threshold,
    eta_name = eta_name
  )
}

Try the Certara.Xpose.NLME package in your browser

Any scripts or data that you put into this service are public.

Certara.Xpose.NLME documentation built on Oct. 1, 2026, 1:08 a.m.