Skip to contents

This function interprets the output of causal effect analysis, providing a compact report. It only reports coefficients and E-values with **Evidence** or **Strong evidence** for causality. The language is suitable for scientific reports, avoiding explanations of treatment effects and E-values. Each outcome's interpretation starts with a separate paragraph heading using `####`. Additionally, it includes a final paragraph indicating that all other effect estimates presented either weak or unreliable evidence for causality.

Usage

margot_interpret_marginal(
  df,
  type = c("RD", "RR"),
  order = "alphabetical",
  original_df = NULL
)

Arguments

df

Data frame containing causal effect estimates. Expected to include columns for outcome names, effect estimates, confidence intervals, E-values, and summary labels. Can also be the list output from `transform_to_original_scale()`.

type

Character string specifying the type of effect estimate. Must be either "RD" (Risk Difference) or "RR" (Risk Ratio). Default is "RD".

order

Character string specifying the order of results. Default is "alphabetical". - `"alphabetical"`: Orders outcomes alphabetically. - `"magnitude"`: Orders outcomes by the absolute magnitude of the effect size in descending order.

original_df

Optional data frame for back-transforming estimates to the original scale.

Value

A list containing one element:

interpretation

A character string containing a compact interpretation of each outcome in `df`, including separate paragraph headings and sentence-cased descriptions, followed by a concluding paragraph if applicable.

Examples

if (FALSE) { # \dontrun{
# Assuming `group_tab_output` is the result from a causal analysis
result <- margot_interpret_marginal(group_tab_output, type = "RD")
cat(result$interpretation)

# Using Risk Ratio without specifying an estimand
result <- margot_interpret_marginal(group_tab_output, type = "RR")

# Using output from transform_to_original_scale()
transformed_data <- transform_to_original_scale(results_df, original_df, label_mapping)
result <- margot_interpret_marginal(transformed_data, type = "RD")
} # }