Skip to content

Automated diagnostic report generation

Source: R/reporting.R ยท Help: ?generateDiagnosticReport

Creates a standalone report summarizing heteroscedasticity tests and diagnostic plots for a fitted model.

Usage

generateDiagnosticReport(
  model,
  data = NULL,
  output_format = "html",
  output_file = NULL,
  include_remediation = TRUE,
  include_theory = FALSE
)

Arguments

model
Fitted lm model or formula.
data
Optional data frame if model is a formula.
output_format
One of "html", "pdf", or "word".
output_file
Path to write the report to. If NULL, a name is generated automatically.
include_remediation
Logical; include remediation suggestions if TRUE.
include_theory
Logical; include background theory section.

Value

Invisibly returns the path to the generated report.

Examples

if (requireNamespace("rmarkdown", quietly = TRUE) &&
    rmarkdown::pandoc_available()) {
  model <- lm(mpg ~ wt + hp, data = mtcars)
  generateDiagnosticReport(
    model, mtcars,
    output_file = file.path(tempdir(), "diagnostic_report.html")
  )
}