This page illustrates the step-by-step analysis workflow for a Meridian GeoX study using code snippets. You can find detailed explanations for each process in the linked articles throughout this guide.
Load the existing design
The analysis phase begins by restoring the specific experiment parameters defined during the design phase. Loading a design from a JSON file ensures that the analysis uses the exact same geographic assignments—treatment versus control—that were optimized for the study.
# Load the existing design
loaded_design = geox.Design.load_from_json(saved_design_json)
Configure the analysis
Set up your datasets and configuration parameters before starting the analysis.
Prepare the data
Prepare the conversion and spend data in the same format as the pretest data, but ensure the analysis data includes both the pretest and test periods.
Define geox.AnalysisConfig
To execute the analysis, you must define a geox.AnalysisConfig. This
configuration specifies the design used for the experiment, including geo
splits, geo assignment rules, and methodology—such as counterfactual
modeling or time-based
regression. The analysis date range
in this configuration, the start and end dates of the experiment, must
encompass the full duration of the test period to capture the complete effect
of the campaign. If needed, you can extend analysis_end_date to include a
cooldown period.
# Set analysis config
analysis_config = geox.AnalysisConfig(
design=loaded_design,
analysis_start_date=pd.to_datetime("2020-04-01"),
analysis_end_date=pd.to_datetime("2020-04-30"),
)
Run the analysis
Finally, the geox.analyze() function processes your combined data and
configuration. It performs counterfactual
modeling to establish a synthetic
baseline of expected performance, which returns the projected conversions
under a what-if scenario without marketing interventions. By comparing
this counterfactual baseline to the actual observed performance in the
treatment groups, this function uses
robust inference to validate the
statistical significance of the incremental impact, providing the ROI or
lift generated by your campaign.
print("\nAnalyzing experiment results...")
analysis_result = geox.analyze(
analysis_data, analysis_config
)
# Returns not only point estimates, but also confidence intervals for various
# incrementality metrics.
analysis_result.results
In addition to the numerical reports, Meridian GeoX also returns time-series visualizations of these incrementality metrics. For more details, see Analysis outputs.