Format a probability (point estimate or CI bound) according to a chosen
representation mode. Allowed modes are "linear_G", "log_G",
"log_Q", and "undefined". The function performs no inference;
it only formats the numeric values already computed (linear and log).
Notes on arguments:
log_g, log_q, ci_log_g, ci_log_q are
natural logarithms (from log() in R).
For "log_Q": the upper bound for \(G\) uses
ci_log_q[1] and the lower bound uses ci_log_q[2].
This ordering reflects that \(Q = 1-G\) decreases as \(G\) increases.
format_by_mode(
mode,
kind,
linear_g,
log_g,
log_q,
ci_linear_g,
ci_log_g,
ci_log_q,
digits
)A character scalar formatted for display. Returns "NA" if the
required value is non-finite or missing.
Character scalar. One of "linear_G", "log_G",
"log_Q", "undefined".
Character scalar. One of "point", "lower",
"upper".
Numeric scalar. Point estimate on the linear scale.
Numeric scalar. log(G) (natural log). May be non-finite.
Numeric scalar. log(Q) with \(Q=1-G\) (natural log).
May be non-finite.
Numeric length-2: c(lower, upper) for \(G\).
Numeric length-2: c(lower_logG, upper_logG).
Numeric length-2: c(upper_logQ, lower_logQ).
Integer. Significant digits for numeric formatting.
Hiroshi Hakoyama, hiroshi.hakoyama@gmail.com