{"id":13710239,"url":"https://github.com/google/matched_markets","last_synced_at":"2025-05-06T18:34:39.644Z","repository":{"id":40782548,"uuid":"309912962","full_name":"google/matched_markets","owner":"google","description":"Matched Markets is a Python library for design and analysis of Geo experiments using Matched Markets and Time Based Regression.","archived":false,"fork":false,"pushed_at":"2023-12-05T16:23:21.000Z","size":1458,"stargazers_count":67,"open_issues_count":5,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-03T23:18:09.022Z","etag":null,"topics":["geoexperiments","power-analysis","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-04T06:39:02.000Z","updated_at":"2024-07-04T20:09:47.000Z","dependencies_parsed_at":"2023-01-28T22:01:02.945Z","dependency_job_id":null,"html_url":"https://github.com/google/matched_markets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fmatched_markets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fmatched_markets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fmatched_markets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fmatched_markets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/matched_markets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224521653,"owners_count":17325274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geoexperiments","power-analysis","statistics"],"created_at":"2024-08-02T23:00:53.449Z","updated_at":"2024-11-13T20:31:32.200Z","avatar_url":"https://github.com/google.png","language":"Python","funding_links":[],"categories":["Geo Experimentation"],"sub_categories":[],"readme":"# A Time-Based Regression Matched Markets Approach for Designing Geo Experiments\n\nCopyright (C) 2020 Google LLC. License: Apache 2.0\n\n## Disclaimer\n\nThis is not an officially supported Google product. For research purposes only.\n\n## Description\n\nRandomized experiments (Vaver \u0026 Koehler, 2010) have been recognized as the\ngold standard to measure the causal effect of advertising, but how to design\nand analyze them properly is a non-trivial statistical problem.\nGeo experiments have the advantage of being privacy safe. However, in geo experiments, it may\nnot always be possible to rely on randomization to create balanced groups due to\nthe geo heterogeneity, the small number of units, and/or constraints that the\nadvertisers want to impose, such as including certain geos in a specific\nexperimental group. Hence, Au (2018) introduced a greedy search algorithm to\nfind the best experimental groups among those that satisfy:\n  * the constraints imposed by the advertiser (budget, geo assignments, ...)\n  * the assumptions of Time Based Regression (Kerman, 2017)\n\nThis directory contains\n\n  * Python package for geo experiment design using Time Based Regression and Matched Markets.\n\n  * Python package for geo experiment post analysis using Time Based Regression.\n\n  * Colab demos for design and post analysis, separately.\n\n## Installation\n\n## Usage\n\nFor Python programming, here is an example usage.\n\n```python\nimport itertools\nimport numpy as np\nimport pandas as pd\nfrom matched_markets.methodology.tbrmmdata import TBRMMData\nfrom matched_markets.methodology.tbrmatchedmarkets import TBRMatchedMarkets\nfrom matched_markets.methodology.tbrmmdiagnostics import TBRMMDiagnostics\nfrom matched_markets.methodology.tbrmmdesignparameters import TBRMMDesignParameters\n\nn_geos = 5\nn_days = 21\ngeos = {str(geo) for geo in range(n_geos)}\ndates = pd.date_range('2020-03-01', periods=n_days)\ndf_data = [{'date': date, 'geo': geo} for geo, date in\n           itertools.product(geos, dates)]\ndf = pd.DataFrame(df_data)\nresponse_column = 'sales'\n\n# Create sales data.\ndef day_geo_sales(geo, n_days):\n  # Larger geos have different means and variances.\n  return [\n      100 * geo + 10 * geo * day + day + np.random.randint(10)\n      for day in range(n_days)\n  ]\n\ndf[response_column] = 0.0\nfor geo in geos:\n  sales_time_series = day_geo_sales(int(geo), n_days)\n  df.loc[df.geo == geo, response_column] = sales_time_series\n\nparameters = TBRMMDesignParameters(n_test=14, iroas=3.0,\n                                   budget_range=(0.1, 300000))\ndata = TBRMMData(df, response_column)\n\nmm = TBRMatchedMarkets(data, parameters)\ndesigns = mm.greedy_search()\n\n```\n\nWithout programming, the best way to learn how to use the package is probably by\nfollowing one of the notebooks, and the recommended way of opening them is\nGoogle Colaboratory.\n\n* Design a Matched Markets geo experiment.\n   - [GeoX Design with Matched Markets and TBR](https://colab.sandbox.google.com/github/google/matched_markets/blob/master/matched_markets/notebook/design_colab_for_tbrmm.ipynb).\n* Post analysis of a geo experiment from a Matched Markets design\n   - [GeoX Post Analysis with TBR](https://colab.sandbox.google.com/github/google/matched_markets/blob/master/matched_markets/notebook/post_analysis_colab_for_tbrmm.ipynb).\n\n## Contribution\n\n## References\n\nAvailable at\n[Matched Markets paper](https://research.google/pubs/pub48983/).\n[TBR paper](https://research.google/pubs/pub45950/).\n[GeoX paper](https://research.google/pubs/pub38355/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fmatched_markets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fmatched_markets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fmatched_markets/lists"}