plot_cates_line

extensions.plots.plot_cates_line(estimated_cates, *, true_cates=None, standard_errors=None, alpha=0.05, window=30, figure_kwargs={}, line_kwargs={})

Plots a line plot of the ordered estimated CATEs as a rolling mean with optional confidence intervals.

Parameters

Name Type Description Default
estimated_cates numpy.typing.ArrayLike The estimated CATEs. required
true_cates numpy.typing.ArrayLike | None The true CATEs. None
standard_errors numpy.typing.ArrayLike | None The standard errors of the estimated CATEs. None
alpha float The alpha level for the confidence intervals. The default is 0.05, which corresponds to 95% confidence intervals. 0.05
window int The window size for the moving average. 30
figure_kwargs dict Matplotlib figure arguments. {}
line_kwargs dict Matplotlib line arguments. {}

Returns

Type Description
matplotlib.figure.Figure The line plot figure object.

Examples

import numpy as np
from caml.extensions.plots import plot_cates_line

np.random.seed(42)
true_cates = np.random.normal(0, 1, 100)
estimated_cates = true_cates + np.random.normal(0, 0.5, 100)
standard_errors = np.random.normal(0, 0.1, 100)

fig = plot_cates_line(estimated_cates, true_cates=true_cates, standard_errors=standard_errors, window=5)
fig

Back to top