Unlike get_shk(), which parses the eta shrinkage NONMEM itself
reported in the output file, this recalculates shrinkage directly from
the individual (empirical Bayes) eta estimates found in the data, using
the standard \(100 \times (1 - SD(\eta)/\omega)\) formula, where
\(\omega\) is the standard deviation implied by the associated
diagonal omega estimate.
recalc_shk(
xpdb,
...,
.etastype = 1,
.problem = NULL,
.subprob = NULL,
.method = NULL,
drop_fixed = TRUE,
quiet
)A tibble with one row per eta, reporting the omega used, the
number of individuals excluded (if any), and the recalculated
shrinkage (as a percentage, to stay consistent with get_shk()).
<xpose_dataxpose::xpose_data> or xp_xtras object
<tidyselect> Which eta column(s) to recalculate shrinkage
for. Defaults to every eta column for .problem.
<numeric(1)> 1 (the default) excludes, for each eta,
individuals whose estimate is a "true zero" (exactly 0, as opposed to
merely shrunk near it) from the calculation; 0 keeps them. See Details.
<numeric> Problem number to use. Uses the xpose default if not provided.
<numeric> Subproblem number to use. Uses the xpose default if not provided.
<character> Method to use. Uses the xpose default if not provided.
<logical> Drop fixed etas (which have no meaningful
shrinkage to recalculate), as in xpose::drop_fixed_cols.
<logical> Silence extra debugging output
An eta is a "true zero" for an individual when NONMEM never had grounds
to move it away from its prior mean of 0, eg an individual with no
observations contributing to the objective function. That is different
from an eta that is merely shrunk close to 0 through legitimate
estimation, and including "true zero" individuals in the shrinkage
calculation biases it, since they carry no information about the actual
empirical distribution of etas. .etastype = 1 (the default) excludes
them from the calculation; .etastype = 0 reproduces the traditional,
unadjusted calculation.
recalc_shk(xpdb_x)
# Just a subset of etas...
recalc_shk(xpdb_x, ETA1)
# Including "true zero" etas in the calculation
recalc_shk(xpdb_x, .etastype = 0)
Run the code above in your browser using DataLab