| normalize_etas | R Documentation |
Sets xpdb$normalize_etas, a top-level slot (alongside eg $covs, see
add_cov_association()) consumed by eta_grid()/
eta_vs_cov_grid()/eta_vs_contcov()/eta_vs_catcov(): each
selected eta is divided by its typical scale – by default the standard
deviation implied by its associated diagonal omega estimate
(sqrt(omega)), same as recalc_shk() uses – before being plotted,
so etas modeled on very different scales (eg a normally-distributed eta
next to a log-normal one with a much larger omega) can be compared on
one shared plot without the larger-scale eta dominating.
normalise_etas() is an alias, for the British/rest-of-world spelling.
normalize_etas(
xpdb,
...,
.use_sd = FALSE,
.problem = NULL,
.subprob = NULL,
.method = NULL,
quiet
)
normalise_etas(
xpdb,
...,
.use_sd = FALSE,
.problem = NULL,
.subprob = NULL,
.method = NULL,
quiet
)
xpdb |
< |
... |
< |
.use_sd |
< |
.problem |
< |
.subprob |
< |
.method |
< |
quiet |
< |
This only ever affects how those four plotting functions display
etas – it never modifies xpdb$data, so get_data()
and every other consumer of the eta columns keep seeing the raw
(unnormalized) values.
$normalize_etas is a plain top-level slot rather than an xpdb$options
entry – unlike most options, its value is one number per eta rather
than a single setting, and folding a handful of high-precision numbers
per eta into print.xpose_data()'s single-line Options: summary
made that summary unreadable for models with more than a couple of
etas.
The default (omega-based) scale relies on the same internal
name/numbering match between eta columns and diagonal omega estimates
(see recalc_shk()'s Details for when that can fail, eg unconventional
eta naming that isn't a nlmixr2-style direct match to a parameter
table name and also doesn't follow NONMEM's ETA<k>/ETA(k)
numbering). When that match fails, or there simply is no reliable
omega for these etas (eg a hand-built or simulated xpdb),
.use_sd = TRUE sidesteps it entirely, scaling by the empirical
standard deviation of each eta's own individual estimates instead –
at the cost of that scale itself being sample-dependent (and shrinkage-
deflated) rather than reflecting the model's estimated random-effect
variance.
Calling normalize_etas() again merges into (rather than replacing)
any previously-set factors, via utils::modifyList() – so ... can
be used to (re)compute just a subset of etas, eg after refitting. To
turn normalization off again, assign directly: xpdb$normalize_etas$ETA1 <- NULL for a single eta, or xpdb$normalize_etas <- NULL for all of
them.
xp_xtras object, with the computed factors set under
$normalize_etas (not $options – see Details)
recalc_shk(), which uses the same omega-matching logic
xpdb_norm <- normalize_etas(xpdb_x)
eta_grid(xpdb_norm)
# Just a subset of etas...
normalize_etas(xpdb_x, ETA1)
# By empirical SD instead, eg if the omega match fails or is unreliable
normalize_etas(xpdb_x, .use_sd = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.