Kuan-Liu-Lab / causens

An R package for causal sensitivity analysis methods
https://kuan-liu-lab.github.io/causens/
MIT License
1 stars 0 forks source link

Add `summary` function #53

Closed larryshamalama closed 1 month ago

larryshamalama commented 4 months ago

Here is a sketch of what and how the existing code would have to be modified

causens <- function(...) {
  ...
  result <- list(estimated_ate = estimated_ate)
  class(result) <- "causens"

  return(result)
}

The following works via S3 dispatch

summary.causens <- function(causens_object, ...) {
  cat("Summary of Causal Effect Analysis\n")
  cat("=================================\n")
  cat(sprintf("Estimated Average Treatment Effect (ATE): %f\n", causens_object$estimated_ate))

  invisible(object)
}
larryshamalama commented 4 months ago

Probably good to also do this with plot