pyssed
  • Reference

MADBase

MADBase(self, bandit, alpha, delta, t_star, model=None, n_warmup=1, pooled=True)

Base class that includes methods for both the pyssed.MAD and pyssed.MADMod classes.

Methods

Name Description
estimates Extract estimated ATEs and confidence sequences.
fit Fit the MAD algorithm for the full time horizon.
plot_ate Plot the ATE and CSs for each arm at the current time step.
plot_ate_path Plot the ATE and CS paths for each arm of the experiment.
plot_ites Plot the estimated individual treatment effects (ITEs).
plot_n Plot the total N assigned to each arm.
plot_probabilities Plot the arm assignment probabilities across time.
plot_sample Plot sample assignment to arms across time
summary Print a summary of ATEs and confidence bands.

estimates

MADBase.estimates()

Extract estimated ATEs and confidence sequences.

Returns

Name Type Description
pandas.DataFrame A dataframe of ATE estimates and corresponding CS lower and upper bounds.

fit

MADBase.fit(
    early_stopping=True,
    cs_precision=0.1,
    mc_adjust='Bonferroni',
    verbose=True,
    **kwargs,
)

Fit the MAD algorithm for the full time horizon.

Parameters

Name Type Description Default
early_stopping bool Whether or not to stop the experiment early when all the arms have statistically significant ATEs. True
cs_precision float This parameter controls how precise we want to make our Confidence Sequences (CSs). If cs_precision = 0 then the experiment will stop immediately as soon as all arms are statistically significant. If cs_precision = 0.2 then the experiment will run until all CSs are at least 20% tighter (shorter) than they were when they became statistically significant. If cs_precision = 0.4 the experiment will run until all CSs are at least 40% tighter, and so on. 0.1
mc_adjust str The type of multiple comparison correction to apply to the constructed CSs. Default is “Bonferroni” (currently “Bonferroni” or None are the only supported options). 'Bonferroni'
verbose bool Whether to print progress of the algorithm True
**kwargs Any Keyword arguments to pass directly to the self.pull method. For more details see the documentation for that method. {}

Returns

Name Type Description
None

plot_ate

MADBase.plot_ate()

Plot the ATE and CSs for each arm at the current time step.

Returns

Name Type Description
plotnine.ggplot

plot_ate_path

MADBase.plot_ate_path()

Plot the ATE and CS paths for each arm of the experiment.

Returns

Name Type Description
plotnine.ggplot

plot_ites

MADBase.plot_ites(arm, type='boxplot', **kwargs)

Plot the estimated individual treatment effects (ITEs).

Parameters

Name Type Description Default
arm int The index of the arm for which to plot ITE estimates. required
type str The type of plot. Must be one of ‘boxplot’, ‘density’, or ‘histogram’. 'boxplot'
**kwargs Keyword arguments to pass directly to the geom_{plot_type}() call. {}

plot_n

MADBase.plot_n()

Plot the total N assigned to each arm.

Returns

Name Type Description
plotnine.ggplot

plot_probabilities

MADBase.plot_probabilities()

Plot the arm assignment probabilities across time.

Returns

Name Type Description
plotnine.ggplot

plot_sample

MADBase.plot_sample()

Plot sample assignment to arms across time

Returns

Name Type Description
plotnine.ggplot

summary

MADBase.summary()

Print a summary of ATEs and confidence bands.

Returns

Name Type Description
None
 

Built by Daniel Molitor