{"id":26781974,"url":"https://github.com/mwt/guide-inequalities","last_synced_at":"2025-04-19T13:41:29.256Z","repository":{"id":174285073,"uuid":"633078508","full_name":"mwt/guide-inequalities","owner":"mwt","description":"Code for \"A User's Guide for Inference in Models Defined by Moment Inequalities\"","archived":false,"fork":false,"pushed_at":"2023-07-21T00:36:32.000Z","size":1184,"stargazers_count":7,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T08:19:00.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mwt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-26T18:26:30.000Z","updated_at":"2025-02-18T14:25:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"327d10f2-0726-43a2-9b39-ec2624508cbf","html_url":"https://github.com/mwt/guide-inequalities","commit_stats":null,"previous_names":["mwt/howto-moment-eq","mwt/guide-inequalities"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwt%2Fguide-inequalities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwt%2Fguide-inequalities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwt%2Fguide-inequalities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mwt%2Fguide-inequalities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mwt","download_url":"https://codeload.github.com/mwt/guide-inequalities/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249704885,"owners_count":21313224,"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":[],"created_at":"2025-03-29T08:18:59.139Z","updated_at":"2025-04-19T13:41:29.228Z","avatar_url":"https://github.com/mwt.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Code for \"A User's Guide for Inference in Models Defined by Moment Inequalities\"\n\n**This code is not yet ready for public use.**\n\nThis repository contains the code for the paper \"A User's Guide for Inference in Models Defined by Moment Inequalities\" by Canay, Illanes, and Velez available [here](https://faculty.wcas.northwestern.edu/iac879/wp/inequalities-guide.pdf).\n\n## Structure\n\nThe code is organized into four folders:\n\n* `data` contains fake data intended to be similar to the data used in the empirical application in the paper. The data is stored in several csv files. The file [`data/README.md`](data/README.md) contains a description of the data.\n* `matlab` contains the code for the Matlab implementation of the algorithms. The file [`matlab/README.md`](matlab/README.md) contains a description of the Matlab code.\n* `python` contains the code for the Python implementation of the algorithms. The file [`python/README.md`](python/README.md) contains a description of the Python code.\n* `r` contains the code for the R implementation of the algorithms. The file [`r/README.md`](r/README.md) contains a description of the R code.\n\nIn each of the three code implementations, there is one script for each table in the paper. This script produces the output for the table. The scripts are named `table_1a.m` (or `.py` or `.R`), `table_1b.m`, etc. The scripts are self-contained and can be run independently of each other.\n\n## Outputs\n\nEach implementation produces outputs in a folder named `_results`. The results folder is not included in the repository. The results folder is created when the code is run. The results folder contains a language-specific output data file as well as a `_results/tables-tex` folder containing the tables from the paper. Each table in the paper is a separate file in the `tables-tex` folder. The tables are named `table_1.tex`, `table_2.tex`, etc. The tables are in LaTeX format and can be included in a LaTeX document. You can check the output of the code by comparing the tables in the results folder to the tables in the paper as well as in the [Tables section of this README](#tables).\n\n## Tables\n\n### Matlab tables\n\n#### Table 1\n\n##### Panel A\n\n|                  | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :--------------: | :---------: | :---------------------: | :-------------------------: | :--------: |\n| $\\bar{V}$=500  |  self-norm  |    \\[-16.0 , 23.4\\]     |      \\[-40.0 , 39.3\\]       |    45.9    |\n|                  |  bootstrap  |    \\[-13.9 , 22.4\\]     |      \\[-40.0 , 38.5\\]       |   180.0    |\n| $\\bar{V}$=1000 |  self-norm  |    \\[-40.0 , 29.1\\]     |      \\[-40.0 , 63.1\\]       |    54.4    |\n|                  |  bootstrap  |    \\[-40.0 , 26.8\\]     |      \\[-40.0 , 60.2\\]       |   216.3    |\n\n##### Panel B\n\n|                  | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :--------------: | :---------: | :---------------------: | :-------------------------: | :--------: |\n| $\\bar{V}$=500  |  self-norm  |    \\[-14.3 , 22.6\\]     |      \\[-40.0 , 35.9\\]       |    5.1     |\n|                  |  bootstrap  |    \\[-13.1 , 22.1\\]     |      \\[-40.0 , 34.8\\]       |    13.1    |\n| $\\bar{V}$=1000 |  self-norm  |    \\[-40.0 , 28.3\\]     |      \\[-40.0 , 57.4\\]       |    4.2     |\n|                  |  bootstrap  |    \\[-40.0 , 26.6\\]     |      \\[-40.0 , 54.7\\]       |    12.8    |\n\n#### Table 2\n\n|                  | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :--------------: | :---------: | :---------------------: | :-------------------------: | :--------: |\n| $\\bar{V}$=500  |  self-norm  |    \\[-21.0 , 17.1\\]     |      \\[-40.0 , 39.1\\]       |    15.1    |\n|                  |  bootstrap  |    \\[-16.0 , 14.6\\]     |      \\[-40.0 , 36.6\\]       |    41.5    |\n| $\\bar{V}$=1000 |  self-norm  |    \\[-40.0 , 17.0\\]     |      \\[-40.0 , 62.8\\]       |    14.0    |\n|                  |  bootstrap  |    \\[-40.0 , 13.9\\]     |      \\[-40.0 , 55.1\\]       |    41.5    |\n\n#### Table 3\n\n| Test Stat. | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :--------: | :---------: | :---------------------: | :-------------------------: | :--------: |\n|    CCK     |  self-norm  |   $14.2^{\\dagger}$    |      \\[-40.0 , 12.8\\]       |    25.0    |\n|   RC-CCK   |  self-norm  |    \\[-35.4 , 44.0\\]     |      \\[-40.0 , 13.8\\]       |    36.8    |\n|   RC-CCK   |  bootstrap  |    \\[-35.6 , 43.3\\]     |      \\[-40.0 , 13.0\\]       |    42.7    |\n|   RC-CCK   |    SPUR1    |    \\[-39.2 , 53.2\\]     |      \\[-40.0 , 18.4\\]       |    54.4    |\n\n#### Table 4\n\n|            |                   |                    |                     |                     |                     |\n| :--------: | :---------------: | :----------------: | :-----------------: | :-----------------: | :-----------------: |\n|            |     parameter     |       linear       |      quadratic      |       linear        |      quadratic      |\n|            | $\\theta_{1,1}$  | \\[ -22.2 , 43.7\\]  |  \\[ -22.4 , 76.7\\]  |  \\[ -40.0 , 49.6\\]  |  \\[ -40.0 , 82.0\\]  |\n|    Coca    | $\\theta_{1,2}$  | \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |\n|    Cola    | $\\theta_{1,3}$  |   \\[ 0.0 , 0.0\\]   |  \\[ -10.0 , 10.0\\]  |   \\[ 0.0 , 0.0\\]    |  \\[ -10.0 , 10.0\\]  |\n|            | $\\theta_1(\\mu)$ | \\[ -79.9 , 133.7\\] | \\[ -167.8 , 157.5\\] | \\[ -100.0 , 134.4\\] | \\[ -190.0 , 195.3\\] |\n|   Energy   | $\\theta_{2,1}$  | \\[ -40.0 , 53.6\\]  |  \\[ -40.0 , 67.6\\]  |  \\[ -40.0 , 78.2\\]  |  \\[ -40.0 , 91.6\\]  |\n|   Brands   | $\\theta_{2,2}$  | \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |  \\[ -20.0 , 50.0\\]  |\n|            | $\\theta_{2,3}$  |   \\[ 0.0 , 0.0\\]   |  \\[ -10.0 , 10.0\\]  |   \\[ 0.0 , 0.0\\]    |  \\[ -10.0 , 10.0\\]  |\n|            | $\\theta_2(\\mu)$ | \\[ -75.1 , 99.0\\]  | \\[ -105.8 , 119.9\\] | \\[ -75.1 , 126.0\\]  | \\[ -105.8 , 142.7\\] |\n| Comp. time |                   |        11.0        |        11.9         |         8.6         |         8.7         |\n\n### R tables\n\n#### Table 1\n\n##### Panel A\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------- | :-------------------------- | :--------- |\n| 500         | SN2S        | \\[-16.0, 23.0\\]         | \\[-40.0, 39.0\\]             | 6.18       |\n| 500         | EB2S        | \\[-12.0, 22.0\\]         | \\[-40.0, 38.0\\]             | 586.89     |\n| 1000        | SN2S        | \\[-40.0, 29.0\\]         | \\[-40.0, 63.0\\]             | 5.95       |\n| 1000        | EB2S        | \\[-40.0, 26.0\\]         | \\[-40.0, 60.0\\]             | 517.84     |\n\n##### Panel B\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------- | :-------------------------- | :--------- |\n| 500         | SN2S        | \\[-14.3, 22.6\\]         | \\[-40.0, 35.9\\]             | 0.99       |\n| 500         | EB2S        | \\[-11.9, 21.7\\]         | \\[-40.0, 34.6\\]             | 39.88      |\n| 1000        | SN2S        | \\[-40.0, 28.3\\]         | \\[-40.0, 57.4\\]             | 0.94       |\n| 1000        | EB2S        | \\[-40.0, 26.8\\]         | \\[-40.0, 54.1\\]             | 39.13      |\n\n#### Table 2\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------- | :-------------------------- | :--------- |\n| 500         | SN2S        | \\[-21.0, 17.1\\]         | \\[-40.0, 39.1\\]             | 1.75       |\n| 500         | EB2S        | \\[-15.3, 13.9\\]         | \\[-40.0, 36.1\\]             | 167.82     |\n| 1000        | SN2S        | \\[-40.0, 17.0\\]         | \\[-40.0, 62.8\\]             | 1.62       |\n| 1000        | EB2S        | \\[-40.0, 13.1\\]         | \\[-40.0, 54.9\\]             | 161.40     |\n\n#### Table 4\n\n|               | Parameter        | Linear           | Quadratic       | Linear          | Quadratic       |\n| :------------ | :--------------- | :--------------- | :-------------- | :-------------- | :-------------- |\n| Coca-Cola     | $\\theta_{1,1}$ | \\[-22.2, 43.7\\]  | \\[-21.9, 76.7\\] | \\[-40.0, 49.6\\] | \\[-40.0, 82.0\\] |\n|               | $\\theta_{1,2}$ | \\[-20.0, 50.0\\]  | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] |\n|               | $\\theta_{1,3}$ | \\[0.0, 0.0\\]     | \\[-10.0, 10.0\\] | \\[0.0, 0.0\\]    | \\[-10.0, 10.0\\] |\n|               | $\\theta_{1}$   | \\[-18.7, -16.3\\] | \\[-17.8, 8.6\\]  | \\[-40.0, 2.3\\]  | \\[-40.0, 14.2\\] |\n| Energy Brands | $\\theta_{2,1}$ | \\[-40.0, 53.6\\]  | \\[-40.0, 67.6\\] | \\[-40.0, 78.2\\] | \\[-40.0, 91.6\\] |\n|               | $\\theta_{2,2}$ | \\[-20.0, 50.0\\]  | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] |\n|               | $\\theta_{2,3}$ | \\[0.0, 0.0\\]     | \\[-10.0, 10.0\\] | \\[0.0, 0.0\\]    | \\[-10.0, 10.0\\] |\n|               | $\\theta_{2}$   | \\[0.0, 0.0\\]     | \\[0.0, 0.0\\]    | \\[0.0, 0.0\\]    | \\[0.0, 0.0\\]    |\n| Comp. Time    |                  | 1.20             | 1.37            | 1.35            | 1.20            |\n\n### Python tables\n\n#### Table 1\n\n##### Panel A\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------: | :-------------------------: | :--------: |\n| 500         | SN2S        |     \\[-16.0, 23.0\\]     |       \\[-40.0, 39.0\\]       |   2.346    |\n| 500         | EB2S        |     \\[-15.0, 22.0\\]     |       \\[-40.0, 39.0\\]       |  416.250   |\n| 1000        | SN2S        |     \\[-40.0, 29.0\\]     |       \\[-40.0, 63.0\\]       |   2.081    |\n| 1000        | EB2S        |     \\[-40.0, 27.0\\]     |       \\[-40.0, 61.0\\]       |  419.781   |\n\n##### Panel B\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------: | :-------------------------: | :--------: |\n| 500         | SN2S        |     \\[-14.3, 22.6\\]     |       \\[-40.0, 35.9\\]       |   1.045    |\n| 500         | EB2S        |     \\[-13.7, 22.3\\]     |       \\[-40.0, 34.5\\]       |   30.341   |\n| 1000        | SN2S        |     \\[-40.0, 28.3\\]     |       \\[-40.0, 57.4\\]       |   0.769    |\n| 1000        | EB2S        |     \\[-40.0, 27.4\\]     |       \\[-40.0, 54.1\\]       |   30.521   |\n\n#### Table 2\n\n| $\\bar{V}$ | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :---------- | :---------- | :---------------------: | :-------------------------: | :--------: |\n| 500         | SN2S        |     \\[-21.0, 17.1\\]     |       \\[-40.0, 39.1\\]       |   1.374    |\n| 500         | EB2S        |     \\[-17.3, 15.3\\]     |       \\[-40.0, 36.5\\]       |  121.747   |\n| 1000        | SN2S        |     \\[-40.0, 17.0\\]     |       \\[-40.0, 62.8\\]       |   1.148    |\n| 1000        | EB2S        |     \\[-40.0, 13.8\\]     |       \\[-40.0, 54.8\\]       |  120.689   |\n\n#### Table 3\n\n| Test Stat. | Crit. Value | $\\theta_1$: Coca-Cola | $\\theta_2$: Energy Brands | Comp. Time |\n| :--------- | :---------- | :---------------------: | :-------------------------: | :--------: |\n| CCK        | SN2S        |      \\[nan, 14.2\\]      |       \\[-40.0, 12.8\\]       |   0.987    |\n| RC-CCK     | SN2S        |     \\[-35.4, 44.0\\]     |       \\[-40.0, 13.8\\]       |   1.193    |\n| RC-CCK     | EB2S        |     \\[-36.5, 43.4\\]     |       \\[-40.0, 12.6\\]       |   31.191   |\n| RC-CCK     | SPUR1       |     \\[-40.0, 54.5\\]     |       \\[-40.0, 18.3\\]       |  183.142   |\n\n#### Table 4\n\n|               | Parameter        | Linear           | Quadratic       | Linear          | Quadratic       |\n| :------------ | :--------------- | :--------------- | :-------------- | :-------------- | :-------------- |\n| Coca-Cola     | $\\theta_{1,1}$ | \\[-22.2, 43.7\\]  | \\[-22.4, 76.7\\] | \\[-40.0, 49.6\\] | \\[-40.0, 82.0\\] |\n|               | $\\theta_{1,2}$ | \\[-20.0, 50.0\\]  | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] |\n|               | $\\theta_{1,3}$ | \\[0.0, 0.0\\]     | \\[-10.0, 10.0\\] | \\[0.0, 0.0\\]    | \\[-10.0, 10.0\\] |\n|               | $\\theta_{1}$   | \\[-18.7, -16.3\\] | \\[-17.8, 8.6\\]  | \\[-40.0, 2.3\\]  | \\[-40.0, 14.2\\] |\n| Energy Brands | $\\theta_{2,1}$ | \\[-40.0, 53.6\\]  | \\[-40.0, 67.6\\] | \\[-40.0, 78.2\\] | \\[-40.0, 91.6\\] |\n|               | $\\theta_{2,2}$ | \\[-20.0, 50.0\\]  | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] | \\[-20.0, 50.0\\] |\n|               | $\\theta_{2,3}$ | \\[0.0, 0.0\\]     | \\[-10.0, 10.0\\] | \\[0.0, 0.0\\]    | \\[-10.0, 10.0\\] |\n|               | $\\theta_{2}$   | \\[0.0, 0.0\\]     | \\[0.0, 0.0\\]    | \\[0.0, 0.0\\]    | \\[0.0, 0.0\\]    |\n| Comp. Time    |                  | 0.518            | 0.832           | 0.707           | 0.736           |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwt%2Fguide-inequalities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmwt%2Fguide-inequalities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmwt%2Fguide-inequalities/lists"}