ehrapy.plot.causal_effect(estimate, precision=3)[source]#

Plot the causal effect estimate.

This function plots the causal effect of treatment on outcome, assuming a linear relationship between the two. It uses the data, treatment name, outcome name, and estimate object to determine the data to plot. It then creates a plot with the treatment on the x-axis and the outcome on the y-axis. The observed data is plotted as gray dots, and the causal variation is plotted as a black line. The function then returns the plot.

  • estimate (CausalEstimate) – The causal effect estimate to plot.

  • precision (int) – The number of decimal places to round the estimate to in the plot title. Defaults to 3.


The matplotlib Axes object containing the plot.

Return type:


  • TypeError – If the estimate parameter is not an instance of dowhy.causal_estimator.CausalEstimate.

  • ValueError – If the estimation method in estimate is not supported for this plot type.