Renders a self-contained, interactive HTML report for the object returned by [lago_optimization()]. The report knits a bundled parameterized R Markdown template and lays out the same sections, in the same order and with the same labels, as the console methods ([print.lago()] / [summary.lago()]): the recommended intervention, its cost, the estimated outcome (with its 95% CI) and goal, the power goal (when present), the confidence set (size, cost IQR, and first rows), the overall intervention-effect test (when present), and the fitted outcome-model coefficient table. A `sessionInfo()` footer records the environment the report was produced in.
No new statistics are computed; every value is taken verbatim from an existing field on `x` and formatted exactly as the console output formats it.
Arguments
- x
A "lago" object returned by [lago_optimization()].
- output_file
A character string. The path to write the HTML report to. If `NULL` (the default), a temporary file with a `.html` extension is used.
- title
A character string. The report title. Default value without user specification: "LAGO optimization report".
- open
A boolean. If `TRUE`, opens the rendered report in a browser via [utils::browseURL()]. Default value without user specification: `FALSE`.
- ...
Additional arguments passed to [rmarkdown::render()].
Details
The report is interactive and drawn entirely client-side with the bundled D3 v7 library (`inst/js/d3.v7.min.js`) plus `inst/js/lago-report.js`, both inlined into the HTML so the output is a single self-contained, offline file with no external asset references (no CDN, no Shiny, no additional widget frameworks). It adds two interactive views:
an interactive confidence-set plot: a hover-enabled scatter for a two-component intervention (with the recommended intervention highlighted) or a one-dimensional strip for a single component. For 3+ components, or when the interactive view is not applicable, it falls back to the static [plot.lago()] figure; when no confidence set is available the section is omitted.
interactive cost curves: for each intervention component, its total-cost curve and marginal (per-unit) cost curve, each with a hover read-out, drawn from the result's cost functions and bounds.
Rendering requires the rmarkdown, knitr, and jsonlite packages (all listed under Suggests). If they are not installed, an informative error is raised.
See also
[lago_optimization()]
Other LAGO functions:
get_confidence_set(),
lago_budget(),
lago_optimization(),
lago_sensitivity(),
visualize_cost()
Examples
# lago_report() renders an HTML file with rmarkdown, so it is wrapped in
# \dontrun: it writes to disk and invokes pandoc, and running a document
# render inside an in-process documentation build (e.g. pkgdown) can deadlock.
if (FALSE) { # \dontrun{
result <- lago_optimization(
data = BB_data,
outcome_name = "pp3_oxytocin_mother",
outcome_type = "binary",
glm_family = "binomial",
intervention_components = c("coaching_updt", "launch_duration"),
center_characteristics = c("birth_volume_100"),
center_characteristics_optimization_values = 1.75,
intervention_lower_bounds = c(1, 1),
intervention_upper_bounds = c(40, 5),
cost_list_of_vectors = list(c(0, 1700), c(0, 8000)),
outcome_goal = 0.85,
outcome_goal_intention = "maximize",
confidence_set_grid_step_size = c(1, 1),
quiet = TRUE
)
report_path <- lago_report(result)
} # }