diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cabc..00000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.github/workflows/build_adodown_site.yaml b/.github/workflows/build_adodown_site.yaml new file mode 100644 index 00000000..b03740c4 --- /dev/null +++ b/.github/workflows/build_adodown_site.yaml @@ -0,0 +1,71 @@ +on: + push: + branches: [main, dev] + +name: Build Site + +jobs: + adodownr: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + + - name: Checkout project + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v3 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install Quarto + uses: quarto-dev/quarto-actions/setup@v2 + with: + version: 1.0.37 + + - name: Install dependencies + run: | + sudo apt-get install -y make libcurl4-openssl-dev libssl-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjpeg-dev libpng-dev libtiff-dev libicu-dev pandoc libxml2-dev libgit2-dev libssh2-1-dev zlib1g-dev git + + - name: Install devtools + run: install.packages("devtools") + shell: Rscript {0} + + - name: Install adodownr + run: devtools::install_github("lsms-worldbank/adodownr") + shell: Rscript {0} + + - name: Install here + run: install.packages("here") + shell: Rscript {0} + + - name: Build site + run: adodownr::build_site(pkg_dir = here::here(), site_dir = here::here()) + shell: Rscript {0} + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./docs + + deploy: + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + runs-on: ubuntu-latest + needs: adodownr + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.gitignore b/.gitignore index 85f00d26..786e532e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ######################################################################## # -# This .gitignore file is based on DIME's template -# https://github.com/worldbank/DIMEwiki/tree/master/Topics/GitHub +# Created using adodown https://lsms-worldbank.github.io/adodown/, based on DIME .gitignore template: +# https://github.com/worldbank/dime-github-trainings/tree/main/GitHub-resources/DIME-GitHub-Templates # ######################################################################## @@ -17,14 +17,18 @@ # These files include GitHub settings !.gitignore !.gitattributes -#.io page -_config.yml -!reproot.yaml +!.github/**/*.yaml + +# Git placeholder file (to commit empty folders) +!/**/*.gitkeep # Keep markdown files used for documentation on GitHub !README.md !CONTRIBUTING.md -!LICENSE +!LICENSE* + +* Unignore reproot files +!reproot*.yaml ####################### # For performance reasons, if a folder is already ignored, then @@ -36,44 +40,28 @@ _config.yml ####################### # The following file types are code that should always be -# included no matter where in the DataWork folder they are -# located unless that folder is explicitly ignored. See example -# with EncryptedData folder below. +# included no matter where in the repository folder they are +# located unless you explicitly ignore that folder # Stata !/**/*.do !/**/*.ado -!/**/*.sthlp -!/**/*.stpr - -# R -!/**/*.R - -# Outputs -!/**/*.tex -!/**/*.csv +!/**/sthlp/*.sthlp +!src/stata.toc +!src/*.pkg -# Python -!/**/*.py - -# Matlab -!/**/*.m - -# Markdown +# Markdown and web docs files !/**/*.md +!src/dev/**/*.png +!src/dev/**/*.css -# The folder test/ is used for peoples individual testing, -# this is different from the test scripts in the folder run/ -test/ +#################################### +# Ignore ssc outputs +src/dev/ssc -########### -# Outputs in the run/outputs folder -!/**/outputs/**/*.csv - -# ignore all iegitaddmd output, results tested with checksums -/**/iegitaddmd/outputs/ +# Ignore test inputs and outputs +src/tests/**/inputs/ +src/tests/**/outputs/ * Ignore the local dev env set up by repado -run/dev-env/ - -run/ieboilstart/ado-test/ +src/tests/dev-env/ diff --git a/admin/checklist-submitting-SSC.md b/admin/checklist-submitting-SSC.md deleted file mode 100644 index 9ceb5bfe..00000000 --- a/admin/checklist-submitting-SSC.md +++ /dev/null @@ -1,105 +0,0 @@ -# Checklist for submitting new versions to SSC - -- [ ] 1. **Decide on new version number** - - Look up the current version number. It will be on the format `vX.Y`. - - If the next release is a major update, decide on the new version number by incrementing the `X` value with 1 and set the `Y` value to 0. - - If the new release is a small update, decide on the new version number by keeping `X` as is, and incrementing the `Y` value with 1. - - If needed the values can be made double digits and be on format `vXX.YY`. - - -- [ ] 2. **Copy this checklist to an issue** - - On this page, click the `Raw` button and copy all the content of this page into an issue. Call this issue "_Release checklist for vX.Y_". Replace "X.Y" with the version number of the current release. Use this issue to keep track of the progress for this release. - - -- [ ] 3. **Manage milestones** - - Edit the name of milestone called `next-release`. Name it `vX.Y`. Replace "X.Y" with the version number of the current release. - - Create a new milestone and give that milestone the name `next-release` - - -- [ ] 4. **Merge milestone to `develop`** - - Make sure that all fixed issues added to the milestone now called `vX.Y` are merged to the `develop` branch - - For any issues not yet fixed, decide to either: - - Fix it before continuing with this release - - Move that issue to the `next-release` milestone - - -- [ ] 5. **Create version branch `vX.Y`** - - This branch _MUST_ be created from the `main` branch. Name this branch `vX.Y` where you replace "X.Y" with the version number of the current release. - - -- [ ] 6. **Merge `develop` to the version branch** - - Solve all the conflicts in the `vX.Y` branch and then make sure that the sub-steps in this step are done in the `vX.Y` branch and nowhere else. - - [ ] 6.1 **Test in different operative systems** - This step is not necessary every time, but testing the commands in Stata on each of the PC, Mac and Linux operative systems should be done from time to time. A particularly good time to do this is after writing or editing code that depends on file paths, the console, special settings etc. If testing fails, do one of the following: - - If a smaller update is required, then make the update in the _version_ branch - - If a larger update is required, or if the scale of the required update is not clear, then: - - Create an issue describing the failed test - - Create a new branch from the `develop` branch and make the required update there - - Once the issue is fixed, merge the new branch to `develop` and then merge `develop` again to the _version_ branch - - [ ] 6.2 **Update version and date** - In the `vX.Y` branch, update the version number and date in all ado-files and all dates in all help files. See section below for details. - - [ ] 6.3 **Update version locals in ietoolkit** - In the _ietoolkit.ado_ file in the `vX.Y` branch, update the _version_ and _versionDate_ locals at the top of the file. - - [ ] 6.4 **Update version in .pkg and .toc** - This has nothing to do with SSC but should be kept up to date to. This is for when people install directly through GitHub using `net install`. If any new command has been added, remember to add the files for that command to the `.pkg` file. - - -- [ ] 7 **Create a .zip file** - - Create a .zip file with all ado-files and help files only. These files are not allowed to be in a sub-folder in this .zip file. No other files should be in this folder. - - -- [ ] 8. **Email Prof. Baum** - - [ ] 8.1 - If any commands are added or deleted, make note of that in the email. - - [ ] 8.2 - If any of the meta info (title, description, keywords, version or author/contact) has changed then include those updates in your email. - - Email the .zip file created in the previous step to **kit.baum@bc.edu**. - - -- [ ] 9. **Draft release note** - - Go to the [release notes](https://github.com/worldbank/ietoolkit/releases) and draft a new release note for the new version. Follow the format from previous releases with links to [issues](https://github.com/worldbank/ietoolkit/issues) solved. - - -- [ ] 10. **Wait for publication confirmation** - - Do not proceed pass this step until Prof. Baum has confirmed that the new version is uploaded to the servers. - - -- [ ] 11. **Merge `vX.Y` branch to `main`** - - If step 2 and 3 was done correctly, then there should not be any merge conflicts in this step. Once merged, delete the `vX.Y` branch. - - -- [ ] 12. **Close issues** - - When the new version is up, close all the [issues](https://github.com/worldbank/ietoolkit/issues) that was solved in the new version. - - -- [ ] 13. **VERY IMPORTANT STEP - Update `develop` and feature branches** - - [ ] 13.1 **Update `develop` from `main`** - - This step brings edits done in the `vX.Y` branch and `main` branch during the release into the `develop` branch. This can either be done with a rebase (more advances, but cleaner history) or a merge (less advance, but messier history). - - _Rebase_: Rebase the `develop` branch onto `main`. The effect is that it looks as if the `develop` branch was created from where `main` is now. - - _Merge_: Merge `main` into `develop`. The state of `develop` will be the same as after a rebase, but there will be merge arrows going multiple directions in the network graph. This is not too bad if done only with the `develop` branch, but looks messy if also done with feature branches in next step. - - [ ] 13.2 **Update feature branches from `develop`** - - Repeat the same process on all branches that are still open. But update the feature branches from `develop` and not `main`. Often it does not matter if you use `main`, but do it from `develop` in case more edits were already done in `main`. - - -- [ ] 14. **Publish release note** - - Once the new version is up on SSC, publish the release note. - - -- [ ] 15. **Send announce email** - If it is a major release (new commands or significant updates to existing commands), send an email to DIME Team to announce the new version. - ---- - -### Version number and dates in ado-files and help files. - -The version number is on the format `X.Y` where the first number is incremented if it is a major release. If the first number is incremented the second number is reset to 0. If it is not a major release, then the first number is left unchanged and the second number is incremented. - -Version number and date in ado-file. Change both version number and date. Make sure that this line is the very first line in the ado-file. -``` -*! version 5.4 15DEC2017 DIME Analytics dimeanalytics@worldbank.org - - capture program drop ietoolkit - program ietoolkit -``` - -Date at the top of the help file. Change only the date, there is no version number in the help file. -``` -{smcl} -{* 15 Dec 2017}{...} -{hline} -help for {hi:ietoolkit} -{hline} -``` diff --git a/admin/description-SSC.md b/admin/description-SSC.md deleted file mode 100644 index d3350c51..00000000 --- a/admin/description-SSC.md +++ /dev/null @@ -1,78 +0,0 @@ -# SSC Meta Description -See instructions for the content in this file here: http://repec.org/bocode/s/sscsubmit.html - -This is the information that will show when typing `ssc describe ietoolkit` and at https://ideas.repec.org/c/boc/bocode/s458137.html - -When updating this information at any point in the future, send the content of the 5 sections (Title, Description, Keywords, Required Stata Version and Author and Email) to Kit Baum when you are updating the package. Just copy the raw text to the body of the email. - -If you are not updating this meta information when updating the files in the `scto` package, then you do not have to submit this information with the files. - -*** - -### Title -'IETOOLKIT': module providing commands for reproducible research - -### Description - -ietoolkit provides a set of commands that -automates common tasks in reproducible research. -This package is developed at the World Bank's -department for impact evaluations (DIME) -and some features are therefore specific to impact evaluation, -but the vast majority of the features are general to any reproducible research. -The practices in these commands are based on experiences in -the 200+ projects within DIME. -Some commands, like iebaltab and ieddtab, simplifies and standardizes analysis -making it less error prone. -Other commands, like ieboilstart and iesave, applies best practices -gathered from across all of DIME's portfolio. -See https://github.com/worldbank/ietoolkit and -https://dimewiki.worldbank.org/wiki/Stata_Coding_Practices for more details. - -### Keywords -* reproducible research -* data management -* data analysis -* balance tables -* difference-in-differences -* matching -* impact evaluations - -### Required Stata Version -Stata 12 - -### AUTHOR: -"DIME Analytics, DIME, The World Bank Group", dimeanalytics@worldbank.org - -### FILES REQUIRED TO BE IN PACKAGE: -- iebaltab.ado -- ieboilstart.ado -- ieddtab.ado -- iedorep.ado -- iedropone.ado -- iefolder.ado -- iegitaddmd.ado -- iegraph.ado -- iekdensity.ado -- iematch.ado -- iesave.ado -- ietoolkit.ado -- iebaltab.sthlp -- ieboilstart.sthlp -- ieddtab.sthlp -- iedorep.sthlp -- iedropone.sthlp -- iefolder.sthlp -- iegitaddmd.sthlp -- iegraph.sthlp -- iekdensity.sthlp -- iematch.sthlp -- iesave.sthlp -- ietoolkit.sthlp - - -*** -Do not send anything from below this line. - -### What are keywords? -This is an explanation to the keywords used below. I do not know how frequently they are used, but this is a list of keywords that are searchable. So if you search on _field work_ (but I do not know where you do that search) you should find this command as it is one of the keywords. diff --git a/admin/run-old-versions.md b/admin/run-old-versions.md deleted file mode 100644 index 7387658c..00000000 --- a/admin/run-old-versions.md +++ /dev/null @@ -1,74 +0,0 @@ -# How to run old versions of ietoolkit - -There are three ways to use an old version of `ietoolkit` that we would like to recommend. -We have listed them below in our order of preference. -We prefer method 1 and 2 over method 3 as they only temporarily install the older version of the command. -Method 3 creates a second full installation of the package that one should remember to remove -when no longer needed for it to not cause issues in the future - -## 1. Using Git - -Start by cloning the repo using Git to your local computer - -Check out the version of `ietoolkit` using the command below. -Replace `` with the version tag you want to use. -See available tags for `ietoolkit` [here](https://github.com/worldbank/ietoolkit/tags). -`-b ` isn't strictly needed, -but in order to checkout a tag, -git must create a new branch. -Using `-b ` you decide what this branch should be called - instead of Git giving it a cryptic name. - -```git checkout tags/ -b ``` - -So far we only made the code of the version you want to use availible on your computer. -Add the code below to the beginning of your do-file. -Replace `${path_to_clone}` with your file path to the clone and -replace `` with the specific command you want to use. -If you want to use multiple commands you will have to repeat this line of code for each command - -```quietly do "${path_to_clone}/src/ado_files/.ado"``` - -This temporary installation of this command has the same scope as a global. -This means that Stata will keep using this version of the command until you close Stata. -After you restart Stata it will use the version of the `ietoolkit` command -you have installed using `ssc` again. - -## 2. Manual installation - -Navigate to the version of ietoolkit you want to use. -If you want a version for which there is a tag, -then you can use browse the versions [here](https://github.com/worldbank/ietoolkit/tags). -Click the `.zip` link for the version you want to use and -download the file to your computer. - -If you want a any other version in this repository you need to naviage to that commit -and download the `.zip` file using teh green "Code" button on the landing page of the repository. - -Unzip the folder anywhere. Copy the `.ado` file for the command you want to use and save it in your project folder. -Then in your code before you use the command, run the code below. -Replace `${path_to_file}` with your file path in your project folder where you saved the file. -Replace `` with the specific command you want to use. - -```quietly do "${path_to_file}/.ado"``` - -This temporary installation of this command has the same scope as a global. -This means that Stata will keep using this version of the command until you close Stata. -After you restart Stata it will use the version of the `ietoolkit` command -you have installed using `ssc` again. - -## 3. Using net install - -To permanently install an odler version, use the code below. -Replace `tag_name` with the tag used for the version you want to install. -See availible tags [here](https://github.com/worldbank/ietoolkit/tags). - -```net install ietoolkit, from("https://raw.githubusercontent.com/worldbank/ietoolkit/") replace``` - -You can now use the commands as usual in your Stata code. -This permanently installs this version of `ietollkit` -and if you want to remove this version you will have to do so manually. -If you also installed other versions or the most recent version through `SSC` -then the order of when you installed the different version of the same package matters. - - diff --git a/admin/test-instructions.md b/admin/test-instructions.md deleted file mode 100644 index 5b050834..00000000 --- a/admin/test-instructions.md +++ /dev/null @@ -1,41 +0,0 @@ -# Instructions and best-practices for testing Stata Commands - -### How to _temporarily_ install a new command or a experimental version of an already installed command for testing - -This applies both (1) if you are writing your own ado-file, or made changes to an ado-file on disk, or (2) if you would like to test a new user-written command, or a new version of an existing command that has not yet been deployed and you have downloaded the file to your computer via GitHub or Dropbox. For the purposes of this exercise, we will use `iebaltab` as an example, but it applies to any command you may like to test. - -When you install a command from SSC, Stata saves the ado-file that contains the code for the command in a special folder on your computer. Which folder this is differs between users and operative systems, but you can see the different possible folders that Stata may save commands by typing `sysdir` in Stata. You do not need to know the differences between these folders, and how Stata uses them. However, it might be helpful to know for this testing exercise that, by default, Stata looks in those folders for all ado-files whenever you type a command. For example, it will search there for *iebaltab.ado* if you use the command `iebaltab` in Stata. - -If your code isn't ready for a "final" installed version, you want to make an edit to `iebaltab` and want to temporarily have Stata run your experimental version of *iebaltab.ado* – _instead of the version you installed through SSC_. Then, you need to load the command into the one place Stata looks _before_ looking in the folders described in the paragraph above, and that is __current memory__. To load a command into memory you simple use the command `do` and run the ado-file with your edits. Now, Stata will run the command from current memory instead. (It can also be good practice to do this as part of release packages and GitHub repos; see https://github.com/qutubproject/plosmed2018 for an example.) Stata will then use the temporary version of the command until you either close the Stata window or type `clear all`. See example below. Note that you need to change the ${ietoolkitRepo} global to point where the ietoolkit repo is saved on your computer. - -``` -global ietoolkitRepo "C:\Users/username/Documents/GitHub/ietoolkit" -do "${ietoolkitRepo}/src/ado_files/iebaltab.ado" -``` - -If it is a new command or you do not have the command installed already you would still follow the same steps to temporarily install a command in Stata. - -### How to view a new help file or a new version of a help file -If you type `help iebaltab` you will see the help file of already installed version of iebaltab. When you want to read the help file for a new command or the new version of a helpfile that includes the new features of the command you instead have to use the *View* option in the *File* drop-down menu. After you click *View* you browse to the location on your computer where you have the new version of the help file and select that file. - -### What to test for when testing a Stata commands - -There are two main aspects when testing a command which are, **Does the command work?** and **Does the command make sense?**. The two questions are equally important as it does not matter how good a command works if it makes sense to anyone but the person who developed it. *Making sense* should be interpreted in the broadest possible sense here. For example, *Is it intuitive what the purpose of the command is?*, *Is it intuitive how the command is specified?*, *Does the documentation make sense?*, *Do the error messages make sense and are they helpful?* etc. The developer can do a lot to test if the command works, but will ultimately need help from the user base to know if it make sense. - -This is a suggested approach to how to test a command: -1. Simplest case - 1. If it is a new command, or a command you have never used, try to figure out the simplest way the command can be used (i.e. the fewest amount of options used) and make sure you understand the input, the calculations and the output. In this process, try to come up with a way that the documentation could have been more helpful to you coming up with this case. - 1. To test a command, see if there is a *run-file* where someone have already prepared this simplest way to use the command. - 1. After you have tested on the data in the *run-file* test the same specification of your own data - 1. If there is no *run-file* come up with your own most simple case -1. Standard case - 1. After you tested the most simple case it is time to test a standard case. Again, see if there is a *run-file* that have prepared such a case for you. If there is no such file, see if you can use the documentation to come up with that case - 1. If the command has new features, you can skip testing the most simple case and go directly to test that specific feature. -1. Special cases - 1. A special case where the command is supposed to work. Come up with a case that is special but you still expect the command to handle that. For example: - 1. Some observations have missing values in variables used - 1. Both numeric and string variables are working if that is supposed to be the cases - 1. A special case where the command is not supposed to work. This should lead to the command providing a helpful error message instead of an unhelpful error message, or - even worse - incorrect analysis. - 1. Use string variable where numeric is expected, and vice versa. - 1. Use corner case variables, like zero or very large values - 1. Specify too many or too few variables diff --git a/index.html b/index.html deleted file mode 100644 index a2023afd..00000000 --- a/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - HTML Meta Tag - - - -

Redirecting to GitHub landing page

- - diff --git a/run/README.md b/run/README.md deleted file mode 100644 index 16dbf9a6..00000000 --- a/run/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# `IETOOLKIT` test Folder - -This folder contains the files used to test new versions of `ietoolkit` -before they are released. - -## How to run the test files? - -The files in this folder are meant to be run using the Stata project file -`ietoolkit.stpr` found in the top folder of this repo. - -If you have not already, start by cloning this repo to your computer. -Then click the `ietoolkit.stpr` and the test project opens in a window -that looks like the do-file editor. -One difference is that to the left you will see a file tree. -In this tree you will see files like `ieboilstart.do`, `ieddtab.do` etc. -and a file called `main.do`. - -If you only want to test a single commands you simply click on -the run file for that command and run this. -Since this test environment use a Stata project -you do not need to set a root path. - -You only need to run the file `main.do` in case you want to run -the test files for all commands in `ietoolkit` that there is a run file for. -Note that after running the run file `ieboilstart.do` -you need to restart Stata to restore the settings that run file changed. - -## How do I know if the test was successful? - -The tests are successful if these two conditions are satisfied: - -* The file(s) ran without error -* The outputs generated are identical to -output already committed and pushed to the "outputs" folders for each command. - -If a command does not have any output -or if the output are not committed to this repo, -then the tests are only done in the code of the run files. -For example by using `assert` or `capture`/`_rc` to test error codes. - -It is practically impossible to design tests for every single potential bug. -We include new tests here for any bug that we find such that -it is made very unlikely that a similar bug can ever be published in the future. -If you have found a bug that slipped past these tests, -then we would be very grateful if you would report that bug -[here](https://github.com/worldbank/ietoolkit/issues). - -## Do we recommend using Stata projects in research projects? - -If you are a devoted reader of the resources published by our team -[DIME Analytics](https://www.worldbank.org/en/research/dime/data-and-analytics), -then you might notice that we typically do not recommend using Stata projects. - -While it is true that we are typically recommending -[dynamic absolute root-paths](https://worldbank.github.io/dime-data-handbook/coding.html#writing-file-paths) -as our preferred standard, -we never make any recommendations against using Stata projects when appropriate. - -We think that dynamic absolute root-paths is always a good practice, -while Stata projects are only a good practice when -no file paths in a project point to anything outside the code folder. -Many research projects share code over GitHub -while sharing the raw data over syncing software like DropBox or OneDrive. -In those cases, we do not see any other good practice way than -using dynamic absolute root-paths to create a reproducible project. - -In this test environment, then we know for sure that all folder paths -will only point to files inside the clone of this repo. -Stata projects are therefore a convenient solution here, -that makes the testing easier to do, which helps us to do it more often. - -To keep DIME Analytic's recommendations simple, -we try to identify a single best practice that -can be used in many cases and even better in all cases. -For file paths, -we still think that dynamic absolute root-paths is the best fit for -that single recommendation. -It would have worked reliable in this test environment as well. -This has never been intended to mean that there is never a case -when some other practice might be an equally or perhaps better fit. diff --git a/run/iebaltab/iebaltab1.do b/run/iebaltab/iebaltab1.do deleted file mode 100644 index dfb2a3ff..00000000 --- a/run/iebaltab/iebaltab1.do +++ /dev/null @@ -1,665 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - * Load the command from file and utils - qui do "${runfldr}/iebaltab/iebaltab_run_utils.do" - qui do "${runfldr}/run_utils.do" - - * Folder local and make sure it is created - local out "${runfldr}/iebaltab/outputs/iebaltab1" - ie_recurse_mkdir, folder("`out'") - -************* Regular - sysuse auto - - set seed 34543673 - - gen tmt = (runiform()<.5) - recode tmt (0 = 6) (1 = 2) - replace tmt = 10231 if (runiform()<.2) - replace tmt = 4 if (runiform()<.2) - tab tmt - - * String treatment variable - tostring tmt, gen(tmt_str) - - * Tmt labels - lab define tmtlbl 4 "control/unobserved" 2 "Oi in %" 6 "taco & salsa" - lab val tmt tmtlbl - - *Cluster variable - gen test_cluster_var = tmt - qui sum test_cluster_var, d - gen tmt_cl = (test_cluster_var <= r(p50)) - - - -qui { - - /*************************************************************************** - Table 1 - csv, excel, tex and texnote - ***************************************************************************/ - preserve - - local tnum 1 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 2 - tex table fragement only - ***************************************************************************/ - preserve - - local tnum 2 - local tex "`out'/iebt-tex`tnum'" - - noi iebaltab weight price , /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - savetex("`tex'") /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 3 - tex table fragement only with options - ***************************************************************************/ - preserve - - local tnum 3 - local tex "`out'/iebt-tex`tnum'" - - iebaltab weight price , /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - savetex("`tex'") /// - cov(mpg) fixed(foreign) /// - texcolwidth(4cm) /// - addnote("Options used: texcolwidth(3cm) short first column ") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 4 - tex stand alone doc - ***************************************************************************/ - preserve - - local tnum 4 - local tex "`out'/iebt-texdoc`tnum'" - - noi iebaltab weight price , /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - savetex("`tex'") /// - cov(mpg) fixed(foreign) texdocument - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 5 - tex stand alone doc with options - ***************************************************************************/ - preserve - - local tnum 5 - local tex "`out'/iebt-texdoc`tnum'" - - noi iebaltab weight price , /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - savetex("`tex'") /// - cov(mpg) fixed(foreign) texdocument /// - texnotewidth(1.5) texcolwidth(2cm) /// - texcaption("Table 5") texlabel("T5") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - - /*************************************************************************** - Table 6 - csv, excel, tex and texnote - rowlabels, weird tmt levels, total - ***************************************************************************/ - preserve - - local tnum 6 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt) replace /// - ftest feqtest total rowvarlabels /// - cov(mpg) fixed(foreign) /// - addnote("Many groups, rowvarlabels") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 7 - csv, excel, tex and texnote - order - ***************************************************************************/ - preserve - - local tnum 7 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt) replace /// - total order(4 10231) control(6) groupcodes /// - cov(mpg) fixed(foreign) /// - addnote("column order should be 4 10231 6 2, and 6 is control so pair test only with this group") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 8 - csv, excel, tex and texnote - manual labels (and order) - ***************************************************************************/ - preserve - - local tnum 8 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - label var weight "Weight (USD$)" - // Percent sign in value label - - noi iebaltab weight price headroom , `allsave' /// - groupvar(tmt) replace /// - total control(6) rowvarlabels /// - grouplabels(`"6 Quotes, and comma "," @ 4 Pizza & Pineapple (USD$) "') /// - totallabel("Total single ' quote") cov(mpg) fixed(foreign) /// - rowlabels(`"price St*r and sub _script @ headroom Headroom "Height" quote "') /// - addnote("Row column manual ($) lables.") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 9 - missing covariate and fixed effect value warnings - ***************************************************************************/ - - preserve - - * Replace one value in three different obs for balance var, covariate - * and fixed effect - sort tmt_cl make - by tmt_cl : replace weight = . if _n == 1 & tmt_cl == 1 - by tmt_cl : replace mpg = . if _n == 2 & tmt_cl == 1 - by tmt_cl : replace foreign = . if _n == 3 & tmt_cl == 1 - - local tnum 9 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - ftest feqtest /// - cov(mpg) fixed(foreign) /// - addnote("Warning for missing value in fixedeffect(foreign) and in covariates(mpg)") - - * Expected outcome: Warning for missing value in - * fixedeffect(foreign) and in covariates(mpg), but no warning for weight - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 10 - cluster - ***************************************************************************/ - - preserve - - local tnum 10 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - vce(cluster test_cluster_var) /// - ftest feqtest total /// - cov(mpg) fixed(foreign) /// - addnote("added cluster") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 11 - onerow - basic stats - ***************************************************************************/ - - preserve - - local tnum 11 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - onerow /// - cov(mpg) fixed(foreign) /// - addnote("added onerow") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - - /*************************************************************************** - Table 12 - onerow - all stats that change cols and cluster var - ***************************************************************************/ - - preserve - - local tnum 12 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - onerow vce(cluster test_cluster_var) /// - ftest feqtest total /// - cov(mpg) fixed(foreign) /// - addnote("added onerow and cluster") browse - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - - /*************************************************************************** - Table 13 - test pair and f stats preferences - ***************************************************************************/ - preserve - - local tnum 13 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - ftest control(1) /// - stats(f(p) pair(nrmd)) /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 14 - test showing no pair tests - ***************************************************************************/ - preserve - - local tnum 14 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - ftest feqtest control(1) /// - stats(pair(none)) /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 15 - more test pair stats preferences - ***************************************************************************/ - preserve - - local tnum 15 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - ftest control(1) /// - stats(pair(se)) /// - cov(mpg) fixed(foreign) - - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 16 - test normalized difference - ***************************************************************************/ - preserve - - local tnum 16 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(pair(nrmd)) /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 17 - test normalized adjusted difference - ***************************************************************************/ - preserve - - local tnum 17 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(pair(nrmb)) /// - cov(mpg) fixed(foreign) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - - /*************************************************************************** - Table 18 - test normalized difference - ***************************************************************************/ - preserve - - local tnum 18 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(pair(diff)) - - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 19 - test normalized adjusted difference - ***************************************************************************/ - preserve - - local tnum 19 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(pair(beta)) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - - /*************************************************************************** - Table 20 - test desc stats and vce bootstrap - ***************************************************************************/ - preserve - - local tnum 20 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(desc(var) pair(t)) vce(robust) - - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 21 - test desc stats and vce robus - ***************************************************************************/ - preserve - - local tnum 21 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - noi iebaltab weight price , `allsave' /// - groupvar(tmt_cl) replace /// - stats(desc(sd) pair(p)) vce(bootstrap) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - - restore - - - /*************************************************************************** - Table 22 - test adding stars and star user inputs - ***************************************************************************/ - preserve - - local tnum 22 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") texnotefile("`txn'") "' - - set seed 542783 - - local balvars mpg headroom trunk weight length turn price - foreach balvar of local balvars { - replace `balvar' = `balvar' * (1 - (.2 * runiform())) if tmt_cl == 1 - } - - noi iebaltab `balvars' , `allsave' /// - groupvar(tmt_cl) replace onerow /// - stats(pair(p)) starlevels(.4 .2 .001) - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - - restore - - - /*************************************************************************** - Table 23 - use all deprecated still allowed names - ***************************************************************************/ - preserve - - local tnum 23 - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'")"' - - set seed 542783 - - local balvars mpg trunk weight turn price - foreach balvar of local balvars { - replace `balvar' = `balvar' * (1 - (.2 * runiform())) if tmt_cl == 1 - } - - noi iebaltab `balvars' , `allsave' /// - grpvar(tmt_cl) grpcodes replace /// - starsnoadd stats(pair(p)) /// - tblnonote grplabels("0 Control @ 1 Treatment") - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - /*************************************************************************** - Table 24 - testing nonote beahvior - ***************************************************************************/ - - preserve - - local tnum 24a - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local txn "`out'/iebt-tex`tnum'-note" - local allsave `"savecsv("`csv'") savexlsx("`exl'") texnotefile("`txn'") savetex("`tex'") "' - - noi iebaltab weight , `allsave' replace groupvar(tmt_cl) /// - nonote addnote(`"added a "tricky" note"') - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore - - preserve - - local tnum 24b - local csv "`out'/iebt-csv`tnum'" - local exl "`out'/iebt-xlsx`tnum'" - local tex "`out'/iebt-tex`tnum'" - local allsave `"savecsv("`csv'") savexlsx("`exl'") savetex("`tex'") "' - - noi iebaltab weight , `allsave' replace groupvar(tmt_cl) nonote - - * Test no regaular missing values in matrices - mat mat1 = r(iebtab_rmat) - mat mat2 = r(iebtab_fmat) - noi ie_test_mat_nomiss, mat1(mat1) mat2(mat2) - restore -} diff --git a/run/iebaltab/iebaltab2.do b/run/iebaltab/iebaltab2.do deleted file mode 100644 index 0adaea3d..00000000 --- a/run/iebaltab/iebaltab2.do +++ /dev/null @@ -1,173 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - * Load utils commands - qui do "${runfldr}/run_utils.do" - - ************************ - * Run tests - - sysuse auto, clear - - set seed 232197 // obtained from bit.ly/stata-random on 2022-10-11 22:16:30 UTC - - gen random = runiform() - - gen tmt = (random > .33) - replace tmt = 2 if (random > .66) - - split make, gen(strata) - encode strata1, gen(stratum) - drop strata* - - local vars price mpg trunk headroom weight length turn displacement gear_ratio - - local out "${runfldr}/iebaltab/outputs/iebaltab2" - ie_recurse_mkdir, folder("`out'") - - **# Export options --------------------------------------------------------------- - - preserve - iebaltab `vars', grpvar(foreign) browse - restore - - iebaltab `vars', grpvar(foreign) /// - savexlsx("`out'/2g.xlsx") /// - savecsv("`out'/2g-control.csv") /// - savetex("`out'/2g.tex") /// - replace - - iebaltab `vars', grpvar(tmt) /// - savetex("`out'/3g.tex") /// - replace - - **# Column and row options ----------------------------------------------------- - - * Should throw error: file exists - cap iebaltab `vars', grpvar(foreign) /// - control(1) /// - savetex("`out'/2g.tex") - - assert _rc == 602 - - * control - iebaltab `vars', grpvar(foreign) /// - control(0) /// - savetex("`out'/2g-control.tex") /// - replace - - * Three groups - iebaltab `vars', grpvar(tmt) /// - savetex("`out'/3g.tex") /// - replace - - iebaltab `vars', grpvar(tmt) /// - control(0) /// - savetex("`out'/3g-control.tex") /// - replace - - * order(groupcodelist) - iebaltab `vars', grpvar(tmt) /// - order(2) /// - savetex("`out'/3g-order.tex") /// - replace - - iebaltab `vars', grpvar(tmt) /// - control(0) order(2 1) /// - savetex("`out'/3g-control-order.tex") /// - replace - - * total - iebaltab `vars', grpvar(tmt) /// - total /// - savetex("`out'/3g-total.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - total /// - savetex("`out'/2g-total.tex") /// - replace - - * onerow - iebaltab `vars', grpvar(foreign) /// - onerow /// - savetex("`out'/2g-onerow.tex") /// - replace - - **# Estimation options --------------------------------------------------------- - iebaltab `vars', grpvar(foreign) /// - fixedeffect(stratum) /// - savetex("`out'/2g-fe.tex") /// - replace - - iebaltab `vars', grpvar(tmt) /// - covariates(foreign) /// - stats(pair(p)) /// - savetex("`out'/3g-cov.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - fixedeffect(stratum) /// - ftest /// - savetex("`out'/2g-ftest.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - fixedeffect(stratum) /// - feqtest /// - savetex("`out'/2g-feqtest.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - stats(pair(p)) /// - savetex("`out'/2g-pair.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - vce(cluster stratum) /// - stats(pair(p)) /// - savetex("`out'/2g-cluster.tex") /// - replace - - **# Stat display options ------------------------------------------------------- - - iebaltab `vars', grpvar(foreign) /// - format("%9.2f") /// - savetex("`out'/2g-fmt.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - starsnoadd /// - savetex("`out'/2g-nostars.tex") /// - replace - - iebaltab `vars', grpvar(foreign) /// - starlevels(.05 .01 .001) /// - savetex("`out'/2g-stars.tex") /// - replace - - - /* This should work at some point, but is not yet implemented - iebaltab `vars', grpvar(foreign) /// - stats(pair(diff se)) /// - savetex("`out'/2g-diff-se.tex") /// - replace - */ - exit diff --git a/run/iebaltab/iebaltab_run_utils.do b/run/iebaltab/iebaltab_run_utils.do deleted file mode 100644 index f4ba05bc..00000000 --- a/run/iebaltab/iebaltab_run_utils.do +++ /dev/null @@ -1,26 +0,0 @@ -/*********************************************** - Test utils for iebaltab -************************************************/ - -* Test if matrices has any regular missing values -cap program drop ie_test_mat_nomiss - program define ie_test_mat_nomiss - - syntax, mat1(name) [mat2(name) mat3(name) mat4(name)] - - * Combine a list of all mats and loop over them - local mats "`mat1' `mat2' `mat3' `mat4'" - foreach mat of local mats { - *Loop over columns and rows - forvalues c = 1/`=colsof(`mat')' { - forvalues r = 1/`=rowsof(`mat')' { - *Test if value is missing - if el(`mat',`r',`c') == . { - mat list `mat' - noi di as error "{pstd}Matrix may only non-missing values or extended missing values. See position row `r' and col `c'.{p_end}" - error 504 - } - } - } - } -end diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv1.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv1.csv deleted file mode 100644 index fd61d8d5..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv1.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ","","F-test for balance","","(2)-(1)" -"","","1","","0","","across all groups","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","F-stat/P-value","N","Mean difference" -"weight","43","2972.558","31","3084.516","74","2.679","74","111.958" -"","","(130.959)","","(117.753)","","0.106","","" -"price","43","6312.465","31","5961.065","74","0.928","74","-351.401" -"","","(486.238)","","(470.476)","","0.339","","" -"F-test of joint significance (F-stat)","","","","","","","","1.325" -"F-test, number of observations","","","","","","","","74" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv1"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx1"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1-note"") groupvar(tmt_cl) replace ftest feqtest control(1) cov(mpg) fixed(foreign)] ","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv10.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv10.csv deleted file mode 100644 index 480c4819..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv10.csv +++ /dev/null @@ -1,11 +0,0 @@ -"",""," (1) ",""," (2) ",""," (3) ","","F-test for balance","","(2)-(3)" -"","","Total","","0","","1","","across all groups","","Pairwise t-test" -"Variable","N/Clusters","Mean/(SE)","N/Clusters","Mean/(SE)","N/Clusters","Mean/(SE)","N/Clusters","F-stat/P-value","N/Clusters","Mean difference" -"weight","74","3019.459","31","3084.516","43","2972.558","74","3.353","74","111.958" -"","4","(107.435)","2","(98.439)","2","(209.010)","4","0.164","4","" -"price","74","6165.257","31","5961.065","43","6312.465","74","1.695","74","-351.401" -"","4","(451.828)","2","(125.692)","2","(917.571)","4","0.284","4","" -"F-test of joint significance (F-stat)","","","","","","","","","","1.128" -"F-test, number of observations","","","","","","","","","","74" -"F-test, number of clusters","","","","","","","","","","4" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Errors are clustered at variable: [test_cluster_var]. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv10"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx10"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10-note"") groupvar(tmt_cl) replace vce(cluster test_cluster_var) ftest feqtest total cov(mpg) fixed(foreign) addnote(""added cluster"")] added cluster","","","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv11.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv11.csv deleted file mode 100644 index 12dd0a6c..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv11.csv +++ /dev/null @@ -1,9 +0,0 @@ -""," (1) "," (2) ","(1)-(2)" -"","0","1","Pairwise t-test" -"Variable","Mean/(SE)","Mean/(SE)","Mean difference" -"weight","3084.516","2972.558","111.958" -"","(117.753)","(130.959)","" -"price","5961.065","6312.465","-351.401" -"","(470.476)","(486.238)","" -"Number of observations","31","43","74" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv11"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx11"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11-note"") groupvar(tmt_cl) replace onerow cov(mpg) fixed(foreign) addnote(""added onerow"")] added onerow","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv12.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv12.csv deleted file mode 100644 index b393c110..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv12.csv +++ /dev/null @@ -1,11 +0,0 @@ -""," (1) "," (2) "," (3) ","F-test for balance","(2)-(3)" -"","Total","0","1","across all groups","Pairwise t-test" -"Variable","Mean/(SE)","Mean/(SE)","Mean/(SE)","F-stat/P-value","Mean difference" -"weight","3019.459","3084.516","2972.558","3.353","111.958" -"","(107.435)","(98.439)","(209.010)","0.164","" -"price","6165.257","5961.065","6312.465","1.695","-351.401" -"","(451.828)","(125.692)","(917.571)","0.284","" -"F-test of joint significance (F-stat)","","","","","1.128" -"Number of observations","74","31","43","74","74" -"Number of clusters","4","2","2","4","4" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Errors are clustered at variable: [test_cluster_var]. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv12"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx12"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12-note"") groupvar(tmt_cl) replace onerow vce(cluster test_cluster_var) ftest feqtest total cov(mpg) fixed(foreign) addnote(""added onerow and cluster"") browse] added onerow and cluster","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv13.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv13.csv deleted file mode 100644 index acc4263e..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv13.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ","","(2)-(1)" -"","","1","","0","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Normalized difference" -"weight","43","2972.558","31","3084.516","74","0.147" -"","","(130.959)","","(117.753)","","" -"price","43","6312.465","31","5961.065","74","-0.120" -"","","(486.238)","","(470.476)","","" -"F-test of joint significance (P-value)","","","","","","0.273" -"F-test, number of observations","","","","","","74" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv13"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx13"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13-note"") groupvar(tmt_cl) replace ftest control(1) stats(f(p) pair(nrmd)) cov(mpg) fixed(foreign)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv14.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv14.csv deleted file mode 100644 index 649e58c8..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv14.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","F-test for balance" -"","","1","","0","","across all groups" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","F-stat/P-value" -"weight","43","2972.558","31","3084.516","74","2.679" -"","","(130.959)","","(117.753)","","0.106" -"price","43","6312.465","31","5961.065","74","0.928" -"","","(486.238)","","(470.476)","","0.339" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in f-test regressions: [mpg]. Fixed effect used in f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv14"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx14"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14-note"") groupvar(tmt_cl) replace ftest feqtest control(1) stats(pair(none)) cov(mpg) fixed(foreign)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv15.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv15.csv deleted file mode 100644 index ea145a26..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv15.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ","","(2)-(1)" -"","","1","","0","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Standard error" -"weight","43","2972.558","31","3084.516","74","95.502" -"","","(130.959)","","(117.753)","","" -"price","43","6312.465","31","5961.065","74","610.296" -"","","(486.238)","","(470.476)","","" -"F-test of joint significance (F-stat)","","","","","","1.325" -"F-test, number of observations","","","","","","74" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv15"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx15"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15-note"") groupvar(tmt_cl) replace ftest control(1) stats(pair(se)) cov(mpg) fixed(foreign)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv16.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv16.csv deleted file mode 100644 index 19ef48e8..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv16.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Normalized difference" -"weight","31","3084.516","43","2972.558","74","0.147" -"","","(117.753)","","(130.959)","","" -"price","31","5961.065","43","6312.465","74","-0.120" -"","","(470.476)","","(486.238)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv16"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx16"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16-note"") groupvar(tmt_cl) replace stats(pair(nrmd)) cov(mpg) fixed(foreign)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv17.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv17.csv deleted file mode 100644 index aecf74fe..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv17.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Normalized beta coefficient" -"weight","31","3084.516","43","2972.558","74","-0.205" -"","","(117.753)","","(130.959)","","" -"price","31","5961.065","43","6312.465","74","-0.202" -"","","(470.476)","","(486.238)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv17"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx17"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17-note"") groupvar(tmt_cl) replace stats(pair(nrmb)) cov(mpg) fixed(foreign)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv18.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv18.csv deleted file mode 100644 index 70b9df63..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv18.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference" -"weight","31","3084.516","43","2972.558","74","111.958" -"","","(117.753)","","(130.959)","","" -"price","31","5961.065","43","6312.465","74","-351.401" -"","","(470.476)","","(486.238)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv18"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx18"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18-note"") groupvar(tmt_cl) replace stats(pair(diff))] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv19.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv19.csv deleted file mode 100644 index 9b25f331..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv19.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Beta coefficient" -"weight","31","3084.516","43","2972.558","74","111.958" -"","","(117.753)","","(130.959)","","" -"price","31","5961.065","43","6312.465","74","-351.401" -"","","(470.476)","","(486.238)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv19"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx19"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19-note"") groupvar(tmt_cl) replace stats(pair(beta))] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv20.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv20.csv deleted file mode 100644 index df8b41a6..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv20.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(Var)","N","Mean/(Var)","N","t-statistics" -"weight","31","3084.516","43","2972.558","74","0.636" -"","","(4.30e+05)","","(7.37e+05)","","" -"price","31","5961.065","43","6312.465","74","-0.520" -"","","(6.86e+06)","","(1.02e+07)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Errors are robust. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv20"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx20"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20-note"") groupvar(tmt_cl) replace stats(desc(var) pair(t)) vce(robust)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv21.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv21.csv deleted file mode 100644 index 3f7b03d3..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv21.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SD)","N","Mean/(SD)","N","P-value" -"weight","31","3084.516","43","2972.558","74","0.534" -"","","(654.062)","","(1017.754)","","" -"price","31","5961.065","43","6312.465","74","0.657" -"","","(2631.060)","","(3404.746)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Errors are estimeated using bootstrap. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv21"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx21"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21-note"") groupvar(tmt_cl) replace stats(desc(sd) pair(p)) vce(bootstrap)] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv22.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv22.csv deleted file mode 100644 index 67fa371f..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv22.csv +++ /dev/null @@ -1,19 +0,0 @@ -""," (1) "," (2) ","(1)-(2)" -"","0","1","Pairwise t-test" -"Variable","Mean/(SE)","Mean/(SE)","P-value" -"mpg","20.258","20.092","0.895" -"","(0.759)","(0.910)","" -"headroom","2.935","2.723","0.273*" -"","(0.155)","(0.119)","" -"trunk","14.097","12.127","0.039**" -"","(0.793)","(0.555)","" -"weight","3084.516","2650.042","0.014**" -"","(117.753)","(118.860)","" -"length","190.323","164.671","0.000***" -"","(3.472)","(3.795)","" -"turn","40.226","34.692","0.000***" -"","(0.664)","(0.739)","" -"price","5961.065","5702.614","0.695" -"","(470.476)","(442.505)","" -"Number of observations","31","43","74" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.001, **=.2, *=.4. Full user input as written by user: [iebaltab mpg headroom trunk weight length turn price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv22"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx22"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22-note"") groupvar(tmt_cl) replace onerow stats(pair(p)) starlevels(.4 .2 .001)] ","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv23.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv23.csv deleted file mode 100644 index 5a6791b1..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv23.csv +++ /dev/null @@ -1,13 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","Control","","Treatment","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","P-value" -"mpg","31","20.258","43","20.092","74","0.895" -"","","(0.759)","","(0.910)","","" -"trunk","31","14.097","43","12.150","74","0.051" -"","","(0.793)","","(0.606)","","" -"weight","31","3084.516","43","2671.920","74","0.016" -"","","(117.753)","","(113.337)","","" -"turn","31","40.226","43","34.994","74","0.000" -"","","(0.664)","","(0.731)","","" -"price","31","5961.065","43","5604.701","74","0.595" -"","","(470.476)","","(453.973)","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv24a.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv24a.csv deleted file mode 100644 index 2d16b90b..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv24a.csv +++ /dev/null @@ -1,6 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference" -"weight","31","3084.516","43","2972.558","74","111.958" -"","","(117.753)","","(130.959)","","" -"added a ""tricky"" note","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv24b.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv24b.csv deleted file mode 100644 index 04e51ffc..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv24b.csv +++ /dev/null @@ -1,5 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","0","","1","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference" -"weight","31","3084.516","43","2972.558","74","111.958" -"","","(117.753)","","(130.959)","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv6.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv6.csv deleted file mode 100644 index f84f4279..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv6.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ",""," (3) ",""," (4) ",""," (5) ","","F-test for balance","","(2)-(3)","","(2)-(4)","","(2)-(5)","","(3)-(4)","","(3)-(5)","","(4)-(5)" -"","","Total","","Oi in %","","control/unobserved","","taco & salsa","","10231","","across all groups","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","F-stat/P-value","N","Mean difference","N","Mean difference","N","Mean difference","N","Mean difference","N","Mean difference","N","Mean difference" -"Weight (lbs.)","74","3019.459","22","3176.818","21","2758.571","19","3004.211","12","3211.667","74","1.936","43","418.247","41","172.608**","34","-34.848","40","-245.639","33","-453.095","31","-207.456" -"","","(90.347)","","(172.374)","","(191.277)","","(157.068)","","(177.127)","","0.132","","","","","","","","","","","","" -"Price","74","6165.257","22","7209.182","21","5373.048","19","5858.526","12","6123.417","74","1.101","43","1836.134","41","1350.656","34","1085.765","40","-485.479","33","-750.369","31","-264.890" -"","","(342.872)","","(776.498)","","(516.864)","","(605.744)","","(777.763)","","0.355","","","","","","","","","","","","" -"F-test of joint significance (F-stat)","","","","","","","","","","","","","","1.388","","2.807*","","0.828","","0.605","","0.012","","0.182" -"F-test, number of observations","","","","","","","","","","","","","","43","","41","","34","","40","","33","","31" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv6"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx6"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6-note"") groupvar(tmt) replace ftest feqtest total rowvarlabels cov(mpg) fixed(foreign) addnote(""Many groups, rowvarlabels"")] Many groups, rowvarlabels","","","","","","","","","","","","","","","","","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv7.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv7.csv deleted file mode 100644 index bd220164..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv7.csv +++ /dev/null @@ -1,8 +0,0 @@ -"",""," (1) ",""," (2) ",""," (3) ",""," (4) ",""," (5) ","","(2)-(4)","","(3)-(4)","","(5)-(4)" -"","","Total","","4","","10231","","6","","2","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference","N","Mean difference","N","Mean difference" -"weight","74","3019.459","21","2758.571","12","3211.667","19","3004.211","22","3176.818","40","-245.639","31","207.456","41","172.608**" -"","","(90.347)","","(191.277)","","(177.127)","","(157.068)","","(172.374)","","","","","","" -"price","74","6165.257","21","5373.048","12","6123.417","19","5858.526","22","7209.182","40","-485.479","31","264.890","41","1350.656" -"","","(342.872)","","(516.864)","","(777.763)","","(605.744)","","(776.498)","","","","","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv7"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx7"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7-note"") groupvar(tmt) replace total order(4 10231) control(6) groupcodes cov(mpg) fixed(foreign) addnote(""column order should be 4 10231 6 2, and 6 is control so pair test only with this group"")] column order should be 4 10231 6 2, and 6 is control so pair test only with this group","","","","","","","","","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv8.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv8.csv deleted file mode 100644 index 64f9994a..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv8.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ",""," (3) ",""," (4) ",""," (5) ","","(3)-(2)","","(4)-(2)","","(5)-(2)" -"","","Total single ' quote","","Quotes, and comma "",""","","Oi in %","","Pizza & Pineapple (USD$)","","10231","","Pairwise t-test","","Pairwise t-test","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference","N","Mean difference","N","Mean difference" -"Weight (USD$)","74","3019.459","19","3004.211","22","3176.818","21","2758.571","12","3211.667","41","172.608**","40","-245.639","31","207.456" -"","","(90.347)","","(157.068)","","(172.374)","","(191.277)","","(177.127)","","","","","","" -"St*r and sub _script","74","6165.257","19","5858.526","22","7209.182","21","5373.048","12","6123.417","41","1350.656","40","-485.479","31","264.890" -"","","(342.872)","","(605.744)","","(776.498)","","(516.864)","","(777.763)","","","","","","" -"Headroom ""Height"" quote","74","2.993","19","2.895","22","3.114","21","2.952","12","3.000","41","0.219","40","0.058","31","0.105" -"","","(0.098)","","(0.190)","","(0.189)","","(0.176)","","(0.275)","","","","","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price headroom , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv8"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx8"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8-note"") groupvar(tmt) replace total control(6) rowvarlabels grouplabels(`""6 Quotes, and comma "","" @ 4 Pizza & Pineapple (USD$) ""') totallabel(""Total single ' quote"") cov(mpg) fixed(foreign) rowlabels(`""price St*r and sub _script @ headroom Headroom ""Height"" quote ""') addnote(""Row column manual ($) lables."")] Row column manual ($) lables.","","","","","","","","","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-csv9.csv b/run/iebaltab/outputs/iebaltab1/iebt-csv9.csv deleted file mode 100644 index f2d5465c..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-csv9.csv +++ /dev/null @@ -1,10 +0,0 @@ -"",""," (1) ",""," (2) ","","F-test for balance","","(1)-(2)" -"","","0","","1","","across all groups","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","F-stat/P-value","N","Mean difference" -"weight","31","3084.516","42","2980.476","71","2.681","71","104.040" -"","","(117.753)","","(133.869)","","0.106","","" -"price","31","5961.065","43","6312.465","72","0.742","72","-351.401" -"","","(470.476)","","(486.238)","","0.392","","" -"F-test of joint significance (F-stat)","","","","","","","","1.324" -"F-test, number of observations","","","","","","","","71" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv9"") savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx9"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9"") texnotefile(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9-note"") groupvar(tmt_cl) replace ftest feqtest cov(mpg) fixed(foreign) addnote(""Warning for missing value in fixedeffect(foreign) and in covariates(mpg)"")] Warning for missing value in fixedeffect(foreign) and in covariates(mpg)","","","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex1-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex1-note.tex deleted file mode 100644 index dbe10279..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex1-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv1") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx1") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1-note") groupvar(tmt\_cl) replace ftest feqtest control(1) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex1.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex1.tex deleted file mode 100644 index 8d9e70d2..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex1.tex +++ /dev/null @@ -1,21 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv1") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx1") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex1-note") groupvar(tmt_cl) replace ftest feqtest control(1) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 & 74 & 111.958 \\ - & & (130.959) & & (117.753) & & 0.106 & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 & 74 & -351.401 \\ - & & (486.238) & & (470.476) & & 0.339 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.325 \\ -F-test, number of observations & & & & & & & & 74 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex10-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex10-note.tex deleted file mode 100644 index 5db8f522..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex10-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Errors are clustered at variable: [test\_cluster\_var]. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv10") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx10") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10-note") groupvar(tmt\_cl) replace vce(cluster test\_cluster\_var) ftest feqtest total cov(mpg) fixed(foreign) addnote("added cluster")] added cluster diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex10.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex10.tex deleted file mode 100644 index ba48992f..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex10.tex +++ /dev/null @@ -1,22 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv10") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx10") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex10-note") groupvar(tmt_cl) replace vce(cluster test_cluster_var) ftest feqtest total cov(mpg) fixed(foreign) addnote("added cluster") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{Total} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N/Clusters & Mean/(SE) & N/Clusters & Mean/(SE) & N/Clusters & Mean/(SE) & N/Clusters & F-stat/P-value & N/Clusters & Mean difference \\ \hline \\[-1.8ex] -weight & 74 & 3019.459 & 31 & 3084.516 & 43 & 2972.558 & 74 & 3.353 & 74 & 111.958 \\ - & 4 & (107.435) & 2 & (98.439) & 2 & (209.010) & 4 & 0.164 & 4 & \\ [1ex] -price & 74 & 6165.257 & 31 & 5961.065 & 43 & 6312.465 & 74 & 1.695 & 74 & -351.401 \\ - & 4 & (451.828) & 2 & (125.692) & 2 & (917.571) & 4 & 0.284 & 4 & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & & & 1.128 \\ -F-test, number of observations & & & & & & & & & & 74 \\ -F-test, number of clusters & & & & & & & & & & 4 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex11-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex11-note.tex deleted file mode 100644 index dcf9947a..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex11-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv11") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx11") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11-note") groupvar(tmt\_cl) replace onerow cov(mpg) fixed(foreign) addnote("added onerow")] added onerow diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex11.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex11.tex deleted file mode 100644 index ae78be46..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex11.tex +++ /dev/null @@ -1,20 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv11") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx11") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex11-note") groupvar(tmt_cl) replace onerow cov(mpg) fixed(foreign) addnote("added onerow") - -\begin{tabular}{@{\extracolsep{5pt}}lccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(1)-(2)} \\ - & \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{Pairwise t-test} \\ -Variable & Mean/(SE) & Mean/(SE) & Mean difference \\ \hline \\[-1.8ex] -weight & 3084.516 & 2972.558 & 111.958 \\ - & (117.753) & (130.959) & \\ [1ex] -price & 5961.065 & 6312.465 & -351.401 \\ - & (470.476) & (486.238) & \\ [1ex] -\hline \\[-1.8ex] -Number of observations & 31 & 43 & 74 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex12-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex12-note.tex deleted file mode 100644 index 3411af8a..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex12-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Errors are clustered at variable: [test\_cluster\_var]. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv12") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx12") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12-note") groupvar(tmt\_cl) replace onerow vce(cluster test\_cluster\_var) ftest feqtest total cov(mpg) fixed(foreign) addnote("added onerow and cluster") browse] added onerow and cluster diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex12.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex12.tex deleted file mode 100644 index 81771bd7..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex12.tex +++ /dev/null @@ -1,23 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv12") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx12") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex12-note") groupvar(tmt_cl) replace onerow vce(cluster test_cluster_var) ftest feqtest total cov(mpg) fixed(foreign) addnote("added onerow and cluster") browse - -\begin{tabular}{@{\extracolsep{5pt}}lccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{F-test for balance} & \multicolumn{1}{c}{(2)-(3)} \\ - & \multicolumn{1}{c}{Total} & \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{across all groups} & \multicolumn{1}{c}{Pairwise t-test} \\ -Variable & Mean/(SE) & Mean/(SE) & Mean/(SE) & F-stat/P-value & Mean difference \\ \hline \\[-1.8ex] -weight & 3019.459 & 3084.516 & 2972.558 & 3.353 & 111.958 \\ - & (107.435) & (98.439) & (209.010) & 0.164 & \\ [1ex] -price & 6165.257 & 5961.065 & 6312.465 & 1.695 & -351.401 \\ - & (451.828) & (125.692) & (917.571) & 0.284 & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & 1.128 \\ -\hline \\[-1.8ex] -Number of observations & 74 & 31 & 43 & 74 & 74 \\ -Number of clusters & 4 & 2 & 2 & 4 & 4 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex13-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex13-note.tex deleted file mode 100644 index 8bd31b1f..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex13-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv13") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx13") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13-note") groupvar(tmt\_cl) replace ftest control(1) stats(f(p) pair(nrmd)) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex13.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex13.tex deleted file mode 100644 index f50fc1a3..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex13.tex +++ /dev/null @@ -1,21 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv13") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx13") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex13-note") groupvar(tmt_cl) replace ftest control(1) stats(f(p) pair(nrmd)) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Normalized difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 0.147 \\ - & & (130.959) & & (117.753) & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & -0.120 \\ - & & (486.238) & & (470.476) & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (P-value) & & & & & & 0.273 \\ -F-test, number of observations & & & & & & 74 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex14-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex14-note.tex deleted file mode 100644 index 77a610e9..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex14-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in f-test regressions: [mpg]. Fixed effect used in f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv14") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx14") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14-note") groupvar(tmt\_cl) replace ftest feqtest control(1) stats(pair(none)) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex14.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex14.tex deleted file mode 100644 index 7b66201b..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex14.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv14") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx14") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex14-note") groupvar(tmt_cl) replace ftest feqtest control(1) stats(pair(none)) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 \\ - & & (130.959) & & (117.753) & & 0.106 \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 \\ - & & (486.238) & & (470.476) & & 0.339 \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex15-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex15-note.tex deleted file mode 100644 index f7a322ec..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex15-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv15") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx15") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15-note") groupvar(tmt\_cl) replace ftest control(1) stats(pair(se)) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex15.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex15.tex deleted file mode 100644 index 9b11afff..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex15.tex +++ /dev/null @@ -1,21 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv15") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx15") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex15-note") groupvar(tmt_cl) replace ftest control(1) stats(pair(se)) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Standard error \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 95.502 \\ - & & (130.959) & & (117.753) & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 610.296 \\ - & & (486.238) & & (470.476) & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & 1.325 \\ -F-test, number of observations & & & & & & 74 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex16-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex16-note.tex deleted file mode 100644 index 875b0cc6..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex16-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv16") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx16") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16-note") groupvar(tmt\_cl) replace stats(pair(nrmd)) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex16.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex16.tex deleted file mode 100644 index 7993b850..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex16.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv16") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx16") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex16-note") groupvar(tmt_cl) replace stats(pair(nrmd)) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Normalized difference \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 0.147 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & -0.120 \\ - & & (470.476) & & (486.238) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex17-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex17-note.tex deleted file mode 100644 index 958d33e5..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex17-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv17") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx17") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17-note") groupvar(tmt\_cl) replace stats(pair(nrmb)) cov(mpg) fixed(foreign)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex17.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex17.tex deleted file mode 100644 index e8a64b11..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex17.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv17") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx17") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex17-note") groupvar(tmt_cl) replace stats(pair(nrmb)) cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Normalized beta coefficient \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & -0.205 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & -0.202 \\ - & & (470.476) & & (486.238) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex18-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex18-note.tex deleted file mode 100644 index 1b03a956..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex18-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv18") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx18") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18-note") groupvar(tmt\_cl) replace stats(pair(diff))] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex18.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex18.tex deleted file mode 100644 index 9784ec03..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex18.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv18") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx18") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex18-note") groupvar(tmt_cl) replace stats(pair(diff)) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 111.958 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & -351.401 \\ - & & (470.476) & & (486.238) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex19-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex19-note.tex deleted file mode 100644 index 1b9f664d..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex19-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv19") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx19") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19-note") groupvar(tmt\_cl) replace stats(pair(beta))] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex19.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex19.tex deleted file mode 100644 index b03578f8..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex19.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv19") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx19") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex19-note") groupvar(tmt_cl) replace stats(pair(beta)) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Beta coefficient \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 111.958 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & -351.401 \\ - & & (470.476) & & (486.238) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex2.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex2.tex deleted file mode 100644 index 5fa8c818..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex2.tex +++ /dev/null @@ -1,23 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , groupvar(tmt_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex2") cov(mpg) fixed(foreign) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 & 74 & 111.958 \\ - & & (130.959) & & (117.753) & & 0.106 & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 & 74 & -351.401 \\ - & & (486.238) & & (470.476) & & 0.339 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.325 \\ -F-test, number of observations & & & & & & & & 74 \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , groupvar(tmt\_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex2") cov(mpg) fixed(foreign)] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex20-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex20-note.tex deleted file mode 100644 index 8497b416..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex20-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Errors are robust. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv20") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx20") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20-note") groupvar(tmt\_cl) replace stats(desc(var) pair(t)) vce(robust)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex20.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex20.tex deleted file mode 100644 index b177bccc..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex20.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv20") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx20") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex20-note") groupvar(tmt_cl) replace stats(desc(var) pair(t)) vce(robust) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(Var) & N & Mean/(Var) & N & t-statistics \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 0.636 \\ - & & (4.30e+05) & & (7.37e+05) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & -0.520 \\ - & & (6.86e+06) & & (1.02e+07) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex21-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex21-note.tex deleted file mode 100644 index a7c94210..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex21-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Errors are estimeated using bootstrap. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv21") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx21") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21-note") groupvar(tmt\_cl) replace stats(desc(sd) pair(p)) vce(bootstrap)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex21.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex21.tex deleted file mode 100644 index ccbc7a44..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex21.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv21") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx21") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex21-note") groupvar(tmt_cl) replace stats(desc(sd) pair(p)) vce(bootstrap) - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SD) & N & Mean/(SD) & N & P-value \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 0.534 \\ - & & (654.062) & & (1017.754) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 74 & 0.657 \\ - & & (2631.060) & & (3404.746) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex22-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex22-note.tex deleted file mode 100644 index 74c1d3a3..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex22-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.001, **=.2, *=.4. Full user input as written by user: [iebaltab mpg headroom trunk weight length turn price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv22") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx22") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22-note") groupvar(tmt\_cl) replace onerow stats(pair(p)) starlevels(.4 .2 .001)] diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex22.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex22.tex deleted file mode 100644 index bfbf02de..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex22.tex +++ /dev/null @@ -1,30 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab mpg headroom trunk weight length turn price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv22") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx22") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex22-note") groupvar(tmt_cl) replace onerow stats(pair(p)) starlevels(.4 .2 .001) - -\begin{tabular}{@{\extracolsep{5pt}}lccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(1)-(2)} \\ - & \multicolumn{1}{c}{0} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{Pairwise t-test} \\ -Variable & Mean/(SE) & Mean/(SE) & P-value \\ \hline \\[-1.8ex] -mpg & 20.258 & 20.092 & 0.895 \\ - & (0.759) & (0.910) & \\ [1ex] -headroom & 2.935 & 2.723 & 0.273* \\ - & (0.155) & (0.119) & \\ [1ex] -trunk & 14.097 & 12.127 & 0.039** \\ - & (0.793) & (0.555) & \\ [1ex] -weight & 3084.516 & 2650.042 & 0.014** \\ - & (117.753) & (118.860) & \\ [1ex] -length & 190.323 & 164.671 & 0.000*** \\ - & (3.472) & (3.795) & \\ [1ex] -turn & 40.226 & 34.692 & 0.000*** \\ - & (0.664) & (0.739) & \\ [1ex] -price & 5961.065 & 5702.614 & 0.695 \\ - & (470.476) & (442.505) & \\ [1ex] -\hline \\[-1.8ex] -Number of observations & 31 & 43 & 74 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex23.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex23.tex deleted file mode 100644 index c1fdbf49..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex23.tex +++ /dev/null @@ -1,24 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab mpg trunk weight turn price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv23") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx23") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex23") grpvar(tmt_cl) grpcodes replace starsnoadd stats(pair(p)) tblnonote grplabels("0 Control @ 1 Treatment") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Control} & \multicolumn{2}{c}{Treatment} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & P-value \\ \hline \\[-1.8ex] -mpg & 31 & 20.258 & 43 & 20.092 & 74 & 0.895 \\ - & & (0.759) & & (0.910) & & \\ [1ex] -trunk & 31 & 14.097 & 43 & 12.150 & 74 & 0.051 \\ - & & (0.793) & & (0.606) & & \\ [1ex] -weight & 31 & 3084.516 & 43 & 2671.920 & 74 & 0.016 \\ - & & (117.753) & & (113.337) & & \\ [1ex] -turn & 31 & 40.226 & 43 & 34.994 & 74 & 0.000 \\ - & & (0.664) & & (0.731) & & \\ [1ex] -price & 31 & 5961.065 & 43 & 5604.701 & 74 & 0.595 \\ - & & (470.476) & & (453.973) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex24a-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex24a-note.tex deleted file mode 100644 index 0b42c9ca..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex24a-note.tex +++ /dev/null @@ -1 +0,0 @@ -added a "tricky" note diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex24a.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex24a.tex deleted file mode 100644 index c7dd72f9..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex24a.tex +++ /dev/null @@ -1,16 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv24a") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx24a") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex24a-note") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex24a") replace groupvar(tmt_cl) nonote addnote(`"added a "tricky" note"') - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 111.958 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex24b.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex24b.tex deleted file mode 100644 index 66c8e441..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex24b.tex +++ /dev/null @@ -1,16 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv24b") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx24b") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex24b") replace groupvar(tmt_cl) nonote - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 43 & 2972.558 & 74 & 111.958 \\ - & & (117.753) & & (130.959) & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex3.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex3.tex deleted file mode 100644 index 22fe22f1..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex3.tex +++ /dev/null @@ -1,23 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , groupvar(tmt_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex3") cov(mpg) fixed(foreign) texcolwidth(4cm) addnote("Options used: texcolwidth(3cm) short first column ") - -\begin{tabular}{@{\extracolsep{5pt}}p{4cm}cccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 & 74 & 111.958 \\ - & & (130.959) & & (117.753) & & 0.106 & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 & 74 & -351.401 \\ - & & (486.238) & & (470.476) & & 0.339 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.325 \\ -F-test, number of observations & & & & & & & & 74 \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , groupvar(tmt\_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex3") cov(mpg) fixed(foreign) texcolwidth(4cm) addnote("Options used: texcolwidth(3cm) short first column ")] Options used: texcolwidth(3cm) short first column } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex6-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex6-note.tex deleted file mode 100644 index d7ee8479..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex6-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv6") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx6") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6-note") groupvar(tmt) replace ftest feqtest total rowvarlabels cov(mpg) fixed(foreign) addnote("Many groups, rowvarlabels")] Many groups, rowvarlabels diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex6.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex6.tex deleted file mode 100644 index feeaa63e..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex6.tex +++ /dev/null @@ -1,21 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv6") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx6") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex6-note") groupvar(tmt) replace ftest feqtest total rowvarlabels cov(mpg) fixed(foreign) addnote("Many groups, rowvarlabels") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccccccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(3)} & \multicolumn{2}{c}{(2)-(4)} & \multicolumn{2}{c}{(2)-(5)} & \multicolumn{2}{c}{(3)-(4)} & \multicolumn{2}{c}{(3)-(5)} & \multicolumn{2}{c}{(4)-(5)} \\ - & \multicolumn{2}{c}{Total} & \multicolumn{2}{c}{Oi in \%} & \multicolumn{2}{c}{control/unobserved} & \multicolumn{2}{c}{taco \& salsa} & \multicolumn{2}{c}{10231} & \multicolumn{2}{c}{across all groups} & \multicolumn{12}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference & N & Mean difference & N & Mean difference & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -Weight (lbs.) & 74 & 3019.459 & 22 & 3176.818 & 21 & 2758.571 & 19 & 3004.211 & 12 & 3211.667 & 74 & 1.936 & 43 & 418.247 & 41 & 172.608** & 34 & -34.848 & 40 & -245.639 & 33 & -453.095 & 31 & -207.456 \\ - & & (90.347) & & (172.374) & & (191.277) & & (157.068) & & (177.127) & & 0.132 & & & & & & & & & & & & \\ [1ex] -Price & 74 & 6165.257 & 22 & 7209.182 & 21 & 5373.048 & 19 & 5858.526 & 12 & 6123.417 & 74 & 1.101 & 43 & 1836.134 & 41 & 1350.656 & 34 & 1085.765 & 40 & -485.479 & 33 & -750.369 & 31 & -264.890 \\ - & & (342.872) & & (776.498) & & (516.864) & & (605.744) & & (777.763) & & 0.355 & & & & & & & & & & & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & & & & & & & 1.388 & & 2.807* & & 0.828 & & 0.605 & & 0.012 & & 0.182 \\ -F-test, number of observations & & & & & & & & & & & & & & 43 & & 41 & & 34 & & 40 & & 33 & & 31 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex7-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex7-note.tex deleted file mode 100644 index c83b6ac5..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex7-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv7") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx7") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7-note") groupvar(tmt) replace total order(4 10231) control(6) groupcodes cov(mpg) fixed(foreign) addnote("column order should be 4 10231 6 2, and 6 is control so pair test only with this group")] column order should be 4 10231 6 2, and 6 is control so pair test only with this group diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex7.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex7.tex deleted file mode 100644 index 834f8f92..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex7.tex +++ /dev/null @@ -1,18 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv7") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx7") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex7-note") groupvar(tmt) replace total order(4 10231) control(6) groupcodes cov(mpg) fixed(foreign) addnote("column order should be 4 10231 6 2, and 6 is control so pair test only with this group") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(2)-(4)} & \multicolumn{2}{c}{(3)-(4)} & \multicolumn{2}{c}{(5)-(4)} \\ - & \multicolumn{2}{c}{Total} & \multicolumn{2}{c}{4} & \multicolumn{2}{c}{10231} & \multicolumn{2}{c}{6} & \multicolumn{2}{c}{2} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -weight & 74 & 3019.459 & 21 & 2758.571 & 12 & 3211.667 & 19 & 3004.211 & 22 & 3176.818 & 40 & -245.639 & 31 & 207.456 & 41 & 172.608** \\ - & & (90.347) & & (191.277) & & (177.127) & & (157.068) & & (172.374) & & & & & & \\ [1ex] -price & 74 & 6165.257 & 21 & 5373.048 & 12 & 6123.417 & 19 & 5858.526 & 22 & 7209.182 & 40 & -485.479 & 31 & 264.890 & 41 & 1350.656 \\ - & & (342.872) & & (516.864) & & (777.763) & & (605.744) & & (776.498) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex8-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex8-note.tex deleted file mode 100644 index 42881ddf..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex8-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [mpg]. Fixed effect used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price headroom , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv8") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx8") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8-note") groupvar(tmt) replace total control(6) rowvarlabels grouplabels(`"6 Quotes, and comma "," @ 4 Pizza \& Pineapple (USD\$) "') totallabel("Total single ' quote") cov(mpg) fixed(foreign) rowlabels(`"price St*r and sub \_script @ headroom Headroom "Height" quote "') addnote("Row column manual (\$) lables.")] Row column manual (\$) lables. diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex8.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex8.tex deleted file mode 100644 index 4c30dbdb..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex8.tex +++ /dev/null @@ -1,20 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price headroom , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv8") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx8") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex8-note") groupvar(tmt) replace total control(6) rowvarlabels grouplabels(`"6 Quotes, and comma "," @ 4 Pizza & Pineapple (USD$) "') totallabel("Total single ' quote") cov(mpg) fixed(foreign) rowlabels(`"price St*r and sub _script @ headroom Headroom "Height" quote "') addnote("Row column manual ($) lables.") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(3)-(2)} & \multicolumn{2}{c}{(4)-(2)} & \multicolumn{2}{c}{(5)-(2)} \\ - & \multicolumn{2}{c}{Total single ' quote} & \multicolumn{2}{c}{Quotes, and comma ","} & \multicolumn{2}{c}{Oi in \%} & \multicolumn{2}{c}{Pizza \& Pineapple (USD\$)} & \multicolumn{2}{c}{10231} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -Weight (USD\$) & 74 & 3019.459 & 19 & 3004.211 & 22 & 3176.818 & 21 & 2758.571 & 12 & 3211.667 & 41 & 172.608** & 40 & -245.639 & 31 & 207.456 \\ - & & (90.347) & & (157.068) & & (172.374) & & (191.277) & & (177.127) & & & & & & \\ [1ex] -St*r and sub \_script & 74 & 6165.257 & 19 & 5858.526 & 22 & 7209.182 & 21 & 5373.048 & 12 & 6123.417 & 41 & 1350.656 & 40 & -485.479 & 31 & 264.890 \\ - & & (342.872) & & (605.744) & & (776.498) & & (516.864) & & (777.763) & & & & & & \\ [1ex] -Headroom "Height" quote & 74 & 2.993 & 19 & 2.895 & 22 & 3.114 & 21 & 2.952 & 12 & 3.000 & 41 & 0.219 & 40 & 0.058 & 31 & 0.105 \\ - & & (0.098) & & (0.190) & & (0.189) & & (0.176) & & (0.275) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex9-note.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex9-note.tex deleted file mode 100644 index af21f213..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex9-note.tex +++ /dev/null @@ -1 +0,0 @@ -If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv9") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx9") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9-note") groupvar(tmt\_cl) replace ftest feqtest cov(mpg) fixed(foreign) addnote("Warning for missing value in fixedeffect(foreign) and in covariates(mpg)")] Warning for missing value in fixedeffect(foreign) and in covariates(mpg) diff --git a/run/iebaltab/outputs/iebaltab1/iebt-tex9.tex b/run/iebaltab/outputs/iebaltab1/iebt-tex9.tex deleted file mode 100644 index 367cbe45..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-tex9.tex +++ /dev/null @@ -1,21 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab weight price , savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-csv9") savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-xlsx9") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9") texnotefile("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-tex9-note") groupvar(tmt_cl) replace ftest feqtest cov(mpg) fixed(foreign) addnote("Warning for missing value in fixedeffect(foreign) and in covariates(mpg)") - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 31 & 3084.516 & 42 & 2980.476 & 71 & 2.681 & 71 & 104.040 \\ - & & (117.753) & & (133.869) & & 0.106 & & \\ [1ex] -price & 31 & 5961.065 & 43 & 6312.465 & 72 & 0.742 & 72 & -351.401 \\ - & & (470.476) & & (486.238) & & 0.392 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.324 \\ -F-test, number of observations & & & & & & & & 71 \\ -\hline \hline \\[-1.8ex] - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-texdoc4.tex b/run/iebaltab/outputs/iebaltab1/iebt-texdoc4.tex deleted file mode 100644 index 497e9ef2..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-texdoc4.tex +++ /dev/null @@ -1,32 +0,0 @@ -\documentclass{article} - -% ----- Preamble -\usepackage[utf8]{inputenc} -\usepackage{adjustbox} -% ----- End of preamble - - \begin{document} - -\begin{table}[!htbp] -\centering -\begin{adjustbox}{max width=\textwidth} -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 & 74 & 111.958 \\ - & & (130.959) & & (117.753) & & 0.106 & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 & 74 & -351.401 \\ - & & (486.238) & & (470.476) & & 0.339 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.325 \\ -F-test, number of observations & & & & & & & & 74 \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , groupvar(tmt\_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-texdoc4") cov(mpg) fixed(foreign) texdocument] } - -\end{tabular} -\end{adjustbox} -\end{table} -\end{document} diff --git a/run/iebaltab/outputs/iebaltab1/iebt-texdoc5.tex b/run/iebaltab/outputs/iebaltab1/iebt-texdoc5.tex deleted file mode 100644 index bedbbeee..00000000 --- a/run/iebaltab/outputs/iebaltab1/iebt-texdoc5.tex +++ /dev/null @@ -1,34 +0,0 @@ -\documentclass{article} - -% ----- Preamble -\usepackage[utf8]{inputenc} -\usepackage{adjustbox} -% ----- End of preamble - - \begin{document} - -\begin{table}[!htbp] -\centering -\caption{Table 5} -\label{T5} -\begin{adjustbox}{max width=\textwidth} -\begin{tabular}{@{\extracolsep{5pt}}p{2cm}cccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -weight & 43 & 2972.558 & 31 & 3084.516 & 74 & 2.679 & 74 & 111.958 \\ - & & (130.959) & & (117.753) & & 0.106 & & \\ [1ex] -price & 43 & 6312.465 & 31 & 5961.065 & 74 & 0.928 & 74 & -351.401 \\ - & & (486.238) & & (470.476) & & 0.339 & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & & & 1.325 \\ -F-test, number of observations & & & & & & & & 74 \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{1.5\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise and f-test regressions: [mpg]. Fixed effect used in pairwise and f-test regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab weight price , groupvar(tmt\_cl) replace ftest feqtest control(1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab1/iebt-texdoc5") cov(mpg) fixed(foreign) texdocument texnotewidth(1.5) texcolwidth(2cm) texcaption("Table 5") texlabel("T5")] } - -\end{tabular} -\end{adjustbox} -\end{table} -\end{document} diff --git a/run/iebaltab/outputs/iebaltab1_tex_main.tex b/run/iebaltab/outputs/iebaltab1_tex_main.tex deleted file mode 100644 index b04c9076..00000000 --- a/run/iebaltab/outputs/iebaltab1_tex_main.tex +++ /dev/null @@ -1,330 +0,0 @@ -%%% Table created in Stata by iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) - -\documentclass{report} - -% ----- Preamble -\usepackage[utf8]{inputenc} -\usepackage{adjustbox} -\usepackage{threeparttable} -\usepackage[]{geometry} -\geometry{landscape, margin=1in} - - -% ----- End of preamble - -\begin{document} - - - -% Table 1 -\begin{table} - \centering - \caption{iebt-tex1} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex1} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex1-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 2 -\begin{table}[!h] - \centering - \caption{iebt-tex2} - \begin{adjustbox}{max width=\textwidth} - \input{iebaltab1/iebt-tex2.tex} - \end{adjustbox} -\end{table} - -% Table 3 -\begin{table}[!h] - \centering - \caption{iebt-tex3} - \begin{adjustbox}{max width=\textwidth} - \input{iebaltab1/iebt-tex3.tex} - \end{adjustbox} -\end{table} - -Table 4 is stand alone doc - -Table 5 is stand alone doc - -% Table 6 -\begin{table} - \centering - \caption{File iebt-tex6} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex6.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex6-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 7 -\begin{table} - \centering - \caption{File iebt-tex7} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex7.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex7-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 8 -\begin{table} - \centering - \caption{File iebt-tex8} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex8.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex8-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - - -% Table 9 -\begin{table} - \centering - \caption{File iebt-tex9} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex9.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex9-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 10 -\begin{table} - \centering - \caption{File iebt-tex10} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex10.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex10-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 11 -\begin{table} - \centering - \caption{File iebt-tex11} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex11.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex11-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 12 -\begin{table} - \centering - \caption{File iebt-tex12} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex12.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex12-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 13 -\begin{table} - \centering - \caption{File iebt-tex13} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex13.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex13-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 14 -\begin{table} - \centering - \caption{File iebt-tex14} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex14.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex14-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 15 -\begin{table} - \centering - \caption{File iebt-tex15} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex15.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex15-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 16 -\begin{table} - \centering - \caption{File iebt-tex16} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex16.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex16-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 17 -\begin{table} - \centering - \caption{File iebt-tex17} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex17.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex17-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 18 -\begin{table} - \centering - \caption{File iebt-tex18} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex18.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex18-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 19 -\begin{table} - \centering - \caption{File iebt-tex19} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex19.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex19-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 20 -\begin{table} - \centering - \caption{File iebt-tex20} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex20.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex20-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 21 -\begin{table} - \centering - \caption{File iebt-tex21} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex21.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex21-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 22 -\begin{table} - \centering - \caption{File iebt-tex22} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex22.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex22-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 23 -\begin{table}[!h] - \centering - \caption{iebt-tex23} - \begin{adjustbox}{max width=\textwidth} - \input{iebaltab1/iebt-tex23.tex} - \end{adjustbox} -\end{table} - - -% Table 24a -\begin{table} - \centering - \caption{File iebt-tex24a} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{iebaltab1/iebt-tex24a.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{iebaltab1/iebt-tex24a-note} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} -\end{table} - -% Table 24b -\begin{table}[!h] - \centering - \caption{iebt-tex24b} - \begin{adjustbox}{max width=\textwidth} - \input{iebaltab1/iebt-tex24b.tex} - \end{adjustbox} -\end{table} - - -\end{document} diff --git a/run/iebaltab/outputs/iebaltab2/2g-cluster.tex b/run/iebaltab/outputs/iebaltab2/2g-cluster.tex deleted file mode 100644 index 45adb152..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-cluster.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) vce(cluster stratum) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-cluster.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N/Clusters & Mean/(SE) & N/Clusters & Mean/(SE) & N/Clusters & P-value \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & 0.733 \\ - & 11 & (719.524) & 12 & (570.687) & 23 & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & 0.004*** \\ - & 11 & (0.933) & 12 & (1.272) & 23 & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 0.011** \\ - & 11 & (0.587) & 12 & (1.068) & 23 & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.003*** \\ - & 11 & (0.118) & 12 & (0.115) & 23 & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 0.000*** \\ - & 11 & (129.622) & 12 & (99.904) & 23 & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 0.000*** \\ - & 11 & (3.677) & 12 & (3.269) & 23 & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 0.000*** \\ - & 11 & (0.693) & 12 & (0.272) & 23 & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 0.000*** \\ - & 11 & (17.077) & 12 & (5.763) & 23 & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & 0.000*** \\ - & 11 & (0.067) & 12 & (0.094) & 23 & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Errors are clustered at variable: [stratum]. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) vce(cluster stratum) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-cluster.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-control.csv b/run/iebaltab/outputs/iebaltab2/2g-control.csv deleted file mode 100644 index 358ac51e..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-control.csv +++ /dev/null @@ -1,22 +0,0 @@ -"",""," (1) ",""," (2) ","","(1)-(2)" -"","","Domestic","","Foreign","","Pairwise t-test" -"Variable","N","Mean/(SE)","N","Mean/(SE)","N","Mean difference" -"price","52","6072.423","22","6384.682","74","-312.259" -"","","(429.491)","","(558.994)","","" -"mpg","52","19.827","22","24.773","74","-4.946***" -"","","(0.658)","","(1.410)","","" -"trunk","52","14.750","22","11.409","74","3.341***" -"","","(0.597)","","(0.686)","","" -"headroom","52","3.154","22","2.614","74","0.540**" -"","","(0.127)","","(0.104)","","" -"weight","52","3317.115","22","2315.909","74","1001.206***" -"","","(96.430)","","(92.317)","","" -"length","52","196.135","22","168.545","74","27.589***" -"","","(2.780)","","(2.917)","","" -"turn","52","41.442","22","35.409","74","6.033***" -"","","(0.550)","","(0.320)","","" -"displacement","52","233.712","22","111.227","74","122.484***" -"","","(11.824)","","(5.305)","","" -"gear_ratio","52","2.807","22","3.507","74","-0.701***" -"","","(0.047)","","(0.063)","","" -"If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) savexlsx(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.xlsx"") savecsv(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-control.csv"") savetex(""C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.tex"") replace] ","","","","","","" diff --git a/run/iebaltab/outputs/iebaltab2/2g-control.tex b/run/iebaltab/outputs/iebaltab2/2g-control.tex deleted file mode 100644 index e5661376..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-control.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) control(0) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-control.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(2)-(1)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & 312.259 \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & 4.946*** \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & -3.341*** \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & -0.540** \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & -1001.206*** \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & -27.589*** \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & -6.033*** \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & -122.484*** \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & 0.701*** \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) control(0) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-control.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-fe.tex b/run/iebaltab/outputs/iebaltab2/2g-fe.tex deleted file mode 100644 index 8d8f2580..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-fe.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) fixedeffect(stratum) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-fe.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259*** \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & -4.946 \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 3.341 \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.540 \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206 \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 27.589 \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 6.033 \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 122.484 \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & -0.701 \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Fixed effect used in pairwise regressions: [stratum]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) fixedeffect(stratum) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-fe.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-feqtest.tex b/run/iebaltab/outputs/iebaltab2/2g-feqtest.tex deleted file mode 100644 index 9a7a6073..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-feqtest.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) fixedeffect(stratum) feqtest savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-feqtest.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{F-test for balance} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{across all groups} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & F-stat/P-value & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & 18.611*** & 74 & -312.259*** \\ - & & (429.491) & & (558.994) & & 0.000 & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & 0.387 & 74 & -4.946 \\ - & & (0.658) & & (1.410) & & 0.537 & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 0.352 & 74 & 3.341 \\ - & & (0.597) & & (0.686) & & 0.555 & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.117 & 74 & 0.540 \\ - & & (0.127) & & (0.104) & & 0.733 & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 0.110 & 74 & 1001.206 \\ - & & (96.430) & & (92.317) & & 0.741 & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 0.942 & 74 & 27.589 \\ - & & (2.780) & & (2.917) & & 0.336 & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 0.127 & 74 & 6.033 \\ - & & (0.550) & & (0.320) & & 0.723 & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 0.003 & 74 & 122.484 \\ - & & (11.824) & & (5.305) & & 0.956 & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & 0.085 & 74 & -0.701 \\ - & & (0.047) & & (0.063) & & 0.771 & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Fixed effect used in pairwise and f-test regressions: [stratum]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) fixedeffect(stratum) feqtest savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-feqtest.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-fmt.tex b/run/iebaltab/outputs/iebaltab2/2g-fmt.tex deleted file mode 100644 index 7d158475..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-fmt.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) format("%9.2f") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-fmt.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.42 & 22 & 6384.68 & 74 & -312.26 \\ - & & (429.49) & & (558.99) & & \\ [1ex] -mpg & 52 & 19.83 & 22 & 24.77 & 74 & -4.95*** \\ - & & (0.66) & & (1.41) & & \\ [1ex] -trunk & 52 & 14.75 & 22 & 11.41 & 74 & 3.34*** \\ - & & (0.60) & & (0.69) & & \\ [1ex] -headroom & 52 & 3.15 & 22 & 2.61 & 74 & 0.54** \\ - & & (0.13) & & (0.10) & & \\ [1ex] -weight & 52 & 3317.12 & 22 & 2315.91 & 74 & 1001.21*** \\ - & & (96.43) & & (92.32) & & \\ [1ex] -length & 52 & 196.13 & 22 & 168.55 & 74 & 27.59*** \\ - & & (2.78) & & (2.92) & & \\ [1ex] -turn & 52 & 41.44 & 22 & 35.41 & 74 & 6.03*** \\ - & & (0.55) & & (0.32) & & \\ [1ex] -displacement & 52 & 233.71 & 22 & 111.23 & 74 & 122.48*** \\ - & & (11.82) & & (5.30) & & \\ [1ex] -gear\_ratio & 52 & 2.81 & 22 & 3.51 & 74 & -0.70*** \\ - & & (0.05) & & (0.06) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) format("\%9.2f") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-fmt.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-ftest.tex b/run/iebaltab/outputs/iebaltab2/2g-ftest.tex deleted file mode 100644 index 7eb52217..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-ftest.tex +++ /dev/null @@ -1,37 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) fixedeffect(stratum) ftest savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-ftest.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259*** \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & -4.946 \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 3.341 \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.540 \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206 \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 27.589 \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 6.033 \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 122.484 \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & -0.701 \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \\[-1.8ex] -F-test of joint significance (F-stat) & & & & & & .v \\ -F-test, number of observations & & & & & & .v \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Fixed effect used in pairwise and f-test regressions: [stratum]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) fixedeffect(stratum) ftest savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-ftest.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-nostars.tex b/run/iebaltab/outputs/iebaltab2/2g-nostars.tex deleted file mode 100644 index 9a78e167..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-nostars.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) starsnoadd savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-nostars.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259 \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & -4.946 \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 3.341 \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.540 \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206 \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 27.589 \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 6.033 \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 122.484 \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & -0.701 \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) starsnoadd savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-nostars.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-onerow.tex b/run/iebaltab/outputs/iebaltab2/2g-onerow.tex deleted file mode 100644 index 7b40dbea..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-onerow.tex +++ /dev/null @@ -1,36 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) onerow savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-onerow.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(1)-(2)} \\ - & \multicolumn{1}{c}{Domestic} & \multicolumn{1}{c}{Foreign} & \multicolumn{1}{c}{Pairwise t-test} \\ -Variable & Mean/(SE) & Mean/(SE) & Mean difference \\ \hline \\[-1.8ex] -price & 6072.423 & 6384.682 & -312.259 \\ - & (429.491) & (558.994) & \\ [1ex] -mpg & 19.827 & 24.773 & -4.946*** \\ - & (0.658) & (1.410) & \\ [1ex] -trunk & 14.750 & 11.409 & 3.341*** \\ - & (0.597) & (0.686) & \\ [1ex] -headroom & 3.154 & 2.614 & 0.540** \\ - & (0.127) & (0.104) & \\ [1ex] -weight & 3317.115 & 2315.909 & 1001.206*** \\ - & (96.430) & (92.317) & \\ [1ex] -length & 196.135 & 168.545 & 27.589*** \\ - & (2.780) & (2.917) & \\ [1ex] -turn & 41.442 & 35.409 & 6.033*** \\ - & (0.550) & (0.320) & \\ [1ex] -displacement & 233.712 & 111.227 & 122.484*** \\ - & (11.824) & (5.305) & \\ [1ex] -gear\_ratio & 2.807 & 3.507 & -0.701*** \\ - & (0.047) & (0.063) & \\ [1ex] -\hline \\[-1.8ex] -Number of observations & 52 & 22 & 74 \\ -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{4}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) onerow savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-onerow.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-pair.tex b/run/iebaltab/outputs/iebaltab2/2g-pair.tex deleted file mode 100644 index ec09a1d8..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-pair.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-pair.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & P-value \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & 0.680 \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & 0.001*** \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 0.002*** \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.011** \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 0.000*** \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 0.000*** \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 0.000*** \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 0.000*** \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & 0.000*** \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-pair.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-stars.tex b/run/iebaltab/outputs/iebaltab2/2g-stars.tex deleted file mode 100644 index e08e2c42..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-stars.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) starlevels(.05 .01 .001) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-stars.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259 \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & -4.946*** \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 3.341** \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.540* \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206*** \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 27.589*** \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 6.033*** \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 122.484*** \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & -0.701*** \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.001, **=.01, *=.05. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) starlevels(.05 .01 .001) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-stars.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g-total.tex b/run/iebaltab/outputs/iebaltab2/2g-total.tex deleted file mode 100644 index a470aac5..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g-total.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) total savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-total.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{Total} & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 74 & 6165.257 & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259 \\ - & & (342.872) & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 74 & 21.297 & 52 & 19.827 & 22 & 24.773 & 74 & -4.946*** \\ - & & (0.673) & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 74 & 13.757 & 52 & 14.750 & 22 & 11.409 & 74 & 3.341*** \\ - & & (0.497) & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 74 & 2.993 & 52 & 3.154 & 22 & 2.614 & 74 & 0.540** \\ - & & (0.098) & & (0.127) & & (0.104) & & \\ [1ex] -weight & 74 & 3019.459 & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206*** \\ - & & (90.347) & & (96.430) & & (92.317) & & \\ [1ex] -length & 74 & 187.932 & 52 & 196.135 & 22 & 168.545 & 74 & 27.589*** \\ - & & (2.588) & & (2.780) & & (2.917) & & \\ [1ex] -turn & 74 & 39.649 & 52 & 41.442 & 22 & 35.409 & 74 & 6.033*** \\ - & & (0.511) & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 74 & 197.297 & 52 & 233.712 & 22 & 111.227 & 74 & 122.484*** \\ - & & (10.676) & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 74 & 3.015 & 52 & 2.807 & 22 & 3.507 & 74 & -0.701*** \\ - & & (0.053) & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{8}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) total savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-total.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/2g.tex b/run/iebaltab/outputs/iebaltab2/2g.tex deleted file mode 100644 index 56230af8..00000000 --- a/run/iebaltab/outputs/iebaltab2/2g.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(foreign) savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.xlsx") savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-control.csv") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(1)-(2)} \\ - & \multicolumn{2}{c}{Domestic} & \multicolumn{2}{c}{Foreign} & \multicolumn{2}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference \\ \hline \\[-1.8ex] -price & 52 & 6072.423 & 22 & 6384.682 & 74 & -312.259 \\ - & & (429.491) & & (558.994) & & \\ [1ex] -mpg & 52 & 19.827 & 22 & 24.773 & 74 & -4.946*** \\ - & & (0.658) & & (1.410) & & \\ [1ex] -trunk & 52 & 14.750 & 22 & 11.409 & 74 & 3.341*** \\ - & & (0.597) & & (0.686) & & \\ [1ex] -headroom & 52 & 3.154 & 22 & 2.614 & 74 & 0.540** \\ - & & (0.127) & & (0.104) & & \\ [1ex] -weight & 52 & 3317.115 & 22 & 2315.909 & 74 & 1001.206*** \\ - & & (96.430) & & (92.317) & & \\ [1ex] -length & 52 & 196.135 & 22 & 168.545 & 74 & 27.589*** \\ - & & (2.780) & & (2.917) & & \\ [1ex] -turn & 52 & 41.442 & 22 & 35.409 & 74 & 6.033*** \\ - & & (0.550) & & (0.320) & & \\ [1ex] -displacement & 52 & 233.712 & 22 & 111.227 & 74 & 122.484*** \\ - & & (11.824) & & (5.305) & & \\ [1ex] -gear\_ratio & 52 & 2.807 & 22 & 3.507 & 74 & -0.701*** \\ - & & (0.047) & & (0.063) & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{6}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(foreign) savexlsx("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.xlsx") savecsv("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g-control.csv") savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/2g.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g-control-order.tex b/run/iebaltab/outputs/iebaltab2/3g-control-order.tex deleted file mode 100644 index 6d5a62ef..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g-control-order.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) control(0) order(2 1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-control-order.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(1)-(3)} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{2} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{0} & \multicolumn{4}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -price & 19 & 6090.105 & 27 & 6424.667 & 28 & 5966.107 & 47 & 123.998 & 55 & 458.560 \\ - & & (627.491) & & (685.222) & & (471.068) & & & & \\ [1ex] -mpg & 19 & 22.263 & 27 & 20.926 & 28 & 21.000 & 47 & 1.263 & 55 & -0.074 \\ - & & (1.337) & & (1.055) & & (1.165) & & & & \\ [1ex] -trunk & 19 & 12.474 & 27 & 14.370 & 28 & 14.036 & 47 & -1.562 & 55 & 0.335 \\ - & & (1.018) & & (0.776) & & (0.825) & & & & \\ [1ex] -headroom & 19 & 2.737 & 27 & 2.907 & 28 & 3.250 & 47 & -0.513** & 55 & -0.343 \\ - & & (0.181) & & (0.158) & & (0.164) & & & & \\ [1ex] -weight & 19 & 2839.474 & 27 & 3037.037 & 28 & 3124.643 & 47 & -285.169 & 55 & -87.606 \\ - & & (166.371) & & (163.498) & & (140.524) & & & & \\ [1ex] -length & 19 & 182.947 & 27 & 188.111 & 28 & 191.143 & 47 & -8.195 & 55 & -3.032 \\ - & & (4.925) & & (4.429) & & (4.205) & & & & \\ [1ex] -turn & 19 & 38.368 & 27 & 40.000 & 28 & 40.179 & 47 & -1.810 & 55 & -0.179 \\ - & & (0.943) & & (0.925) & & (0.785) & & & & \\ [1ex] -displacement & 19 & 171.737 & 27 & 197.222 & 28 & 214.714 & 47 & -42.977* & 55 & -17.492 \\ - & & (16.918) & & (20.212) & & (16.671) & & & & \\ [1ex] -gear\_ratio & 19 & 3.112 & 27 & 2.993 & 28 & 2.970 & 47 & 0.142 & 55 & 0.022 \\ - & & (0.097) & & (0.091) & & (0.089) & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{9}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) control(0) order(2 1) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-control-order.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g-control.tex b/run/iebaltab/outputs/iebaltab2/3g-control.tex deleted file mode 100644 index 43849f33..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g-control.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) control(0) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-control.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(2)-(1)} & \multicolumn{2}{c}{(3)-(1)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{2} & \multicolumn{4}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -price & 28 & 5966.107 & 27 & 6424.667 & 19 & 6090.105 & 55 & 458.560 & 47 & 123.998 \\ - & & (471.068) & & (685.222) & & (627.491) & & & & \\ [1ex] -mpg & 28 & 21.000 & 27 & 20.926 & 19 & 22.263 & 55 & -0.074 & 47 & 1.263 \\ - & & (1.165) & & (1.055) & & (1.337) & & & & \\ [1ex] -trunk & 28 & 14.036 & 27 & 14.370 & 19 & 12.474 & 55 & 0.335 & 47 & -1.562 \\ - & & (0.825) & & (0.776) & & (1.018) & & & & \\ [1ex] -headroom & 28 & 3.250 & 27 & 2.907 & 19 & 2.737 & 55 & -0.343 & 47 & -0.513** \\ - & & (0.164) & & (0.158) & & (0.181) & & & & \\ [1ex] -weight & 28 & 3124.643 & 27 & 3037.037 & 19 & 2839.474 & 55 & -87.606 & 47 & -285.169 \\ - & & (140.524) & & (163.498) & & (166.371) & & & & \\ [1ex] -length & 28 & 191.143 & 27 & 188.111 & 19 & 182.947 & 55 & -3.032 & 47 & -8.195 \\ - & & (4.205) & & (4.429) & & (4.925) & & & & \\ [1ex] -turn & 28 & 40.179 & 27 & 40.000 & 19 & 38.368 & 55 & -0.179 & 47 & -1.810 \\ - & & (0.785) & & (0.925) & & (0.943) & & & & \\ [1ex] -displacement & 28 & 214.714 & 27 & 197.222 & 19 & 171.737 & 55 & -17.492 & 47 & -42.977* \\ - & & (16.671) & & (20.212) & & (16.918) & & & & \\ [1ex] -gear\_ratio & 28 & 2.970 & 27 & 2.993 & 19 & 3.112 & 55 & 0.022 & 47 & 0.142 \\ - & & (0.089) & & (0.091) & & (0.097) & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{9}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) control(0) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-control.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g-cov.tex b/run/iebaltab/outputs/iebaltab2/3g-cov.tex deleted file mode 100644 index 98777b35..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g-cov.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) covariates(foreign) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-cov.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(1)-(2)} & \multicolumn{2}{c}{(1)-(3)} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{2} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & P-value & N & P-value & N & P-value \\ \hline \\[-1.8ex] -price & 28 & 5966.107 & 27 & 6424.667 & 19 & 6090.105 & 55 & 0.566 & 47 & 0.840 & 46 & 0.742 \\ - & & (471.068) & & (685.222) & & (627.491) & & & & & & \\ [1ex] -mpg & 28 & 21.000 & 27 & 20.926 & 19 & 22.263 & 55 & 0.716 & 47 & 0.877 & 46 & 0.620 \\ - & & (1.165) & & (1.055) & & (1.337) & & & & & & \\ [1ex] -trunk & 28 & 14.036 & 27 & 14.370 & 19 & 12.474 & 55 & 0.564 & 47 & 0.495 & 46 & 0.210 \\ - & & (0.825) & & (0.776) & & (1.018) & & & & & & \\ [1ex] -headroom & 28 & 3.250 & 27 & 2.907 & 19 & 2.737 & 55 & 0.190 & 47 & 0.108 & 46 & 0.558 \\ - & & (0.164) & & (0.158) & & (0.181) & & & & & & \\ [1ex] -weight & 28 & 3124.643 & 27 & 3037.037 & 19 & 2839.474 & 55 & 0.994 & 47 & 0.614 & 46 & 0.697 \\ - & & (140.524) & & (163.498) & & (166.371) & & & & & & \\ [1ex] -length & 28 & 191.143 & 27 & 188.111 & 19 & 182.947 & 55 & 0.919 & 47 & 0.601 & 46 & 0.732 \\ - & & (4.205) & & (4.429) & & (4.925) & & & & & & \\ [1ex] -turn & 28 & 40.179 & 27 & 40.000 & 19 & 38.368 & 55 & 0.719 & 47 & 0.490 & 46 & 0.413 \\ - & & (0.785) & & (0.925) & & (0.943) & & & & & & \\ [1ex] -displacement & 28 & 214.714 & 27 & 197.222 & 19 & 171.737 & 55 & 0.743 & 47 & 0.342 & 46 & 0.630 \\ - & & (16.671) & & (20.212) & & (16.918) & & & & & & \\ [1ex] -gear\_ratio & 28 & 2.970 & 27 & 2.993 & 19 & 3.112 & 55 & 0.674 & 47 & 0.990 & 46 & 0.709 \\ - & & (0.089) & & (0.091) & & (0.097) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{10}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Covariate(s) used in pairwise regressions: [foreign]. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) covariates(foreign) stats(pair(p)) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-cov.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g-order.tex b/run/iebaltab/outputs/iebaltab2/3g-order.tex deleted file mode 100644 index ae890c0d..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g-order.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) order(2) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-order.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(1)-(2)} & \multicolumn{2}{c}{(1)-(3)} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{2} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -price & 19 & 6090.105 & 28 & 5966.107 & 27 & 6424.667 & 47 & 123.998 & 46 & -334.561 & 55 & -458.560 \\ - & & (627.491) & & (471.068) & & (685.222) & & & & & & \\ [1ex] -mpg & 19 & 22.263 & 28 & 21.000 & 27 & 20.926 & 47 & 1.263 & 46 & 1.337 & 55 & 0.074 \\ - & & (1.337) & & (1.165) & & (1.055) & & & & & & \\ [1ex] -trunk & 19 & 12.474 & 28 & 14.036 & 27 & 14.370 & 47 & -1.562 & 46 & -1.897 & 55 & -0.335 \\ - & & (1.018) & & (0.825) & & (0.776) & & & & & & \\ [1ex] -headroom & 19 & 2.737 & 28 & 3.250 & 27 & 2.907 & 47 & -0.513** & 46 & -0.171 & 55 & 0.343 \\ - & & (0.181) & & (0.164) & & (0.158) & & & & & & \\ [1ex] -weight & 19 & 2839.474 & 28 & 3124.643 & 27 & 3037.037 & 47 & -285.169 & 46 & -197.563 & 55 & 87.606 \\ - & & (166.371) & & (140.524) & & (163.498) & & & & & & \\ [1ex] -length & 19 & 182.947 & 28 & 191.143 & 27 & 188.111 & 47 & -8.195 & 46 & -5.164 & 55 & 3.032 \\ - & & (4.925) & & (4.205) & & (4.429) & & & & & & \\ [1ex] -turn & 19 & 38.368 & 28 & 40.179 & 27 & 40.000 & 47 & -1.810 & 46 & -1.632 & 55 & 0.179 \\ - & & (0.943) & & (0.785) & & (0.925) & & & & & & \\ [1ex] -displacement & 19 & 171.737 & 28 & 214.714 & 27 & 197.222 & 47 & -42.977* & 46 & -25.485 & 55 & 17.492 \\ - & & (16.918) & & (16.671) & & (20.212) & & & & & & \\ [1ex] -gear\_ratio & 19 & 3.112 & 28 & 2.970 & 27 & 2.993 & 47 & 0.142 & 46 & 0.120 & 55 & -0.022 \\ - & & (0.097) & & (0.089) & & (0.091) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{10}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) order(2) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-order.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g-total.tex b/run/iebaltab/outputs/iebaltab2/3g-total.tex deleted file mode 100644 index 9a1f33c1..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g-total.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) total savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-total.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(2)-(3)} & \multicolumn{2}{c}{(2)-(4)} & \multicolumn{2}{c}{(3)-(4)} \\ - & \multicolumn{2}{c}{Total} & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{2} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -price & 74 & 6165.257 & 28 & 5966.107 & 27 & 6424.667 & 19 & 6090.105 & 55 & -458.560 & 47 & -123.998 & 46 & 334.561 \\ - & & (342.872) & & (471.068) & & (685.222) & & (627.491) & & & & & & \\ [1ex] -mpg & 74 & 21.297 & 28 & 21.000 & 27 & 20.926 & 19 & 22.263 & 55 & 0.074 & 47 & -1.263 & 46 & -1.337 \\ - & & (0.673) & & (1.165) & & (1.055) & & (1.337) & & & & & & \\ [1ex] -trunk & 74 & 13.757 & 28 & 14.036 & 27 & 14.370 & 19 & 12.474 & 55 & -0.335 & 47 & 1.562 & 46 & 1.897 \\ - & & (0.497) & & (0.825) & & (0.776) & & (1.018) & & & & & & \\ [1ex] -headroom & 74 & 2.993 & 28 & 3.250 & 27 & 2.907 & 19 & 2.737 & 55 & 0.343 & 47 & 0.513** & 46 & 0.171 \\ - & & (0.098) & & (0.164) & & (0.158) & & (0.181) & & & & & & \\ [1ex] -weight & 74 & 3019.459 & 28 & 3124.643 & 27 & 3037.037 & 19 & 2839.474 & 55 & 87.606 & 47 & 285.169 & 46 & 197.563 \\ - & & (90.347) & & (140.524) & & (163.498) & & (166.371) & & & & & & \\ [1ex] -length & 74 & 187.932 & 28 & 191.143 & 27 & 188.111 & 19 & 182.947 & 55 & 3.032 & 47 & 8.195 & 46 & 5.164 \\ - & & (2.588) & & (4.205) & & (4.429) & & (4.925) & & & & & & \\ [1ex] -turn & 74 & 39.649 & 28 & 40.179 & 27 & 40.000 & 19 & 38.368 & 55 & 0.179 & 47 & 1.810 & 46 & 1.632 \\ - & & (0.511) & & (0.785) & & (0.925) & & (0.943) & & & & & & \\ [1ex] -displacement & 74 & 197.297 & 28 & 214.714 & 27 & 197.222 & 19 & 171.737 & 55 & 17.492 & 47 & 42.977* & 46 & 25.485 \\ - & & (10.676) & & (16.671) & & (20.212) & & (16.918) & & & & & & \\ [1ex] -gear\_ratio & 74 & 3.015 & 28 & 2.970 & 27 & 2.993 & 19 & 3.112 & 55 & -0.022 & 47 & -0.142 & 46 & -0.120 \\ - & & (0.053) & & (0.089) & & (0.091) & & (0.097) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{12}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) total savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g-total.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/3g.tex b/run/iebaltab/outputs/iebaltab2/3g.tex deleted file mode 100644 index 2bf00f64..00000000 --- a/run/iebaltab/outputs/iebaltab2/3g.tex +++ /dev/null @@ -1,34 +0,0 @@ -%%% Table created in Stata by command iebaltab -%%% (https://github.com/worldbank/ietoolkit) -%%% (https://dimewiki.worldbank.org/iebaltab) -%%% The command was specified exactly like this: -%%% iebaltab price mpg trunk headroom weight length turn displacement gear_ratio, grpvar(tmt) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g.tex") replace - -\begin{tabular}{@{\extracolsep{5pt}}lcccccccccccc} -\\[-1.8ex]\hline \hline \\[-1.8ex] - & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} & \multicolumn{2}{c}{(1)-(2)} & \multicolumn{2}{c}{(1)-(3)} & \multicolumn{2}{c}{(2)-(3)} \\ - & \multicolumn{2}{c}{0} & \multicolumn{2}{c}{1} & \multicolumn{2}{c}{2} & \multicolumn{6}{c}{Pairwise t-test} \\ -Variable & N & Mean/(SE) & N & Mean/(SE) & N & Mean/(SE) & N & Mean difference & N & Mean difference & N & Mean difference \\ \hline \\[-1.8ex] -price & 28 & 5966.107 & 27 & 6424.667 & 19 & 6090.105 & 55 & -458.560 & 47 & -123.998 & 46 & 334.561 \\ - & & (471.068) & & (685.222) & & (627.491) & & & & & & \\ [1ex] -mpg & 28 & 21.000 & 27 & 20.926 & 19 & 22.263 & 55 & 0.074 & 47 & -1.263 & 46 & -1.337 \\ - & & (1.165) & & (1.055) & & (1.337) & & & & & & \\ [1ex] -trunk & 28 & 14.036 & 27 & 14.370 & 19 & 12.474 & 55 & -0.335 & 47 & 1.562 & 46 & 1.897 \\ - & & (0.825) & & (0.776) & & (1.018) & & & & & & \\ [1ex] -headroom & 28 & 3.250 & 27 & 2.907 & 19 & 2.737 & 55 & 0.343 & 47 & 0.513** & 46 & 0.171 \\ - & & (0.164) & & (0.158) & & (0.181) & & & & & & \\ [1ex] -weight & 28 & 3124.643 & 27 & 3037.037 & 19 & 2839.474 & 55 & 87.606 & 47 & 285.169 & 46 & 197.563 \\ - & & (140.524) & & (163.498) & & (166.371) & & & & & & \\ [1ex] -length & 28 & 191.143 & 27 & 188.111 & 19 & 182.947 & 55 & 3.032 & 47 & 8.195 & 46 & 5.164 \\ - & & (4.205) & & (4.429) & & (4.925) & & & & & & \\ [1ex] -turn & 28 & 40.179 & 27 & 40.000 & 19 & 38.368 & 55 & 0.179 & 47 & 1.810 & 46 & 1.632 \\ - & & (0.785) & & (0.925) & & (0.943) & & & & & & \\ [1ex] -displacement & 28 & 214.714 & 27 & 197.222 & 19 & 171.737 & 55 & 17.492 & 47 & 42.977* & 46 & 25.485 \\ - & & (16.671) & & (20.212) & & (16.918) & & & & & & \\ [1ex] -gear\_ratio & 28 & 2.970 & 27 & 2.993 & 19 & 3.112 & 55 & -0.022 & 47 & -0.142 & 46 & -0.120 \\ - & & (0.089) & & (0.091) & & (0.097) & & & & & & \\ [1ex] -\hline \hline \\[-1.8ex] -%%% This is the note. If it does not have the correct margins, use texnotewidth() option or change the number before '\textwidth' in line below to fit it to table size. -\multicolumn{10}{@{} p{\textwidth}}{If the table includes missing values (.n, .o, .v etc.) see the Missing values section in the help file for the Stata command iebaltab for definitions of these values. Significance: ***=.01, **=.05, *=.1. Full user input as written by user: [iebaltab price mpg trunk headroom weight length turn displacement gear\_ratio, grpvar(tmt) savetex("C:/Users/wb462869/github/ietoolkit/run/iebaltab/outputs/iebaltab2/3g.tex") replace] } - -\end{tabular} diff --git a/run/iebaltab/outputs/iebaltab2/iebaltab2-files.tex b/run/iebaltab/outputs/iebaltab2/iebaltab2-files.tex deleted file mode 100644 index cbfb803c..00000000 --- a/run/iebaltab/outputs/iebaltab2/iebaltab2-files.tex +++ /dev/null @@ -1,146 +0,0 @@ -\documentclass{article} -\usepackage[utf8]{inputenc} -\usepackage{adjustbox} - -\title{iebaltab \\ v6.4} - -\begin{document} - -\maketitle -\begin{table}[] - \centering - \caption{Default with 2 treatment arms} - \adjustbox{max width = \linewidth}{ - \input{2g.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms, control = 0} - \adjustbox{max width = \linewidth}{ - \input{2g-control.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with total column} - \adjustbox{max width = \linewidth}{ - \input{2g-total.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with onerow option} - \adjustbox{max width = \linewidth}{ - \input{2g-onerow.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with fixed effects} - \adjustbox{max width = \linewidth}{ - \input{2g-fe.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with joint F-test} - \adjustbox{max width = \linewidth}{ - \input{2g-ftest.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with F-test} - \adjustbox{max width = \linewidth}{ - \input{2g-feqtest.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with clustered SEs} - \adjustbox{max width = \linewidth}{ - \input{2g-cluster.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with fmt option} - \adjustbox{max width = \linewidth}{ - \input{2g-fmt.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms without stars} - \adjustbox{max width = \linewidth}{ - \input{2g-nostars.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{2 treatment arms with stars} - \adjustbox{max width = \linewidth}{ - \input{2g-stars.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{Default with 3 treatment arms} - \adjustbox{max width = \linewidth}{ - \input{3g.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{3 treatment arms control = 0} - \adjustbox{max width = \linewidth}{ - \input{3g-control.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{3 treatment with custom order} - \adjustbox{max width = \linewidth}{ - \input{3g-order.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{3 treatment arms control = 0 and custom order} - \adjustbox{max width = \linewidth}{ - \input{3g-control-order.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{3 treatment arms with total} - \adjustbox{max width = \linewidth}{ - \input{3g-total.tex} - } -\end{table} - -\begin{table}[] - \centering - \caption{3 treatment arms with covariates} - \adjustbox{max width = \linewidth}{ - \input{3g-cov.tex} - } -\end{table} - -\end{document} diff --git a/run/ieboilstart/ieboilstart.do b/run/ieboilstart/ieboilstart.do deleted file mode 100644 index a370f3ff..00000000 --- a/run/ieboilstart/ieboilstart.do +++ /dev/null @@ -1,36 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - * Load utils commands - qui do "${runfldr}/run_utils.do" - - ************************ - * Run tests - - local out "${runfldr}/ieboilstart/ado-test" - ie_recurse_rmdir, folder("`out'") okifnotexist - ie_recurse_mkdir, folder("`out'") - - * Make sure deprecated but still supported option work - ieboilstart , version(13.1) adopath("`out'", strict) - `r(version)' - - // make sure repkit is installed in this folder such that other files can use repado to reset this change - ssc install repkit, replace diff --git a/run/ieddtab/ieddtab.do b/run/ieddtab/ieddtab.do deleted file mode 100644 index f6cd3b1b..00000000 --- a/run/ieddtab/ieddtab.do +++ /dev/null @@ -1,111 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - ************************ - * Run tests - - - * Load data blood pressure patient data - sysuse bplong, clear - - *Rename and recode time var - rename when time - recode time (1=0) (2=1) - - * Sort patient and time and randomize number on baseline value - bys patient : gen rand = runiform() if time == 0 - - *Sort rand and assign half of baseline to tmt == 1. - *Baseline is half of all obs, so half bseline = .25 - sort rand - gen tmt = (_n / _N > .25) if !missing(rand) - - *Sort on patient and time and copy baselin value to endline obs - sort patient time - by patient : replace tmt = tmt[_n-1] if time == 1 - - *Label vars. USe suffix -test to see what is dynamc and what is hard coded - label define treatment 0 "Control-test" 1 "Treatment-test" - label define time 0 "Baseline-test" 1 "Endline-test" - label value time time - label value tmt treatment - - - *Tidy up required vars - local orderkeep patient tmt time bp - keep `orderkeep' - order `orderkeep' - - - ************************************** - - *Utility function to test result matrix - program define test_matrix - syntax , rmatrix(string) row(string) col(string) expected_val(string) - local value = `rmatrix'["`row'","`col'"] - di "{pstd}Row: `row', Col: `col', Expected value: `expected_val', Actual value `value'{p_end}" - assert `value' == `expected_val' - end - - ************************************** - - *regular run, test all values - ieddtab bp, time(time) treat(tmt) - - mat result1 = r(ieddtabResults) - mat list result1 - - *Test second difference - test_matrix , rmatrix(result1) row("bp") col("2D") expected_val(-1.649999999999993) - test_matrix , rmatrix(result1) row("bp") col("2D_err") expected_val(3.332609384661584) - test_matrix , rmatrix(result1) row("bp") col("2D_stars") expected_val(0) - test_matrix , rmatrix(result1) row("bp") col("2D_N") expected_val(240) - - *Test control first difference - test_matrix , rmatrix(result1) row("bp") col("1DC") expected_val(-4.266666666666667) - test_matrix , rmatrix(result1) row("bp") col("1DC_err") expected_val(2.39864211429447) - test_matrix , rmatrix(result1) row("bp") col("1DC_stars") expected_val(1) - test_matrix , rmatrix(result1) row("bp") col("1DC_N") expected_val(120) - - *Test treatment first difference - test_matrix , rmatrix(result1) row("bp") col("1DT") expected_val(-5.916666666666667) - test_matrix , rmatrix(result1) row("bp") col("1DT_err") expected_val(2.313612179745651) - test_matrix , rmatrix(result1) row("bp") col("1DT_stars") expected_val(2) - test_matrix , rmatrix(result1) row("bp") col("1DT_N") expected_val(120) - - *Test control baseline summary stats - test_matrix , rmatrix(result1) row("bp") col("C0_mean") expected_val(156.0666666666667) - test_matrix , rmatrix(result1) row("bp") col("C0_err") expected_val(1.594458388227513) - test_matrix , rmatrix(result1) row("bp") col("C0_N") expected_val(60) - - *Test treatment baseline summary stats - test_matrix , rmatrix(result1) row("bp") col("T0_mean") expected_val(156.8333333333333) - test_matrix , rmatrix(result1) row("bp") col("T0_err") expected_val(1.346719526847542) - test_matrix , rmatrix(result1) row("bp") col("T0_N") expected_val(60) - - *Test control endline summary stats - test_matrix , rmatrix(result1) row("bp") col("C1_mean") expected_val(151.8) - test_matrix , rmatrix(result1) row("bp") col("C1_err") expected_val(1.791978359433497) - test_matrix , rmatrix(result1) row("bp") col("C1_N") expected_val(60) - - *Test treatment endline summary stats - test_matrix , rmatrix(result1) row("bp") col("T1_mean") expected_val(150.9166666666667) - test_matrix , rmatrix(result1) row("bp") col("T1_err") expected_val(1.881262298105969) - test_matrix , rmatrix(result1) row("bp") col("T1_N") expected_val(60) diff --git a/run/iegitaddmd/iegitaddmd.do b/run/iegitaddmd/iegitaddmd.do deleted file mode 100644 index 2e1e73ed..00000000 --- a/run/iegitaddmd/iegitaddmd.do +++ /dev/null @@ -1,119 +0,0 @@ - - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - * Macro to run folder - local iegam "${runfldr}/iegitaddmd" - local output "`iegam'/outputs" - - local cl "`output'/clone" - local db "`output'/dropbox" - - local cl_dw "`cl'/DataWork" - local db_dw "`db'/DataWork" - - local customfolder "`output'/customfolder" - local customfile "iegitaddmd_custom_file.md" - - *Load utility command - qui do "${runfldr}/run_utils.do" - ie_recurse_rmdir, folder("`output'") okifnotexist - - ************************ - * Run tests - - ********************************************** - * Set up folders to test on - - * Simple create folders - ie_recurse_mkdir, folder("`output'") - ie_recurse_mkdir, folder("`customfolder'") - ie_recurse_mkdir, folder("`cl'") - ie_recurse_mkdir, folder("`db'") - - * Use iefolder to create identical project folders - iefolder new project , projectfolder("`cl'") - iefolder new project , projectfolder("`db'") - iefolder new round Baseline , projectfolder("`cl'") - iefolder new round Baseline , projectfolder("`db'") - - iefolder new unitofobs students, projectfolder("`cl'") - iefolder new unitofobs teachers, projectfolder("`cl'") - iefolder new unitofobs schools , projectfolder("`cl'") - - * Remove some folders from the clone to simulate use case 2 (see helpfile for description of use cases) - rmdir "`cl_dw'/Baseline/DataSets/Deidentified" - rmdir "`cl_dw'/Baseline/DataSets/Final" - rmdir "`cl_dw'/Baseline/DataSets/Intermediate" - rmdir "`cl_dw'/Baseline/DataSets" - rmdir "`cl_dw'/Baseline/Questionnaire/Questionnaire Documentation" - - * Create the git folder - local gitfolders gitfilter1 gitfilter2 - foreach gitfolder of local gitfolders { - mkdir "`output'/`gitfolder'" - mkdir "`output'/`gitfolder'/.git" - mkdir "`output'/`gitfolder'/includeme" - mkdir "`output'/`gitfolder'/skipmein2" - mkdir "`output'/`gitfolder'/skipalsomein2" - mkdir "`output'/`gitfolder'/sub" - mkdir "`output'/`gitfolder'/sub/.git" - mkdir "`output'/`gitfolder'/sub/includealsome" - mkdir "`output'/`gitfolder'/ado" - mkdir "`output'/`gitfolder'/asdfasd" - mkdir "`output'/`gitfolder'/asdfasd/ado" - } - - ********************************************** - * Test the command - - *Use case 1 - see helpfile for description of use cases - iegitaddmd , folder("`cl_dw'") auto dryrun - iegitaddmd , folder("`cl_dw'") auto - - *Use case 2 - see helpfile for description of use cases - iegitaddmd , folder("`cl_dw'") comparefolder("`db_dw'") auto dryrun - iegitaddmd , folder("`cl_dw'") comparefolder("`db_dw'") auto - - *Test prompt - mkdir "`cl_dw'/Baseline/DataSets/Final/Publishable" - *iegitaddmd , folder("`cl_dw'") - - *Test skip git folders - iegitaddmd , folder("`output'/gitfilter1") auto - - * Test that the regular file was copied correctly - checksum "`output'/gitfilter1/ado/README.md" - assert `r(checksum)' == 4290144044 - - *Test skip custom - iegitaddmd , folder("`output'/gitfilter2") auto dry skipfolders(skipmein2 skipalsomein2 folderthatnotexist ado) - iegitaddmd , folder("`output'/gitfilter2") auto skipfolders(skipmein2 skipalsomein2 folderthatnotexist ado) - - * Test that folders are not used - cap iegitaddmd , folder("`output'/gitfilter2") auto skipfolders(skipmein2 skipalsomein2 folderthatnotexist asdfasd/ado) - assert _rc == 198 - - * Test customfile - iegitaddmd, folder("`customfolder'") customfile("`iegam'/`customfile'") auto - - * Test that the custom file was actaully used - checksum "`customfolder'/`customfile'" - assert `r(checksum)' == 1932786186 diff --git a/run/iegitaddmd/iegitaddmd_custom_file.md b/run/iegitaddmd/iegitaddmd_custom_file.md deleted file mode 100644 index 19b9f48a..00000000 --- a/run/iegitaddmd/iegitaddmd_custom_file.md +++ /dev/null @@ -1 +0,0 @@ -Custom content goes here!! diff --git a/run/iekdensity/iekdensity.do b/run/iekdensity/iekdensity.do deleted file mode 100644 index d12c844e..00000000 --- a/run/iekdensity/iekdensity.do +++ /dev/null @@ -1,148 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - ************************ - * Run tests - -/******************************************************************************* - Set up test data -*******************************************************************************/ - - * Load data - sysuse auto, clear - - * Generate treatment variables - gen random = runiform() - sort random - gen treatment_binary = random > 0.5 - tab treatment_binary - - * Generate factor variables - forv factorCap = 3/6 { - gen treatment_factor`factorCap' = ceil(`factorCap' * _n/_N) - tab treatment_factor`factorCap' - } - -/******************************************************************************* - No error -*******************************************************************************/ - - * Binary treatment - * ---------------- - iekdensity price, by(treatment_binary ) - - ** Color options - iekdensity price, by(treatment_binary ) color(eltblue edkblue) - - * Add label to treatment - lab def treatLab 0 "Control" 1 "Treatment" - lab val treatment_binary treatLab - - iekdensity price, by(treatment_binary ) color(eltblue edkblue) - - ** Statistic options - iekdensity price, by(treatment_binary ) stat(p50) - - * Add statistic with detailed style - iekdensity price, by(treatment_binary ) stat(mean) statstyle(lpattern(dash) lwidth(2)) - - ** Effect options - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) effect - - * Specify control value - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) effect control(0) - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) effect control(1) - - * Add effect note with specified format - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) effect effectformat(%9.0fc) - - ** Regression options - - * Fixed effects - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) /// - effect abs(foreign) - - * Clustered standard errors - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) /// - effect reg(cl(foreign)) - - ** Kernel options - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) /// - kdensity(biweight) - - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) /// - kdensity(epan2 bwidth(5)) - - ** Graphic options - iekdensity price, by(treatment_binary ) stat(p50) color(eltblue edkblue) /// - effect effectformat(%9.0fc) /// - graphregion(color(white)) ylab(, nogrid) /// - legend(cols(1)) - - - * Categorical treatment - * --------------------- - iekdensity price, by(treatment_factor3) - iekdensity price, by(treatment_factor4) - iekdensity price, by(treatment_factor5) - iekdensity price, by(treatment_factor6) - - lab def treatment_factor3Lab 1 "Treatment 1" 2 "Treatment 2" 3 "Treatment 3", replace - lab val treatment_factor3 treatment_factor3Lab - - iekdensity price, by(treatment_factor3) - - iekdensity price, by(treatment_factor3) color(eltblue midblue edkblue) - - iekdensity price, by(treatment_factor3) color(eltblue midblue edkblue) stat(mean) - - iekdensity price, by(treatment_factor3) color(eltblue midblue edkblue) effect control(1) - iekdensity price, by(treatment_factor3) color(eltblue midblue edkblue) effect control(2) - - -/******************************************************************************* - Yes error -*******************************************************************************/ - - * Group variable is not a factor variable - cap iekdensity price, by(headroom) - assert _rc == 109 - - * Change only one color - cap iekdensity price, by(treatment_binary) color(eltblue) - assert _rc == 198 - - * Non-existing code as control - cap iekdensity price, by(treatment_binary) control(3) - assert _rc == 197 - - * Too many colors - cap iekdensity price, by(treatment_binary) color(eltblue midblue edkblue) - assert _rc == 198 - - * Not enough colors - cap iekdensity price, by(treatment_factor3) color(eltblue midblue) stat(mean) - assert _rc == 198 - - * Multiple treatment arms but control group not specified - cap iekdensity price, by(treatment_factor3) color(eltblue midblue edkblue) effect - assert _rc == 198 - -***************************** End of do-file *********************************** diff --git a/run/iesave/iesave1.do b/run/iesave/iesave1.do deleted file mode 100644 index 4b9087de..00000000 --- a/run/iesave/iesave1.do +++ /dev/null @@ -1,365 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - * Comment out to run without debug mode - local debug debug - - local iesave_folder "${runfldr}/iesave" - local out "`iesave_folder'/outputs/iesave1" - local reports_folder "`out'/reports" - - *Load utility functions that create and resets folders across runs - qui do "${runfldr}/run_utils.do" - - *Remove all previously generated output (if any) - ie_recurse_rmdir, folder("`out'") okifnotexist - - *Re-create the reports folders - ie_recurse_mkdir, folder("`reports_folder'") - - ************************ - * Run tests - - /***************************************************************************** - Run this run file once for each save file version - *****************************************************************************/ - - * Only include the version your Stata version can run - if `c(stata_version)' < 13 local stata_versions 12 - else if `c(stata_version)' < 14 local stata_versions 12 13 - else local stata_versions 12 13 14 - - * most basic case for quick testing - with and without path in "" - sysuse auto, clear - iesave `out'/basic, idvars(make) version(13.1) - sysuse auto, clear - iesave "`out'/basic.dta", idvars(make) version(13.1) replace - - - foreach stata_ver of local stata_versions { - - local version_folder "`out'/v`stata_ver'" - - * Create the output folder (and all its parents is needed) - ie_recurse_mkdir, folder("`version_folder'") - - *Lsit of all files this run file is expected to create - local expected_files "" - - /***************************************************************************** - Options: No error - *****************************************************************************/ - - /********************* - IDvars - *********************/ - - * single id - sysuse auto, clear - iesave "`version_folder'/id_1.dta", /// - idvars(make) version(`stata_ver') /// - /// - replace - - * Test that command truly save in correct format - dtaversion "`version_folder'/id_1.dta" - if `stata_ver' == 12 assert `r(version)' == 115 - if `stata_ver' == 13 assert `r(version)' == 117 - if `stata_ver' == 14 assert `r(version)' == 118 - - *Add this file to list of expected files - local expected_files `"`expected_files' "id_1.dta""' - - * idvars list - sysuse auto, clear - gen id = make - iesave "`version_folder'/id_2.dta", /// - idvars(make id) /// - version(`stata_ver') /// - replace - - *Add this file to list of expected files - local expected_files `"`expected_files' "id_2.dta""' - - * Missing values in the idvars - sysuse auto, clear - gen id = _n if _n != 74 - - cap iesave "`version_folder'/err_id_1.dta", /// - idvars(id) replace /// - version(`stata_ver') - assert _rc == 459 - - * Duplicates in the idvars - sysuse auto, clear - gen id = _n - replace id = 3 in 4 - replace id = 8 in 11 - replace id = 8 in 21 - - cap iesave "`version_folder'/err_id_2.dta", /// - idvars(id) replace /// - version(`stata_ver') - assert _rc == 459 - - /********************* - Mutliple IDvars with missing values - *********************/ - - * Load auto - sysuse auto, clear - - * Create ids that are only unique in combination - gen village = foreign - sort village make - by village : gen village_hhid = _n - - * First test that it works without missing - iesave "`version_folder'/id_3.dta", /// - idvars(village village_hhid) version(15) replace - - *Add this file to list of expected files - local expected_files `"`expected_files' "id_3.dta""' - - * Create some missing vars - replace village = . in 5 - replace village_hhid = . in 65 - - * Run iesave and test for expected error - cap iesave "`version_folder'/err_id_3.dta", /// - idvars(village village_hhid) version(15) replace - assert _rc == 459 - - /********************* - absence of userinfo - *********************/ - - sysuse auto, clear - iesave "`version_folder'/user_1.dta", /// - idvars(make) replace /// - version(`stata_ver') - - *Add these files to list of expected files - local expected_files `"`expected_files' "user_1.dta""' - - *open the file again and test that placeholder text were used - use "`version_folder'/user_1.dta", clear - assert "Username withheld, see option userinfo in command iesave." == "`: char _dta[iesave_username]'" - assert "Computer ID withheld, see option userinfo in command iesave." == "`: char _dta[iesave_computerid]'" - - /******************************************************************************* - * Invalid syntaxes - *******************************************************************************/ - - ***************** - * missing using - sysuse auto, clear - cap iesave - assert _rc == 100 - - ***************** - * idvars and version required options - sysuse auto, clear - cap iesave "`version_folder'/err_syntax_1.dta" - assert _rc == 198 - - sysuse auto, clear - cap iesave "`version_folder'/err_syntax_2.dta", version(`stata_ver') - assert _rc == 198 - - sysuse auto, clear - cap iesave "`version_folder'/err_syntax_3.dta", idvars(make) - assert _rc == 198 - - - ***************** - * incorrect .dta version value - cap iesave "`version_folder'/err_syntax_4.dta", idvars(make) version(18) - assert _rc == 198 - - ***************** - * reportreplace may only be used with varreport - cap iesave "`version_folder'/err_syntax_5.dta", /// - idvars(make) version(`stata_ver') /// - reportreplace - assert _rc == 198 - - ******************************************************************************** - * Testing char values * - ******************************************************************************** - - /***************************************** - Validate if char values are as expected - *****************************************/ - - sysuse auto, clear - - *1. Run iesave - iesave "`version_folder'/char_1.dta", /// - idvars(make) version(`stata_ver') replace userinfo - - *Add these files to list of expected files - local expected_files `"`expected_files' "char_1.dta""' - - *2. Store char values in locals - foreach value in idvars N username computerid datasignature timesave { - //display "`value' : " r(`value') - local char_`value' : char _dta[iesave_`value'] - } - - *3. Open the dataset just saved - use "`version_folder'/char_1.dta", clear - qui datasignature - local datasig `r(datasignature)' - - *4. Validate if char values are non-missing and as expected - assert !missing("`char_idvars'") - assert !missing("`char_N'") - assert !missing("`char_username'") - assert !missing("`char_computerid'") - assert !missing("`char_datasignature'") - - assert "`char_idvars'" == "make" - assert `char_N' == _N - assert "`char_username'" == "`c(username)'" - assert "`char_computerid'" == "`c(hostname)'" - assert "`char_datasignature'" == "`datasig'" - - *Make sure that time saved in char is less than time after sleeping for 3 sec - sleep 3000 - assert Clock("`char_timesave'", "hmsDMY") < /// - Clock("`c(current_time)' `c(current_date)'", "hmsDMY") - - /************************************************************** - Validate if char values are as expected after make data changes - ***************************************************************/ - - sysuse auto, clear - drop if trunk > 22 - drop displacement - iesave "`version_folder'/char_2.dta", /// - idvars(make) version(`stata_ver') replace userinfo - - *Add these files to list of expected files - local expected_files `"`expected_files' "char_2.dta""' - - di `" assert "`char_idvars'" == "`: char _dta[iesave_idvars]'" "' - di `" assert "`char_username'" == "`: char _dta[iesave_username]'" "' - di `" assert "`char_computerid'" == "`: char _dta[iesave_computerid]'" "' - di `" assert "`char_datasignature'" != "`: char _dta[iesave_datasignature]'" "' - - assert "`char_idvars'" == "`: char _dta[iesave_idvars]'" - assert "`char_username'" == "`: char _dta[iesave_username]'" - assert "`char_computerid'" == "`: char _dta[iesave_computerid]'" - assert "`char_datasignature'" != "`: char _dta[iesave_datasignature]'" - - /************************************************************** - Test that only the exact data sets expected are created - ***************************************************************/ - - *List files in output folder and remove the double qoutes - local files_in_folder : dir `"`version_folder'"' files "*" , respectcase - - *Get list of missing and extra files - local missing_files : list expected_files - files_in_folder - local extra_files : list files_in_folder - expected_files - - *Output error if there were extra or missing files - if `"`missing_files'"' != "" { - noi di as error `"{phang}The following files were expecetd to be created by this run0file but they were not created [`missing_files']{p_end}"' - error 9 - } - if `"`extra_files'"' != "" { - noi di as error `"{phang}The following files were not expecetd to be created by this run-file but they were created [`extra_files']{p_end}"' - error 9 - } - - -// Test meta data report ------------------------------------------------------- - - set seed 1989 - - sysuse auto, clear - gen day = runiform(1, 30) - gen month = runiform(1, 12) - gen year = runiform(1990, 2020) - gen date = mdy(month, day, year) - format date %td - - lab var mpg "Milage , mpg" - - * Use defaults - iesave "`reports_folder'/auto_defualt_v`stata_ver'.dta", /// - idvars(make) /// - version(`stata_ver') /// - report - - * Use defaults but with csv and userinfo - iesave "`reports_folder'/auto_csv_v`stata_ver'.dta", /// - idvars(make) userinfo /// - version(`stata_ver') /// - report(csv) - - *User location - local userlocation "`reports_folder'/userlocation" - ie_recurse_mkdir, folder("`userlocation'") - - iesave "`reports_folder'/auto_location_v`stata_ver'.dta", /// - idvars(make) /// - version(`stata_ver') /// - userinfo /// - report(path("`userlocation'/auto_location_v`stata_ver'.md")) `debug' - -} - - // Test replace options for meta data report ------------------------------- - - * Default location - sysuse auto, clear - iesave "`reports_folder'/report_replace.dta", /// - idvars(make) /// - version(13) /// - report `debug' - - sysuse auto, clear - iesave "`reports_folder'/report_replace.dta", /// - idvars(make) /// - version(13.1) /// - replace /// - report `debug' - - - * User specified location - sysuse auto, clear - iesave "`reports_folder'/reportpath_replace.dta", /// - idvars(make) /// - version(13) /// - report(path("`reports_folder'/reportpath_replace.csv")) /// - `debug' - - sysuse auto, clear - iesave "`reports_folder'/reportpath_replace.dta", /// - idvars(make) /// - version(13) /// - report(path("`reports_folder'/reportpath_replace.csv") replace) /// - replace /// - `debug' - -***************************** End of do-file *********************************** diff --git a/run/iesave/iesave2.do b/run/iesave/iesave2.do deleted file mode 100644 index 08d7fa0c..00000000 --- a/run/iesave/iesave2.do +++ /dev/null @@ -1,95 +0,0 @@ - - ************************ - * Set up root paths if not already set, and set up dev environment - - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - global runfldr "${ietk_clone}/run" - global srcfldr "${ietk_clone}/src" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - cap net uninstall ietoolkit - net install ietoolkit, from("${ietk_clone}/src") replace - - * Set version to target version of ietoolkit - ieboilstart , version(13.1) - `r(version)' - - qui do "${runfldr}/run_utils.do" - - local out "${runfldr}/iesave/outputs/iesave2" - - *Delete all content in the output folder - ie_recurse_rmdir, folder("`out'") okifnotexist - ie_recurse_mkdir, folder("`out'") - - ************************ - * Run tests - - sysuse auto, clear - - * Creaeting a file to be able to trigger the first error - save "`out'/auto.dta" - -// Errors ---------------------------------------------------------------------- - - * File already exists - cap iesave "`out'/auto.dta", id(make) version(13.1) - assert _rc == 602 - -// Simple save ------------------------------------------------------ - - * Save file - iesave "`out'/auto.dta", id(make) version(13.1) replace - - * Check data chars - use "`out'/auto.dta", clear - char list _dta[] - assert "`r(computerid)'" == "Computer ID withheld, see option userinfo in command iesave." - assert "`r(username)'" == "Username withheld, see option userinfo in command iesave." - -// Save + user info ------------------------------------------------------------ - - * Save - iesave "`out'/auto-userinfo.dta", id(make) version(13.1) userinfo replace - - * Check data chars - use "`out'/auto-userinfo.dta", clear - assert "`r(computerid)'" != "Computer ID withheld, see option userinfo in command iesave." - assert "`r(username)'" != "Username withheld, see option userinfo in command iesave." - -// Report ---------------------------------------------------------------------- - - * Simple report - iesave "`out'/auto.dta", id(make) version(13.1) report replace - iesave "`out'/auto.dta", id(make) version(13.1) report() replace - - * Report with user info - iesave "`out'/auto-userinfo.dta", id(make) version(13.1) report userinfo replace - - * Report with user info and data order - iesave "`out'/auto-noalpha.dta", id(make) version(13.1) report(noalpha) userinfo replace - - * Report with user info and path - iesave "`out'/auto-path.dta", id(make) version(13.1) report(path("`out'/my-path.md")) userinfo replace - - * Report with csv path - iesave "`out'/auto-path-csv.dta", id(make) version(13.1) report(path("`out'/my-path.csv")) userinfo replace - - * Report with csv without path - iesave "`out'/auto-csv.dta", id(make) version(13.1) report(csv) replace - -// Two ID vars ----------------------------------------------------------------- - - iesave "`out'/auto-2id.dta", id(make foreign) version(13.1) report replace - - replace foreign = . in 1 - - cap iesave "`out'/auto-2id.dta", id(make foreign) version(13.1) report replace - assert _rc == 459 - - -************************************************************************ The end. diff --git a/run/iesave/outputs/iesave1/reports/auto_csv_v12.csv b/run/iesave/outputs/iesave1/reports/auto_csv_v12.csv deleted file mode 100644 index 289b99b3..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_csv_v12.csv +++ /dev/null @@ -1,38 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,16 -ID variable(s):,make -.dta version used:,12 -Data signature:,74:16(110350):932916212:1889387683 -Last saved by:,wb462869 - PCD85M04J3 -Last saved at:,12:06:52 11 Apr 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -day,"",float,74, 15.7, 9.142, 1.236, 7.424, 14.44, 24.43, 29.36 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -month,"",float,74, 6.533, 3.053, 1.23, 4.2, 6.398, 9.273, 11.85 -mpg,"Milage , mpg",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 -year,"",float,74, 2007, 8.384, 1990, 2000, 2007, 2013, 2020 - -Variable type: Date or date-time -Name,Label,Format,Complete obs,Unique values,Mean,Std Dev,Min,Median,Max -date,"",%td,74,74,05jul2006, 3064,07feb1990,03nov2006,29sep2019 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave1/reports/auto_csv_v13.csv b/run/iesave/outputs/iesave1/reports/auto_csv_v13.csv deleted file mode 100644 index d7fdb8f3..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_csv_v13.csv +++ /dev/null @@ -1,38 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,16 -ID variable(s):,make -.dta version used:,13 -Data signature:,74:16(110350):932916212:1889387683 -Last saved by:,wb462869 - PCD85M04J3 -Last saved at:,12:06:56 11 Apr 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -day,"",float,74, 15.7, 9.142, 1.236, 7.424, 14.44, 24.43, 29.36 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -month,"",float,74, 6.533, 3.053, 1.23, 4.2, 6.398, 9.273, 11.85 -mpg,"Milage , mpg",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 -year,"",float,74, 2007, 8.384, 1990, 2000, 2007, 2013, 2020 - -Variable type: Date or date-time -Name,Label,Format,Complete obs,Unique values,Mean,Std Dev,Min,Median,Max -date,"",%td,74,74,05jul2006, 3064,07feb1990,03nov2006,29sep2019 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave1/reports/auto_csv_v14.csv b/run/iesave/outputs/iesave1/reports/auto_csv_v14.csv deleted file mode 100644 index baa1b8ce..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_csv_v14.csv +++ /dev/null @@ -1,38 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,16 -ID variable(s):,make -.dta version used:,14 -Data signature:,74:16(110350):932916212:1889387683 -Last saved by:,wb462869 - PCD85M04J3 -Last saved at:,12:07:01 11 Apr 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -day,"",float,74, 15.7, 9.142, 1.236, 7.424, 14.44, 24.43, 29.36 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -month,"",float,74, 6.533, 3.053, 1.23, 4.2, 6.398, 9.273, 11.85 -mpg,"Milage , mpg",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 -year,"",float,74, 2007, 8.384, 1990, 2000, 2007, 2013, 2020 - -Variable type: Date or date-time -Name,Label,Format,Complete obs,Unique values,Mean,Std Dev,Min,Median,Max -date,"",%td,74,74,05jul2006, 3064,07feb1990,03nov2006,29sep2019 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave1/reports/auto_defualt_v12.md b/run/iesave/outputs/iesave1/reports/auto_defualt_v12.md deleted file mode 100644 index b801f1a0..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_defualt_v12.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 12 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 12:06:52 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/auto_defualt_v13.md b/run/iesave/outputs/iesave1/reports/auto_defualt_v13.md deleted file mode 100644 index cb931a71..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_defualt_v13.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 13 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 12:06:56 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/auto_defualt_v14.md b/run/iesave/outputs/iesave1/reports/auto_defualt_v14.md deleted file mode 100644 index ffd35eae..00000000 --- a/run/iesave/outputs/iesave1/reports/auto_defualt_v14.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 12:07:00 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/report_replace.md b/run/iesave/outputs/iesave1/reports/report_replace.md deleted file mode 100644 index c01c5bc2..00000000 --- a/run/iesave/outputs/iesave1/reports/report_replace.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make -- **.dta version used:** 13 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 12:07:02 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/reportpath_replace.csv b/run/iesave/outputs/iesave1/reports/reportpath_replace.csv deleted file mode 100644 index 7ede9af3..00000000 --- a/run/iesave/outputs/iesave1/reports/reportpath_replace.csv +++ /dev/null @@ -1,31 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,12 -ID variable(s):,make -.dta version used:,13 -Data signature:,74:12(71728):2155345365:1865188037 -Last saved by:,User info withheld, see option userinfo in command iesave. -Last saved at:,12:07:02 11 Apr 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -mpg,"Mileage (mpg)",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v12.md b/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v12.md deleted file mode 100644 index 8b519d8a..00000000 --- a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v12.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 12 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** wb462869 - PCD85M04J3 -- **Last saved at:** 12:06:52 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v13.md b/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v13.md deleted file mode 100644 index 93bdb6a7..00000000 --- a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v13.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 13 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** wb462869 - PCD85M04J3 -- **Last saved at:** 12:06:57 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v14.md b/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v14.md deleted file mode 100644 index 1816faad..00000000 --- a/run/iesave/outputs/iesave1/reports/userlocation/auto_location_v14.md +++ /dev/null @@ -1,46 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 16 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:16(110350):932916212:1889387683 -- **Last saved by:** wb462869 - PCD85M04J3 -- **Last saved at:** 12:07:01 11 Apr 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| day | "" | float | 74 | 15.7 | 9.142 | 1.236 | 7.424 | 14.44 | 24.43 | 29.36 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| month | "" | float | 74 | 6.533 | 3.053 | 1.23 | 4.2 | 6.398 | 9.273 | 11.85 | -| mpg | "Milage , mpg" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| year | "" | float | 74 | 2007 | 8.384 | 1990 | 2000 | 2007 | 2013 | 2020 | - -## Variable type: Date or date-time - -| Name | Label | Format | Complete obs | Unique values | Mean | Std Dev | Min | Median | Max | -|---|---|---|---|---|---|---|---|---|---| -| date | "" | %td | 74 | 74 | 05jul2006 | 3064 | 07feb1990 | 03nov2006 | 29sep2019 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave2/auto-2id.md b/run/iesave/outputs/iesave2/auto-2id.md deleted file mode 100644 index de9d5d5e..00000000 --- a/run/iesave/outputs/iesave2/auto-2id.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make foreign -- **.dta version used:** 14 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 17:01:39 28 Oct 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave2/auto-csv.csv b/run/iesave/outputs/iesave2/auto-csv.csv deleted file mode 100644 index f4e76660..00000000 --- a/run/iesave/outputs/iesave2/auto-csv.csv +++ /dev/null @@ -1,31 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,12 -ID variable(s):,make -.dta version used:,14 -Data signature:,74:12(71728):2155345365:1865188037 -Last saved by:,User info withheld, see option userinfo in command iesave. -Last saved at:,17:01:38 28 Oct 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -mpg,"Mileage (mpg)",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave2/auto-noalpha.md b/run/iesave/outputs/iesave2/auto-noalpha.md deleted file mode 100644 index d705f5f0..00000000 --- a/run/iesave/outputs/iesave2/auto-noalpha.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** luizaandrade - BFI-33299 -- **Last saved at:** 17:01:38 28 Oct 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave2/auto-userinfo.md b/run/iesave/outputs/iesave2/auto-userinfo.md deleted file mode 100644 index 8d161b5e..00000000 --- a/run/iesave/outputs/iesave2/auto-userinfo.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** luizaandrade - BFI-33299 -- **Last saved at:** 17:01:38 28 Oct 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave2/auto.md b/run/iesave/outputs/iesave2/auto.md deleted file mode 100644 index da93b229..00000000 --- a/run/iesave/outputs/iesave2/auto.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** User info withheld, see option userinfo in command iesave. -- **Last saved at:** 17:01:38 28 Oct 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/iesave/outputs/iesave2/my-path.csv b/run/iesave/outputs/iesave2/my-path.csv deleted file mode 100644 index b4d9036a..00000000 --- a/run/iesave/outputs/iesave2/my-path.csv +++ /dev/null @@ -1,31 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -Number of observations:,74 -Number of variables:,12 -ID variable(s):,make -.dta version used:,14 -Data signature:,74:12(71728):2155345365:1865188037 -Last saved by:,luizaandrade - BFI-33299 -Last saved at:,17:01:38 28 Oct 2023 - -Variable type: String -Name,Label,Type,Complete obs,Number of levels -make,"Make and model",str17,74,74 - -Variable type: Continuous -Name,Label,Type,Complete obs,Mean,Std Dev,p0,p25,p50,p75,p100 -displacement,"Displacement (cu. in.)",int,74, 197.3, 91.84, 79, 119, 196, 250, 425 -gear_ratio,"Gear ratio",float,74, 3.015, .4563, 2.19, 2.73, 2.955, 3.37, 3.89 -headroom,"Headroom (in.)",float,74, 2.993, .846, 1.5, 2.5, 3, 3.5, 5 -length,"Length (in.)",int,74, 187.9, 22.27, 142, 170, 192.5, 204, 233 -mpg,"Mileage (mpg)",byte,74, 21.3, 5.786, 12, 18, 20, 25, 41 -price,"Price",int,74, 6165, 2949, 3291, 4195, 5007, 6342, 15906 -rep78,"Repair record 1978",byte,69, 3.406, .9899, 1, 3, 3, 4, 5 -trunk,"Trunk space (cu. ft.)",byte,74, 13.76, 4.277, 5, 10, 14, 17, 23 -turn,"Turn circle (ft.)",byte,74, 39.65, 4.399, 31, 36, 40, 43, 51 -weight,"Weight (lbs.)",int,74, 3019, 777.2, 1760, 2240, 3190, 3600, 4840 - -Variable type: Categorical -Name,Label,Value label,Complete obs,Number of levels,Number of unlabeled levels,Top count -foreign,"Car origin",origin,74,2,0,Domestic:52 Foreign:22 - diff --git a/run/iesave/outputs/iesave2/my-path.md b/run/iesave/outputs/iesave2/my-path.md deleted file mode 100644 index 8d161b5e..00000000 --- a/run/iesave/outputs/iesave2/my-path.md +++ /dev/null @@ -1,37 +0,0 @@ -This report was created by the Stata command iesave (version 7.3). Read more about this command and the purpose of this report on https://dimewiki.worldbank.org/iesave - -- **Number of observations:** 74 -- **Number of variables:** 12 -- **ID variable(s):** make -- **.dta version used:** 14 -- **Data signature:** 74:12(71728):2155345365:1865188037 -- **Last saved by:** luizaandrade - BFI-33299 -- **Last saved at:** 17:01:38 28 Oct 2023 - -## Variable type: String - -| Name | Label | Type | Complete obs | Number of levels | -|---|---|---|---|---| -| make | "Make and model" | str17 | 74 | 74 | - -## Variable type: Continuous - -| Name | Label | Type | Complete obs | Mean | Std Dev | p0 | p25 | p50 | p75 | p100 | -|---|---|---|---|---|---|---|---|---|---|---| -| displacement | "Displacement (cu. in.)" | int | 74 | 197.3 | 91.84 | 79 | 119 | 196 | 250 | 425 | -| gear_ratio | "Gear ratio" | float | 74 | 3.015 | .4563 | 2.19 | 2.73 | 2.955 | 3.37 | 3.89 | -| headroom | "Headroom (in.)" | float | 74 | 2.993 | .846 | 1.5 | 2.5 | 3 | 3.5 | 5 | -| length | "Length (in.)" | int | 74 | 187.9 | 22.27 | 142 | 170 | 192.5 | 204 | 233 | -| mpg | "Mileage (mpg)" | byte | 74 | 21.3 | 5.786 | 12 | 18 | 20 | 25 | 41 | -| price | "Price" | int | 74 | 6165 | 2949 | 3291 | 4195 | 5007 | 6342 | 15906 | -| rep78 | "Repair record 1978" | byte | 69 | 3.406 | .9899 | 1 | 3 | 3 | 4 | 5 | -| trunk | "Trunk space (cu. ft.)" | byte | 74 | 13.76 | 4.277 | 5 | 10 | 14 | 17 | 23 | -| turn | "Turn circle (ft.)" | byte | 74 | 39.65 | 4.399 | 31 | 36 | 40 | 43 | 51 | -| weight | "Weight (lbs.)" | int | 74 | 3019 | 777.2 | 1760 | 2240 | 3190 | 3600 | 4840 | - -## Variable type: Categorical - -| Name | Label | Value label | Complete obs | Number of levels | Number of unlabeled levels | Top count | -|---|---|---|---|---|---|---| -| foreign | "Car origin" | origin | 74 | 2 | 0 | Domestic:52 Foreign:22 | - diff --git a/run/main.do b/run/main.do deleted file mode 100644 index d2f0fe1b..00000000 --- a/run/main.do +++ /dev/null @@ -1,62 +0,0 @@ - -/******************************************************************************* - PART 1: Make sure repkit is installed -*******************************************************************************/ - - * The rootpaths in these run files are managed with - * the command reproot in the package repkit. - * Make sure that you have version v1.2 or more more recent - * installed of repkit on your computer. To set up reproot on your comptuer - * see this article https://worldbank.github.io/repkit/articles/reproot-files.html - - * Make sure that repkit is installed - * If not, prompt user to install it from ssc - cap which repkit - if _rc == 111 { - di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" - } - - * Display what version of repkit you have installed - >1.2 is required - repkit - reproot, project("ietoolkit") roots("clone") prefix("ietk_") - - global runfldr "${ietk_clone}/run" - - * Install the version of this package in - * the plus-ado folder in the test folder - cap mkdir "${runfldr}/dev-env" - repado using "${runfldr}/dev-env" - - * Make sure repkit is installed in /dev-env/ - cap which repkit - if _rc == 111 { - ssc install repkit, replace - } - -/******************************************************************************* - PART 2: run all command -*******************************************************************************/ - - *This run file depends on iefolder, make sure that command is tested before this run file - - * iegitaddmd - do "${runfldr}/iegitaddmd/iegitaddmd.do" - - * iekdensity - do "${runfldr}/iekdensity/iekdensity.do" - - * iesave - do "${runfldr}/iesave/iesave1.do" - do "${runfldr}/iesave/iesave2.do" - - * iebaltab - do "${runfldr}/iebaltab/iebaltab1.do" - do "${runfldr}/iebaltab/iebaltab2.do" - - * ieddtab - *do "${runfldr}/ieddtab/ieddtab.do" - - * ieboilstart - * NOTE: this runfile changes settings such that Stata needs to be re-started - * in order to comment this file out - do "${runfldr}/ieboilstart/ieboilstart.do" diff --git a/run/run_utils.do b/run/run_utils.do deleted file mode 100644 index 9be47e19..00000000 --- a/run/run_utils.do +++ /dev/null @@ -1,118 +0,0 @@ -* This file can delete all your folders on your computer if used incorrectly. - -cap program drop ie_recurse_rmdir - program define ie_recurse_rmdir - -qui { - syntax , folder(string) [DRYrun okifnotexist] - - /* - folder - full path to folder which should be deleted with all its content - dryrun - just list and do not delete all files that would have been deleted without this option - okifnotexist - it is ok that the top folder does not exist, do not throw erroe - - */ - - *Test that folder exist - mata : st_numscalar("r(dirExist)", direxists("`folder'")) - - if (`r(dirExist)' == 0) { - if missing("`okifnotexist'") { - noi di as error `"{phang}The folder used in [folder(`folder')] does not exist.{p_end}"' - error 693 - exit - } - else { - *Folder is missin and that is ok, just output a confirmation that it does not exists - noi di as result `"{phang}The folder used in [folder(`folder')] is already deleted.{p_end}"' - } - } - else { - - if (length("`folder'")<=10) { - noi di as error `"{phang}The folder used in [folder(`folder')] does not exist or you have not entered the full path.{p_end}"' - error 693 - exit - } - - * File paths can have both forward and/or back slash. We'll standardize them so they're easier to handle - local folderStd = subinstr(`"`folder'"',"\","/",.) - - *List files, directories and other files - local flist : dir `"`folderStd'"' files "*" , respectcase - local dlist : dir `"`folderStd'"' dirs "*" , respectcase - local olist : dir `"`folderStd'"' other "*" , respectcase - - *Use the command on each subfolder to this folder (if any) - foreach dir of local dlist { - *Recursive call on each subfolder - noi ie_recurse_rmdir , folder(`"`folderStd'/`dir'"') `automatic' `dryrun' - } - - *REmove all files - local files `"`flist' `olist'"' - foreach file of local files { - *If dryrun then list otherwise delete - if !missing("`dryrun'") noi di as result "{pstd}DRY RUN! Without option {bf:dryrun} file [`folderStd'/`file'] would have been deleted.{p_end}" - else rm `"`folderStd'/`file'"' - } - - * Remove this folder as it is now empty - if missing("`dryrun'") { - rmdir `"`folderStd'"' - noi di as result "{pstd}Folder [`folderStd'] and all its content were deleted.{p_end}" - } - } -} -end - - - - -* This create folders recursively. If path "c:/folder1/folder2/folder3" is -* passed then the command creates folder1 if it does not exists, and then -* folder2 if it does not exists and then folder3 if it does not exist - -cap program drop ie_recurse_mkdir - program define ie_recurse_mkdir - -qui { - syntax, folder(string) [dryrun] - - /* - folder - full path to folder which should be created - dryrun - just list and do not create the folder that would have been created without this option - */ - - *Standardiize to forward slashes - local folder = subinstr(`"`folder'"',"\","/",.) - - *Test if this folder exists - mata : st_numscalar("r(dirExist)", direxists(`"`folder'"')) - - *Folder does not exist, find parent folder and make recursive call - if (`r(dirExist)' == 0) { - - *Get the parent folder of folder - local lastSlash = strpos(strreverse(`"`folder'"'),"/") - local parentFolder = substr(`"`folder'"',1,strlen("`folder'")-`lastSlash') - local thisFolder = substr(`"`folder'"', (-1 * `lastSlash')+1 ,.) - - *Recursively make sure that the partent folders and its parent folders exists - noi ie_recurse_mkdir , folder(`"`parentFolder'"') `dryrun' - - *Create this folder as the parent folder is ceratain to exist now - if missing("`dryrun'") { - noi mkdir "`folder'" - noi di as result "{pstd}Folder created: [`folder']{p_end}" - } - else { - noi di as result "{pstd}DRY RUN! Without option {bf:dryrun} folder [`folder'] would have been created.{p_end}" - } - } - else { - if missing("`dryrun'") noi di as result "{pstd}Folder existed: [`folder']{p_end}" - else noi di as result "{pstd}DRY RUN! Folder [`folder'] already existed.{p_end}" - } -} -end diff --git a/src/ado/README.md b/src/ado/README.md new file mode 100644 index 00000000..10ffe067 --- /dev/null +++ b/src/ado/README.md @@ -0,0 +1,3 @@ +# Ado-files and auxiliary files + +In the `adodown` workflow you should not create any of the ado-files in this folder manually. Instead you are intended to use the command [`ad_command`](https://lsms-worldbank.github.io/adodown/reference/ad_command.html) to create and remove commands. diff --git a/src/ado_files/iebaltab.ado b/src/ado/iebaltab.ado similarity index 99% rename from src/ado_files/iebaltab.ado rename to src/ado/iebaltab.ado index c3d65fa3..325389de 100644 --- a/src/ado_files/iebaltab.ado +++ b/src/ado/iebaltab.ado @@ -1,8 +1,11 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org capture program drop iebaltab, program define iebaltab, rclass +qui { + version 12.0 + syntax varlist(numeric) [if] [in] [aw fw pw iw], /// /// [ /// @@ -52,9 +55,7 @@ *Add space between code and output noi di "" - preserve -qui { *Set minimum version for this command version 12 diff --git a/src/ado_files/ieboilstart.ado b/src/ado/ieboilstart.ado similarity index 99% rename from src/ado_files/ieboilstart.ado rename to src/ado/ieboilstart.ado index 65056641..7c099167 100644 --- a/src/ado_files/ieboilstart.ado +++ b/src/ado/ieboilstart.ado @@ -1,8 +1,10 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org capture program drop ieboilstart program ieboilstart , rclass + version 12.0 + qui { syntax , /// @@ -22,8 +24,6 @@ Custom(string) /// ] - version 12 - /*************************************************************************** Handle deprecated options ***************************************************************************/ @@ -314,4 +314,4 @@ } } - end +end diff --git a/src/ado_files/ieddtab.ado b/src/ado/ieddtab.ado similarity index 99% rename from src/ado_files/ieddtab.ado rename to src/ado/ieddtab.ado index 34a506e7..08a90e60 100644 --- a/src/ado_files/ieddtab.ado +++ b/src/ado/ieddtab.ado @@ -1,8 +1,10 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org cap program drop ieddtab program define ieddtab, rclass + version 12.0 + syntax varlist(numeric) [if] [in] [aw fw iw pw], /// /// Time(varname numeric) TREATment(varname numeric) /// @@ -33,9 +35,6 @@ cap program drop ieddtab nonumbers /// ] - *Set minimum version for this command - version 12 - /************* Input handling diff --git a/src/ado_files/iedropone.ado b/src/ado/iedropone.ado similarity index 92% rename from src/ado_files/iedropone.ado rename to src/ado/iedropone.ado index 78e3451a..4b2d2835 100644 --- a/src/ado_files/iedropone.ado +++ b/src/ado/iedropone.ado @@ -1,37 +1,32 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org - capture program drop iedropone - program define iedropone , +cap program drop iedropone + program define iedropone - qui { +qui { - syntax [if] , [Numobs(numlist int min=1 max=1 >0) mvar(varname) mval(string) zerook] + version 12.0 - - version 12 + syntax [if] , [Numobs(numlist int min=1 max=1 >0) mvar(varname) mval(string) zerook] /*********************************** - Set constants - ***********************************/ *Set a constant for the multi option being used - local MULTI_USED 0 + local MULTI_USED 0 if ("`mvar'" != "" & "`mval'" != "") local MULTI_USED 1 *Set a constant for the zerook option being used - local ZEROOK_USED 0 - if ("`zerook'" != "") local ZEROOK_USED 1 + local ZEROOK_USED 0 + if ("`zerook'" != "") local ZEROOK_USED 1 *Set a constant for if an IF-condition used local IF_USED 0 - if (`"`if'"' != "") local IF_USED 1 + if (`"`if'"' != "") local IF_USED 1 /*********************************** - Test input - ***********************************/ *Test that mvar() and mval() was used in combination @@ -53,16 +48,12 @@ error 197 } - /*********************************** - Set locals - ***********************************/ *If number of obs to drop is not set, then use the default which is 1 if "`numobs'" == "" { - local numobs = 1 } @@ -76,9 +67,7 @@ } /*********************************** - Test the number of obs matching - ***********************************/ *Subfunction options @@ -132,12 +121,9 @@ } /*********************************** - Drop observation(s) - ***********************************/ - *Test if multivars are used if `MULTI_USED' == 0 { @@ -166,14 +152,13 @@ if `num_obs_dropped' != 1 noi di "`num_obs_dropped' observations were dropped" } - - end +end **Sub function that checks that the number of observations * to drop is correct and it returns the number of observations * that will be dropped. - capture program drop iedropone_test_match + cap program drop iedropone_test_match program define iedropone_test_match , rclass @@ -231,4 +216,4 @@ error 197 } - end +end diff --git a/src/ado_files/iefolder.ado b/src/ado/iefolder.ado similarity index 99% rename from src/ado_files/iefolder.ado rename to src/ado/iefolder.ado index 167019bf..5376f386 100644 --- a/src/ado_files/iefolder.ado +++ b/src/ado/iefolder.ado @@ -1,16 +1,13 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org -cap program drop iefolder - program define iefolder +cap program drop iefolder + program define iefolder qui { - syntax anything, PROJectfolder(string) [ABBreviation(string) SUBfolder(string)] + version 12.0 - version 12 - - ***Todo - *give error message if divisor is changed + syntax anything, PROJectfolder(string) [ABBreviation(string) SUBfolder(string)] *Create an empty line before error message or output noi di "" diff --git a/src/ado_files/iegitaddmd.ado b/src/ado/iegitaddmd.ado similarity index 98% rename from src/ado_files/iegitaddmd.ado rename to src/ado/iegitaddmd.ado index cd6f91ef..17fc126c 100644 --- a/src/ado_files/iegitaddmd.ado +++ b/src/ado/iegitaddmd.ado @@ -1,14 +1,14 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org cap program drop iegitaddmd - program define iegitaddmd + program define iegitaddmd qui { - syntax , folder(string) [comparefolder(string) customfile(string) all skip replace AUTOmatic DRYrun skipfolders(string)] + version 12.0 + + syntax , folder(string) [comparefolder(string) customfile(string) all skip replace AUTOmatic DRYrun skipfolders(string)] - *Set version - version 12 /****************************** ******************************* diff --git a/src/ado_files/iegraph.ado b/src/ado/iegraph.ado similarity index 96% rename from src/ado_files/iegraph.ado rename to src/ado/iegraph.ado index 44d5a6b0..6eb23f62 100644 --- a/src/ado_files/iegraph.ado +++ b/src/ado/iegraph.ado @@ -1,814 +1,814 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org - -cap program drop iegraph - program define iegraph, rclass - - syntax varlist, /// - [noconfbars /// - confbarsnone(varlist) /// - confintval(numlist min=1 max=1 >0 <1) /// - BARLabel /// - BARColors(string) /// - MLABColor(string) /// - MLABPosition(numlist) /// - MLABSize(string) /// - BAROPTions(string) /// - barlabelformat(string) /// - GREYscale /// - GRAYscale /// - yzero /// - BASICTItle(string) /// - VARLabels /// - ignoredummytest /// - norestore /// - save(string) *] - - if "`restore'" == "" preserve - - qui { - - version 12 - -/******************************************************************************* - - Identify options used - -********************************************************************************/ - - *Checking to see if the noconfbars option has been used and assigning 1 and 0 based - *on that to the CONFINT_BAR variable. - if "`confbars'" != "" local CONFINT_BAR = 0 - if "`confbars'" == "" local CONFINT_BAR = 1 - - *Checking to see if the barlabel option has been used and assigning 1 and 0 based - *on that to the LABEL_BAR variable. - if "`barlabel'" != "" local LABEL_BAR = 1 - if "`barlabel'" == "" local LABEL_BAR = 0 - - *Checking to see if the mlabposition option has been used and assigning 1 and 0 based - *on that to the LABEL_POS variable. - if "`mlabposition'" != "" local LABEL_POS = 1 - if "`mlabposition'" == "" local LABEL_POS = 0 - - *Checking to see if the mlabcolor option has been used and assigning 1 and 0 based - *on that to the LABEL_COL variable. - if "`mlabcolor'" != "" local LABEL_COL = 1 - if "`mlabcolor'" == "" local LABEL_COL = 0 - - *Checking to see if the mlabcolor option has been used and assigning 1 and 0 based - *on that to the LABEL_COL variable. - if "`mlabsize'" != "" local LABEL_SIZE = 1 - if "`mlabsize'" == "" local LABEL_SIZE = 0 - - *Checking to see if the barlabelformat option has been used and assigning 1 and 0 based - *on that to the LABEL_FORMAT variable. - if "`barlabelformat'" != "" local LABEL_FORMAT = 1 - if "`barlabelformat'" == "" local LABEL_FORMAT = 0 - -/******************************************************************************* - - Prepare inputs - -********************************************************************************/ - - *Only keep the observations in the regressions - keep if e(sample) == 1 - - *Copy beta matrix to a regular matrix - mat BETA = e(b) - - *Translate GREYscale to GRAYscale - if "`greyscale'" != "" local grayscale "grayscale" - - *Unabbreviate and varlists - unab varlist : `varlist' - - *Testing to see if the variables used in the regressions are actual dummy variables as treatment vars need to be dummy variables. - foreach var of local varlist { - - *Get the column number from this var - local colnumber = colnumb(BETA,"`var'") - - *Test if this var was omitted from the regression - if "`r(label`colnumber')'" == "(omitted)" { - - *Test if that dummy is not found in the estimation matrix - noi di as error "{phang}Dummy variable `var' was not included in the regression, or was omitted from it.{p_end}" - error 480 - } - } - - foreach var of local varlist { - *Assigning variable coefficient/standard errors/no of obs. to scalars with the name Coeff_(`variable name') - *coeff_se_(`variable name'), obs_(`variable name'). - - *Access and store the beta value ( - scalar coeff_`var' = _b[`var'] - - *Access and store standard errors for the dummy - scalar coeff_se_`var' = _se[`var'] - - *Store the number of observations for this dummy - count if `var' == 1 //Count one tmt group at the time - scalar obs_`var' = r(N) - - } - - *Test if the list of dummies are valid - if "`ignoredummytest'" == "" testDums `varlist' - - - *Testing to see if the variables used in confbarsnone are - *actually in the list of - *variables used for the regression/graph. - local varTest : list confbarsnone in varlist - - if `varTest' == 0 { - *Error displayed if variables defined in confbarsnone aren't in the list of variables for the graph. - noi display as error "{phang} Variables defined in confbarsnone(`confbarsnone') cannot be found in the graph variable list. {p_end}" - noi display "" - error 111 - } - - * Can only be used if the bar label is displayed - if `LABEL_BAR' == 0 { - if `LABEL_FORMAT' | `LABEL_POS' | `LABEL_COL' | `LABEL_SIZE' { - noi display as error "{phang} Options barlabelformat(), mlabsize(), mlabposition() and mlabcolor() can only be specified when option barlabel is used. {p_end}" - error 198 - } - } - else { - - ************************************** - * Check that specified format is valid - ************************************** - - if `LABEL_FORMAT' { - if substr("`barlabelformat'",1,1) != "%" | !inlist(substr("`barlabelformat'",-1,1), "e", "f") | !regex("`barlabelformat'", "\.") { - noi display as error "{phang} Option barlabelformat() was incorrectly specified. Only fixed and exponencial formats are currently allowed. See {help format} for more information on how to specify a variable format.{p_end}" - error 198 - } - } - - *************************************************************************** - * Check that label options are valid. If not, print warning and turn switch - * off so default will be used - *************************************************************************** - if `LABEL_POS' { - noi clockname `mlabposition' - local LABEL_POS = r(LABEL_POS) - } - if `LABEL_SIZE' { - noi sizename `mlabsize' - local LABEL_SIZE = r(LABEL_SIZE) - } - if `LABEL_COL' { - if !inlist("`mlabcolor'", "background", "bg", "foreground", "fg") { - noi test_color, color(`mlabcolor') option("mlabcolor") - } - } - } - - *Checking to see if the save option is used what is the extension related to it. - if "`save'" != "" { - - **Find the last . in the path name and assume that - * the file extension is what follows. However, with names - * that have multiple dots in it, the user has to explicitly - * specify the file name. - - **First, will extract the file names from the combination of file - * path and files names. We will use both backslash and forward slash - * to account for differences in Windows/Unix file paths - local backslash = strpos(reverse("`save'"), "\") - local forwardslash = strpos(reverse("`save'"), "/") - - ** Replacing the value of forward/back slash with the other value if one of the - * values is equal to zero. - if `forwardslash' == 0 local forwardslash = `backslash' - if `backslash' == 0 local backslash = `forwardslash' - - **Extracting the file name from the full file path by reversing and breaking the path - * at the first occurence of slash. - local file_name = substr(reverse("`save'"), 1, (min(`forwardslash', `backslash')-1)) - local file_name = reverse("`file_name'") - - **If no slashes it means that there is no file path and just a file name, so the name of the file will be - * the local save. - if (`forwardslash' == 0 & `backslash' == 0) local file_name = "`save''" - - *Assign the full file path to the local file_suffix - local file_suffix = "`file_name'" - - *Find index for where the file type suffix start - local dot_index = strpos("`file_name'",".") - - local file_suffix = substr("`file_name'", `dot_index' + 1, .) - - *If no dot in the name, then no file extension - if `dot_index' == 0 { - local save `"`save'.gph"' - local file_suffix "gph" - local save_export = 0 - } - - **If there is one or many . in the file path than loop over - * the file path until we have found the last one. - - **Find index for where the file type suffix starts. We are re-checking - * to see if there are any more dots than the first one. If there are, - * then there needs to be an error message saying remove the dots. - local dot_index = strpos("`file_suffix'",".") - - *Extract the file index - - if (`dot_index' > 0) { - di as error "{pstd}File names cannot have more than one dot. Please only use the dot to separate the filename and file format.{p_end}" - error 198 - } - - *List of formats to which the file can be exported - local nonGPH_formats png tiff gph ps eps pdf wmf emf - - *If no file format suffix is specified, use the default .gph - if "`file_suffix'" == "gph" { - local save_export = 0 - } - - *If a file format suffix is specified make sure that it is one of the eight formats allowed. - else if `:list file_suffix in nonGPH_formats' != 0 { - local save_export = 1 - - if ("`file_suffix'" == "wmf" | "`file_suffix'" == "emf") & "`c(os)'" != "Windows" { - di as error "{pstd}The file formats .wmf and .emf are only allowed when using Stata on a Windows computer.{p_end}" - error 198 - } - } - *If a different extension was used then display an error. - else { - - di as error "{pstd}You are not using a allowed file format in save(`save'). Only the following formats are allowed: gph `nonGPH_formats'. {p_end}" - error 198 - } - } - else { - - *Save option is not used, therefore save export will not be used - local save_export = 0 - - } - - * Set default barlabel options - if `LABEL_BAR' { - if !`LABEL_POS' local mlabposition 12 - if !`LABEL_COL' local mlabcolor black - if !`LABEL_SIZE' local mlabsize medium - } - - -/******************************************************************************* - - Get values from regression - -*******************************************************************************/ - - local count: word count `varlist' // Counting the number of total vars used as treatment. - local graphCount = `count' + 1 // Number of vars needed for the graph is total treatment vars plus one(control). - - //Make all vars tempvars (maybe do later) - //Make sure that missing is properly handled - - tempvar anyTMT control - egen `anyTMT' = rowmax(`varlist') - gen `control' = (`anyTMT' == 0) if !missing(`anyTMT') - - sum `e(depvar)' if `control' == 1 - scalar ctl_N = r(N) - scalar ctl_mean = r(mean) - scalar ctl_mean_sd = r(sd) - - - /** - Calculate t-statistics - **/ - - *If not set in options, use default of 95% - if "`confintval'" == "" { - local confintval = .95 - } - - **Since we calculating each tail separately we need to convert - * the two tail % to one tail % - local conintval_1tail = ( `confintval' + (1-`confintval' ) / 2) - - *degrees of freedom in regression - local df = `e(df_r)' - - *Calculate t-stats to be used - local tstats = invt(`df' , `conintval_1tail' ) - - - foreach var of local varlist { - - *Calculating confidnece interval - scalar conf_int_min_`var' = (coeff_`var'-(`tstats'*coeff_se_`var') + ctl_mean) - scalar conf_int_max_`var' = (coeff_`var'+(`tstats'*coeff_se_`var') + ctl_mean) - **Assigning stars to the treatment vars. - - *Perform the test to get p-values - test `var' - local star_`var' " " - - scalar pvalue =r(p) - if pvalue < 0.10 { - local star_`var' "*" - } - if pvalue < 0.05 { - local star_`var' "**" - } - if pvalue < 0.01 { - local star_`var' "***" - } - - scalar tmt_mean_`var' = ctl_mean + coeff_`var' - } - - -/******************************************************************************* - - Set up temp file where results are written - -*******************************************************************************/ - - - tempfile newTextFile - tempname newHandle - cap file close `newHandle' - file open `newHandle' using "`newTextFile'", text write append - - *Write headers and control value - file write `newHandle' /// - "position" _tab "xLabeled" _tab "mean" _tab "coeff" _tab "conf_int_min" _tab "conf_int_max" _tab "obs" _tab "star" _n /// - %9.3f (1) _tab "Control" _tab %9.3f (ctl_mean) _tab _tab _tab _tab %9.3f (ctl_N) _tab _n - - tempvar newCounter - gen `newCounter' = 2 //First tmt group starts at 2 (1 is control) - - foreach var in `varlist' { - - if "`varlabels'" == "" { - - *Default is to use the varname in legend - local var_legend "`var'" - - } - else { - - *Option to use the variable label in the legend instead - local var_legend : variable label `var' - - } - - *Writing the necessary tables for the graph to list to file. - if `: list var in confbarsnone' { - file write `newHandle' %9.3f (`newCounter') _tab `"`var_legend'"' /// - _tab %9.3f (tmt_mean_`var') _tab %9.3f (coeff_`var') _tab _tab /// - _tab %9.3f (obs_`var') _tab "`star_`var''" _n - - replace `newCounter' = `newCounter' + 1 - } - else { - file write `newHandle' %9.3f (`newCounter') _tab `"`var_legend'"' /// - _tab %9.3f (tmt_mean_`var') _tab %9.3f (coeff_`var') /// - _tab %9.3f (conf_int_min_`var') _tab %9.3f (conf_int_max_`var') /// - _tab %9.3f (obs_`var') _tab "`star_`var''" _n - - replace `newCounter' = `newCounter' + 1 - } - } - - file close `newHandle' - -/******************************************************************************* - - Create the graph - -*******************************************************************************/ - - - *Read file with results - insheet using `newTextFile', clear - - *Defining various options to go on the graph option. - - local tmtGroupBars "" - local xAxisLabels `"xlabel( "' - local legendLabels "" - local legendNumbers "" - - forval tmtGroupCount = 1/`graphCount' { - - ************ - *Create the bar for this group - - if "`grayscale'" == "" { - colorPicker, gnum(`tmtGroupCount') tnum(`graphCount') /// - colors(`"`barcolors'"') - } - else { - grayPicker `tmtGroupCount' `graphCount' - } - - local tmtGroupBars `"`tmtGroupBars' (bar mean position if position == `tmtGroupCount', color("`r(color)'") lcolor(black) `baroptions' ) "' - - ************ - *Create labels etc. for this group - - local obs = obs[`tmtGroupCount'] - local stars = star[`tmtGroupCount'] - local legendLabel = xlabeled[`tmtGroupCount'] - - local xAxisLabels `"`xAxisLabels' `tmtGroupCount' "(N = `obs') `stars'" "' - local legendLabels `"`legendLabels' lab(`tmtGroupCount' "`legendLabel'") "' - local legendNumbers `"`legendNumbers' `tmtGroupCount'"' - } - - *Close or complete some strings - local xAxisLabels `"`xAxisLabels' ,noticks labsize(medsmall)) "' - local legendOption `"legend(order(`legendNumbers') `legendLabels')"' - - - *Create the confidence interval bars - - if `CONFINT_BAR' == 0 { - - local confIntGraph = "" - } - else if `CONFINT_BAR' == 1 { - local confIntGraph = `"(rcap conf_int_max conf_int_min position, lc(gs)) (scatter mean position, msymbol(none) mlabsize(`mlabsize') mlabposition(`mlabposition') mlabcolor(`mlabcolor'))"' - } - - *Create the bar label - if `LABEL_BAR' == 0 { - local barLabel = "" - } - else if `LABEL_BAR' == 1 { - - gen label = mean - - if `LABEL_FORMAT' == 1 { - format label `barlabelformat' - } - else if `LABEL_FORMAT' == 0 { - format label %9.1f - } - - local barLabel = `"(scatter mean position, msymbol(none) mlab(label) mlabsize(`mlabsize') mlabposition(`mlabposition') mlabcolor(`mlabcolor'))"' - } - - local titleOption `" , xtitle("") ytitle("`e(depvar)'") "' - - if "`save'" != "" { - local saveOption saving("`save'", replace) - } - - ******************************************************************************* - *** Generating the graph axis labels for the [yzero] option used.. - ******************************************************************************* - - *Calculations needed if yzero used - if ("`yzero'" != "" ) { - - **Testing if [yzero] is applicable - ******************************** - - ** [yzero] is only applicable if all values used in the graph - * are all negative or all positive. If there is a mix, then - * the [yzero] option will be ignored - - *Finding the min value for all values used in the graph - gen row_minvalue = min(mean, conf_int_min, conf_int_max) - sum row_minvalue - local min_value `r(min)' - - *Finding the min value for all values used in the graph - gen row_maxvalue = max(mean , conf_int_max, conf_int_min) - sum row_maxvalue - local max_value `r(max)' - - *Locals used for logic below - local signcheck = ((`max_value' * `min_value') >= 0) // dummy local for both signs the same (positive or negative) - local negative = (`max_value' <= 0) // dummy for max value still negative (including 0) - - **If [yzero] is used and min and max does not have - * the same sign, then [yzero] is not applicable. - - if (`signcheck' == 0 ) { - - **** [yzero] is NOT applicable and will be ignored - ************************************************* - - noi di "{pstd}{error:WARNING:} Option yzero will be ignored as the graph has values both on the the positve and negative part of the y-axis. This only affects formatting of the graph. See helpfile for more details.{p_end}" - } - else { - - **** [yzero] is applicable and will be used - ***************************************** - - *Get max value if only postive values - if (`negative' == 0) { - - sum row_maxvalue - local absMax = `max_value' - } - - *Get absolute min (will convert back below) if only negative values - else { - - sum row_minvalue - local absMax = abs(`min_value') - } - - *Rounded up to the nearest power of ten - local logAbsMax = ceil(log10(`absMax')) - local absMax = 10 ^ (`logAbsMax') - - *Generating quarter value for y-axis markers. - local quarter = (`absMax') / 4 - - **Construct the option to be applied to - * the graph using the values calculated - if (`negative' == 0) { - - local yzero_option ylabel(0(`quarter')`absMax') - } - else { - - local absMax = `absMax' * (-1) // Convert back to negative - local yzero_option ylabel(`absMax'(`quarter')0) - } - } - } - - ******************************************************************************* - ***Graph generation based on if the option [save] has an export or a save feature. - ******************************************************************************* - - *Store all the options in one local - local commandline `" `tmtGroupBars' `confIntGraph' `barLabel' `titleOption' `legendOption' `xAxisLabels' title("`basictitle'") `yzero_option' `options' "' - - *Error message used in both save-option cases below. - local graphErrorMessage `" Something went wrong while trying to generate the graph. Click {stata di r(cmd) :display graph options } to see what graph options iegraph used. This can help in locating the source of the error in the command. "' - - if `save_export' == 0 { - - *Generate a return local with the code that will be used to generate the graph - return local cmd `"graph twoway `commandline' `saveOption'"' - - *Generate the graph - cap graph twoway `commandline' `saveOption' - - *If error, provide error message and then run the code again allowing the program to crash - if _rc { - - di as error "{pstd}`graphErrorMessage'{p_end}" - graph twoway `commandline' `saveOption' - } - } - else if `save_export' == 1 { - - *Generate a return local with the code that will be used to generate the graph - return local cmd `"graph twoway `commandline'"' - - *Generate the graph - cap graph twoway `commandline' - - *If error, provide error message and then run the code again allowing the program to crash - if _rc { - - di as error "{pstd}`graphErrorMessage'{p_end}" - graph twoway `commandline' - } - - *Export graph to preferred option - graph export "`save'", replace - - } - - if "`restore'" == "" restore -} - -end - ******************************************* - ******************************************* - ******* To pick colors based ******* - ******* on the number of vars ******* - ******************************************* - ******************************************* - cap program drop colorPicker - program define colorPicker , rclass - - * gnum - number of this group - * tnum - total number of groups - * customc - custom list of colors - syntax, gnum(numlist >0) [tnum(numlist >0) colors(string)] - - * Define default colors if no colors are provided - if missing("`colors'") { - if (`tnum' == 2) local colors `" "215 25 28" "43 123 182" "' - else if (`tnum' == 3) local colors `" "215 25 28" "255 255 191" "43 123 182" "' - else if (`tnum' == 4) local colors `" "215 25 28" "255 255 191" "171 217 233" "43 123 182" "' - else local colors `" "215 25 28" "253 174 93" "255 255 191" "171 217 233" "43 123 182" "' - } - - * Count number of colors - local color_count : word count `colors' - - * Modular devision of group numb with total number. - * This repeats colors if group num is higher than total number of colors - local color_num = mod(`gnum', `color_count') - if (`color_num' == 0) local color_num = `color_count' - - * Pick, test and return color in list - local color : word `color_num' of `colors' - test_color , color("`color'") option("barcolors") - return local color "`color'" - - end - - ******************************************* - ******************************************* - ******* Grayscale Option ******* - ******* Colour Picker ******* - ******************************************* - ******************************************* - - cap program drop grayPicker - program define grayPicker , rclass - - args groupCount totalNumGroups - - if (`groupCount' == 1) return local color "black" - else if (`groupCount'==2) & (`totalNumGroups'<=3) return local color "gs14" - else { - local grayscale = round((`groupCount'-1)*(100/(`totalNumGroups'-1))) - return local color "`grayscale' `grayscale' `grayscale' `grayscale'" - } - - end - - ******************************************* - ******************************************* - ******* Test if valid ******* - ******* dummies ******* - ******************************************* - ******************************************* - - cap program drop testDums - program define testDums - - unab dumlist : `0' - - foreach dumvar of varlist `dumlist' { - - *Test: all values dummies (missing would have been excluded in regression and we keep if e(sample) - cap assert inlist(`dumvar',0,1) - if _rc { - noi display as error "{phang} The variable `dumvar' is not a dummy. Treatment variable needs to be a dummy (0 or 1) variable. {p_end}" - noi display "" - error 149 - } - } - - /*What we are testing for below: - - We count the number of dummies that each obervation has the value 1 for. - - The count numbers must either fit the case of diff-in-diff or the case of regression with one dummy for each treatment arms - - Regular regression with one dummy for each treatment arm - - Some observations don't have 1 for any dummy - omitted control observations - - No observation has the value 1 in more than one observation - can't be in more than one treatment group - - No treatment group can have no observation with value 1 for that dummy - - Diff-in-Diff - - Some observations don't have 1 for any dummy - omitted controls observations in time = 0 - - Some observation must have value 1 for only the treatment dummy - treatment observations in time = 0 - - Some observation must have value 1 for only the time dummy - control observations in time = 1 - - Some observation must have value 1 for in all three of time, treatment and interaction dummy - treatment observations in time = 1 - - */ - - *Count how many dummies is 1 for each observation - tempvar dum_count - egen `dum_count' = rowtotal(`dumlist') - - *Exactly one dummy is 1, meaning this observation is in one of the treatment arms - count if `dum_count' == 1 - local dum_count_1 `r(N)' - - *No dummies is 1, meaning this observation is control - count if `dum_count' == 0 - local dum_count_0 `r(N)' - - *Exactly 3 dummies are three. Only allowed in the exact case of diff-and-diff regressions - count if `dum_count' == 3 - local dum_count_3 `r(N)' - - *Exactly 2 or more than three is never correct. - count if `dum_count' == 2 | `dum_count' > 3 - local dum_count_2orgt3 `r(N)' - - *Test that there are at least some treatment observations - if `dum_count_0' == 0 noi di as error "{phang} There are no control observations. One category must be omitted and it should be the omitted category in the regression. The omitted category will be considerd the control group. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" - if `dum_count_0' == 0 error 480 - - *Test that there are at least some control observations (this error should be caught by dummies omitted in the regression) - if `dum_count_1' == 0 noi di as error "{phang} There are no treatment observations. None of the dummies have observations for which the dummy has the value 1. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" - if `dum_count_1' == 0 error 480 - - *Test if there are any observations that have two or more than three dummies that is 1 - if `dum_count_2orgt3' > 0 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" - if `dum_count_2orgt3' > 0 error 480 - - *After passing the previous two steps, test if there are cases that are only allowed in diff - if `dum_count_3' > 0 { - - *Diff-and-diff must have exactly 3 dummies - if `:list sizeof dumlist' != 3 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" - if `:list sizeof dumlist' != 3 error 480 - - * Test if valid diff-diff - testDumsDD `dum_count' `dumlist' - } - - end - - cap program drop testDumsDD - program define testDumsDD - - local dum_count `1' - - **Test that for only two of three dummies there are observations - * that has only that dummy. I.e. the two that is not the - * interaction. If the interaction is 1, all three shluld be 1. - - *Count how many dummies the condition is above applies to - local counter 0 - - *Loop over all dummies - forvalues i = 2/4 { - - *Test the number - count if ``i'' == 1 & `dum_count' == 1 - if `r(N)' > 0 local ++counter - - } - *Count that exactly two dummies fullfilled the condition - if `counter' != 2 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}"" - if `counter' != 2 error 480 - - end - - * Test inputs for label - cap prog drop sizename - prog def sizename, rclass - - args name - - capture findfile gsize-`name'.style - - if ( _rc == 601 ) { - - noi di "{phang} WARNING: Option mlabsize() was incorrectly specified. Only {help textsizestyle} values are accepted. Default size used.{p_end}" - return local LABEL_SIZE 0 - } - - end - - cap prog drop test_color - prog def test_color, rclass - - syntax, color(string) option(string) - - capture findfile color-`color'.style - if ( _rc == 601 ) { - noi di as error "{pstd} The color {inp:`color'} used in option {inp:`option'()} was incorrectly specified. Only colors listed in {help colorstyle} are accepted.{p_end}" - error 99 - exit - } - end - - - cap prog drop clockname - prog def clockname, rclass - - args name - - capture findfile clockdir-`name'.style - - if ( _rc == 601 ) { - - noi di "{phang} WARNING: Option mlabposition() was incorrectly specified. Only {help clockposstyle} values are accepted. Default position used.{p_end}" - return local LABEL_POS 0 - } - - end +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org + +cap program drop iegraph + program define iegraph, rclass + +qui { + + version 12.0 + + syntax varlist, /// + [noconfbars /// + confbarsnone(varlist) /// + confintval(numlist min=1 max=1 >0 <1) /// + BARLabel /// + BARColors(string) /// + MLABColor(string) /// + MLABPosition(numlist) /// + MLABSize(string) /// + BAROPTions(string) /// + barlabelformat(string) /// + GREYscale /// + GRAYscale /// + yzero /// + BASICTItle(string) /// + VARLabels /// + ignoredummytest /// + norestore /// + save(string) *] + + if "`restore'" == "" preserve + +/******************************************************************************* + + Identify options used + +********************************************************************************/ + + *Checking to see if the noconfbars option has been used and assigning 1 and 0 based + *on that to the CONFINT_BAR variable. + if "`confbars'" != "" local CONFINT_BAR = 0 + if "`confbars'" == "" local CONFINT_BAR = 1 + + *Checking to see if the barlabel option has been used and assigning 1 and 0 based + *on that to the LABEL_BAR variable. + if "`barlabel'" != "" local LABEL_BAR = 1 + if "`barlabel'" == "" local LABEL_BAR = 0 + + *Checking to see if the mlabposition option has been used and assigning 1 and 0 based + *on that to the LABEL_POS variable. + if "`mlabposition'" != "" local LABEL_POS = 1 + if "`mlabposition'" == "" local LABEL_POS = 0 + + *Checking to see if the mlabcolor option has been used and assigning 1 and 0 based + *on that to the LABEL_COL variable. + if "`mlabcolor'" != "" local LABEL_COL = 1 + if "`mlabcolor'" == "" local LABEL_COL = 0 + + *Checking to see if the mlabcolor option has been used and assigning 1 and 0 based + *on that to the LABEL_COL variable. + if "`mlabsize'" != "" local LABEL_SIZE = 1 + if "`mlabsize'" == "" local LABEL_SIZE = 0 + + *Checking to see if the barlabelformat option has been used and assigning 1 and 0 based + *on that to the LABEL_FORMAT variable. + if "`barlabelformat'" != "" local LABEL_FORMAT = 1 + if "`barlabelformat'" == "" local LABEL_FORMAT = 0 + +/******************************************************************************* + + Prepare inputs + +********************************************************************************/ + + *Only keep the observations in the regressions + keep if e(sample) == 1 + + *Copy beta matrix to a regular matrix + mat BETA = e(b) + + *Translate GREYscale to GRAYscale + if "`greyscale'" != "" local grayscale "grayscale" + + *Unabbreviate and varlists + unab varlist : `varlist' + + *Testing to see if the variables used in the regressions are actual dummy variables as treatment vars need to be dummy variables. + foreach var of local varlist { + + *Get the column number from this var + local colnumber = colnumb(BETA,"`var'") + + *Test if this var was omitted from the regression + if "`r(label`colnumber')'" == "(omitted)" { + + *Test if that dummy is not found in the estimation matrix + noi di as error "{phang}Dummy variable `var' was not included in the regression, or was omitted from it.{p_end}" + error 480 + } + } + + foreach var of local varlist { + *Assigning variable coefficient/standard errors/no of obs. to scalars with the name Coeff_(`variable name') + *coeff_se_(`variable name'), obs_(`variable name'). + + *Access and store the beta value ( + scalar coeff_`var' = _b[`var'] + + *Access and store standard errors for the dummy + scalar coeff_se_`var' = _se[`var'] + + *Store the number of observations for this dummy + count if `var' == 1 //Count one tmt group at the time + scalar obs_`var' = r(N) + + } + + *Test if the list of dummies are valid + if "`ignoredummytest'" == "" testDums `varlist' + + + *Testing to see if the variables used in confbarsnone are + *actually in the list of + *variables used for the regression/graph. + local varTest : list confbarsnone in varlist + + if `varTest' == 0 { + *Error displayed if variables defined in confbarsnone aren't in the list of variables for the graph. + noi display as error "{phang} Variables defined in confbarsnone(`confbarsnone') cannot be found in the graph variable list. {p_end}" + noi display "" + error 111 + } + + * Can only be used if the bar label is displayed + if `LABEL_BAR' == 0 { + if `LABEL_FORMAT' | `LABEL_POS' | `LABEL_COL' | `LABEL_SIZE' { + noi display as error "{phang} Options barlabelformat(), mlabsize(), mlabposition() and mlabcolor() can only be specified when option barlabel is used. {p_end}" + error 198 + } + } + else { + + ************************************** + * Check that specified format is valid + ************************************** + + if `LABEL_FORMAT' { + if substr("`barlabelformat'",1,1) != "%" | !inlist(substr("`barlabelformat'",-1,1), "e", "f") | !regex("`barlabelformat'", "\.") { + noi display as error "{phang} Option barlabelformat() was incorrectly specified. Only fixed and exponencial formats are currently allowed. See {help format} for more information on how to specify a variable format.{p_end}" + error 198 + } + } + + *************************************************************************** + * Check that label options are valid. If not, print warning and turn switch + * off so default will be used + *************************************************************************** + if `LABEL_POS' { + noi clockname `mlabposition' + local LABEL_POS = r(LABEL_POS) + } + if `LABEL_SIZE' { + noi sizename `mlabsize' + local LABEL_SIZE = r(LABEL_SIZE) + } + if `LABEL_COL' { + if !inlist("`mlabcolor'", "background", "bg", "foreground", "fg") { + noi test_color, color(`mlabcolor') option("mlabcolor") + } + } + } + + *Checking to see if the save option is used what is the extension related to it. + if "`save'" != "" { + + **Find the last . in the path name and assume that + * the file extension is what follows. However, with names + * that have multiple dots in it, the user has to explicitly + * specify the file name. + + **First, will extract the file names from the combination of file + * path and files names. We will use both backslash and forward slash + * to account for differences in Windows/Unix file paths + local backslash = strpos(reverse("`save'"), "\") + local forwardslash = strpos(reverse("`save'"), "/") + + ** Replacing the value of forward/back slash with the other value if one of the + * values is equal to zero. + if `forwardslash' == 0 local forwardslash = `backslash' + if `backslash' == 0 local backslash = `forwardslash' + + **Extracting the file name from the full file path by reversing and breaking the path + * at the first occurence of slash. + local file_name = substr(reverse("`save'"), 1, (min(`forwardslash', `backslash')-1)) + local file_name = reverse("`file_name'") + + **If no slashes it means that there is no file path and just a file name, so the name of the file will be + * the local save. + if (`forwardslash' == 0 & `backslash' == 0) local file_name = "`save''" + + *Assign the full file path to the local file_suffix + local file_suffix = "`file_name'" + + *Find index for where the file type suffix start + local dot_index = strpos("`file_name'",".") + + local file_suffix = substr("`file_name'", `dot_index' + 1, .) + + *If no dot in the name, then no file extension + if `dot_index' == 0 { + local save `"`save'.gph"' + local file_suffix "gph" + local save_export = 0 + } + + **If there is one or many . in the file path than loop over + * the file path until we have found the last one. + + **Find index for where the file type suffix starts. We are re-checking + * to see if there are any more dots than the first one. If there are, + * then there needs to be an error message saying remove the dots. + local dot_index = strpos("`file_suffix'",".") + + *Extract the file index + + if (`dot_index' > 0) { + di as error "{pstd}File names cannot have more than one dot. Please only use the dot to separate the filename and file format.{p_end}" + error 198 + } + + *List of formats to which the file can be exported + local nonGPH_formats png tiff gph ps eps pdf wmf emf + + *If no file format suffix is specified, use the default .gph + if "`file_suffix'" == "gph" { + local save_export = 0 + } + + *If a file format suffix is specified make sure that it is one of the eight formats allowed. + else if `:list file_suffix in nonGPH_formats' != 0 { + local save_export = 1 + + if ("`file_suffix'" == "wmf" | "`file_suffix'" == "emf") & "`c(os)'" != "Windows" { + di as error "{pstd}The file formats .wmf and .emf are only allowed when using Stata on a Windows computer.{p_end}" + error 198 + } + } + *If a different extension was used then display an error. + else { + + di as error "{pstd}You are not using a allowed file format in save(`save'). Only the following formats are allowed: gph `nonGPH_formats'. {p_end}" + error 198 + } + } + else { + + *Save option is not used, therefore save export will not be used + local save_export = 0 + + } + + * Set default barlabel options + if `LABEL_BAR' { + if !`LABEL_POS' local mlabposition 12 + if !`LABEL_COL' local mlabcolor black + if !`LABEL_SIZE' local mlabsize medium + } + + +/******************************************************************************* + + Get values from regression + +*******************************************************************************/ + + local count: word count `varlist' // Counting the number of total vars used as treatment. + local graphCount = `count' + 1 // Number of vars needed for the graph is total treatment vars plus one(control). + + //Make all vars tempvars (maybe do later) + //Make sure that missing is properly handled + + tempvar anyTMT control + egen `anyTMT' = rowmax(`varlist') + gen `control' = (`anyTMT' == 0) if !missing(`anyTMT') + + sum `e(depvar)' if `control' == 1 + scalar ctl_N = r(N) + scalar ctl_mean = r(mean) + scalar ctl_mean_sd = r(sd) + + + /** + Calculate t-statistics + **/ + + *If not set in options, use default of 95% + if "`confintval'" == "" { + local confintval = .95 + } + + **Since we calculating each tail separately we need to convert + * the two tail % to one tail % + local conintval_1tail = ( `confintval' + (1-`confintval' ) / 2) + + *degrees of freedom in regression + local df = `e(df_r)' + + *Calculate t-stats to be used + local tstats = invt(`df' , `conintval_1tail' ) + + + foreach var of local varlist { + + *Calculating confidnece interval + scalar conf_int_min_`var' = (coeff_`var'-(`tstats'*coeff_se_`var') + ctl_mean) + scalar conf_int_max_`var' = (coeff_`var'+(`tstats'*coeff_se_`var') + ctl_mean) + **Assigning stars to the treatment vars. + + *Perform the test to get p-values + test `var' + local star_`var' " " + + scalar pvalue =r(p) + if pvalue < 0.10 { + local star_`var' "*" + } + if pvalue < 0.05 { + local star_`var' "**" + } + if pvalue < 0.01 { + local star_`var' "***" + } + + scalar tmt_mean_`var' = ctl_mean + coeff_`var' + } + + +/******************************************************************************* + + Set up temp file where results are written + +*******************************************************************************/ + + + tempfile newTextFile + tempname newHandle + cap file close `newHandle' + file open `newHandle' using "`newTextFile'", text write append + + *Write headers and control value + file write `newHandle' /// + "position" _tab "xLabeled" _tab "mean" _tab "coeff" _tab "conf_int_min" _tab "conf_int_max" _tab "obs" _tab "star" _n /// + %9.3f (1) _tab "Control" _tab %9.3f (ctl_mean) _tab _tab _tab _tab %9.3f (ctl_N) _tab _n + + tempvar newCounter + gen `newCounter' = 2 //First tmt group starts at 2 (1 is control) + + foreach var in `varlist' { + + if "`varlabels'" == "" { + + *Default is to use the varname in legend + local var_legend "`var'" + + } + else { + + *Option to use the variable label in the legend instead + local var_legend : variable label `var' + + } + + *Writing the necessary tables for the graph to list to file. + if `: list var in confbarsnone' { + file write `newHandle' %9.3f (`newCounter') _tab `"`var_legend'"' /// + _tab %9.3f (tmt_mean_`var') _tab %9.3f (coeff_`var') _tab _tab /// + _tab %9.3f (obs_`var') _tab "`star_`var''" _n + + replace `newCounter' = `newCounter' + 1 + } + else { + file write `newHandle' %9.3f (`newCounter') _tab `"`var_legend'"' /// + _tab %9.3f (tmt_mean_`var') _tab %9.3f (coeff_`var') /// + _tab %9.3f (conf_int_min_`var') _tab %9.3f (conf_int_max_`var') /// + _tab %9.3f (obs_`var') _tab "`star_`var''" _n + + replace `newCounter' = `newCounter' + 1 + } + } + + file close `newHandle' + +/******************************************************************************* + + Create the graph + +*******************************************************************************/ + + + *Read file with results + insheet using `newTextFile', clear + + *Defining various options to go on the graph option. + + local tmtGroupBars "" + local xAxisLabels `"xlabel( "' + local legendLabels "" + local legendNumbers "" + + forval tmtGroupCount = 1/`graphCount' { + + ************ + *Create the bar for this group + + if "`grayscale'" == "" { + colorPicker, gnum(`tmtGroupCount') tnum(`graphCount') /// + colors(`"`barcolors'"') + } + else { + grayPicker `tmtGroupCount' `graphCount' + } + + local tmtGroupBars `"`tmtGroupBars' (bar mean position if position == `tmtGroupCount', color("`r(color)'") lcolor(black) `baroptions' ) "' + + ************ + *Create labels etc. for this group + + local obs = obs[`tmtGroupCount'] + local stars = star[`tmtGroupCount'] + local legendLabel = xlabeled[`tmtGroupCount'] + + local xAxisLabels `"`xAxisLabels' `tmtGroupCount' "(N = `obs') `stars'" "' + local legendLabels `"`legendLabels' lab(`tmtGroupCount' "`legendLabel'") "' + local legendNumbers `"`legendNumbers' `tmtGroupCount'"' + } + + *Close or complete some strings + local xAxisLabels `"`xAxisLabels' ,noticks labsize(medsmall)) "' + local legendOption `"legend(order(`legendNumbers') `legendLabels')"' + + + *Create the confidence interval bars + + if `CONFINT_BAR' == 0 { + + local confIntGraph = "" + } + else if `CONFINT_BAR' == 1 { + local confIntGraph = `"(rcap conf_int_max conf_int_min position, lc(gs)) (scatter mean position, msymbol(none) mlabsize(`mlabsize') mlabposition(`mlabposition') mlabcolor(`mlabcolor'))"' + } + + *Create the bar label + if `LABEL_BAR' == 0 { + local barLabel = "" + } + else if `LABEL_BAR' == 1 { + + gen label = mean + + if `LABEL_FORMAT' == 1 { + format label `barlabelformat' + } + else if `LABEL_FORMAT' == 0 { + format label %9.1f + } + + local barLabel = `"(scatter mean position, msymbol(none) mlab(label) mlabsize(`mlabsize') mlabposition(`mlabposition') mlabcolor(`mlabcolor'))"' + } + + local titleOption `" , xtitle("") ytitle("`e(depvar)'") "' + + if "`save'" != "" { + local saveOption saving("`save'", replace) + } + + ******************************************************************************* + *** Generating the graph axis labels for the [yzero] option used.. + ******************************************************************************* + + *Calculations needed if yzero used + if ("`yzero'" != "" ) { + + **Testing if [yzero] is applicable + ******************************** + + ** [yzero] is only applicable if all values used in the graph + * are all negative or all positive. If there is a mix, then + * the [yzero] option will be ignored + + *Finding the min value for all values used in the graph + gen row_minvalue = min(mean, conf_int_min, conf_int_max) + sum row_minvalue + local min_value `r(min)' + + *Finding the min value for all values used in the graph + gen row_maxvalue = max(mean , conf_int_max, conf_int_min) + sum row_maxvalue + local max_value `r(max)' + + *Locals used for logic below + local signcheck = ((`max_value' * `min_value') >= 0) // dummy local for both signs the same (positive or negative) + local negative = (`max_value' <= 0) // dummy for max value still negative (including 0) + + **If [yzero] is used and min and max does not have + * the same sign, then [yzero] is not applicable. + + if (`signcheck' == 0 ) { + + **** [yzero] is NOT applicable and will be ignored + ************************************************* + + noi di "{pstd}{error:WARNING:} Option yzero will be ignored as the graph has values both on the the positve and negative part of the y-axis. This only affects formatting of the graph. See helpfile for more details.{p_end}" + } + else { + + **** [yzero] is applicable and will be used + ***************************************** + + *Get max value if only postive values + if (`negative' == 0) { + + sum row_maxvalue + local absMax = `max_value' + } + + *Get absolute min (will convert back below) if only negative values + else { + + sum row_minvalue + local absMax = abs(`min_value') + } + + *Rounded up to the nearest power of ten + local logAbsMax = ceil(log10(`absMax')) + local absMax = 10 ^ (`logAbsMax') + + *Generating quarter value for y-axis markers. + local quarter = (`absMax') / 4 + + **Construct the option to be applied to + * the graph using the values calculated + if (`negative' == 0) { + + local yzero_option ylabel(0(`quarter')`absMax') + } + else { + + local absMax = `absMax' * (-1) // Convert back to negative + local yzero_option ylabel(`absMax'(`quarter')0) + } + } + } + + ******************************************************************************* + ***Graph generation based on if the option [save] has an export or a save feature. + ******************************************************************************* + + *Store all the options in one local + local commandline `" `tmtGroupBars' `confIntGraph' `barLabel' `titleOption' `legendOption' `xAxisLabels' title("`basictitle'") `yzero_option' `options' "' + + *Error message used in both save-option cases below. + local graphErrorMessage `" Something went wrong while trying to generate the graph. Click {stata di r(cmd) :display graph options } to see what graph options iegraph used. This can help in locating the source of the error in the command. "' + + if `save_export' == 0 { + + *Generate a return local with the code that will be used to generate the graph + return local cmd `"graph twoway `commandline' `saveOption'"' + + *Generate the graph + cap graph twoway `commandline' `saveOption' + + *If error, provide error message and then run the code again allowing the program to crash + if _rc { + + di as error "{pstd}`graphErrorMessage'{p_end}" + graph twoway `commandline' `saveOption' + } + } + else if `save_export' == 1 { + + *Generate a return local with the code that will be used to generate the graph + return local cmd `"graph twoway `commandline'"' + + *Generate the graph + cap graph twoway `commandline' + + *If error, provide error message and then run the code again allowing the program to crash + if _rc { + + di as error "{pstd}`graphErrorMessage'{p_end}" + graph twoway `commandline' + } + + *Export graph to preferred option + graph export "`save'", replace + + } + + if "`restore'" == "" restore +} + +end + ******************************************* + ******************************************* + ******* To pick colors based ******* + ******* on the number of vars ******* + ******************************************* + ******************************************* + cap program drop colorPicker + program define colorPicker , rclass + + * gnum - number of this group + * tnum - total number of groups + * customc - custom list of colors + syntax, gnum(numlist >0) [tnum(numlist >0) colors(string)] + + * Define default colors if no colors are provided + if missing("`colors'") { + if (`tnum' == 2) local colors `" "215 25 28" "43 123 182" "' + else if (`tnum' == 3) local colors `" "215 25 28" "255 255 191" "43 123 182" "' + else if (`tnum' == 4) local colors `" "215 25 28" "255 255 191" "171 217 233" "43 123 182" "' + else local colors `" "215 25 28" "253 174 93" "255 255 191" "171 217 233" "43 123 182" "' + } + + * Count number of colors + local color_count : word count `colors' + + * Modular devision of group numb with total number. + * This repeats colors if group num is higher than total number of colors + local color_num = mod(`gnum', `color_count') + if (`color_num' == 0) local color_num = `color_count' + + * Pick, test and return color in list + local color : word `color_num' of `colors' + test_color , color("`color'") option("barcolors") + return local color "`color'" + + end + + ******************************************* + ******************************************* + ******* Grayscale Option ******* + ******* Colour Picker ******* + ******************************************* + ******************************************* + + cap program drop grayPicker + program define grayPicker , rclass + + args groupCount totalNumGroups + + if (`groupCount' == 1) return local color "black" + else if (`groupCount'==2) & (`totalNumGroups'<=3) return local color "gs14" + else { + local grayscale = round((`groupCount'-1)*(100/(`totalNumGroups'-1))) + return local color "`grayscale' `grayscale' `grayscale' `grayscale'" + } + + end + + ******************************************* + ******************************************* + ******* Test if valid ******* + ******* dummies ******* + ******************************************* + ******************************************* + + cap program drop testDums + program define testDums + + unab dumlist : `0' + + foreach dumvar of varlist `dumlist' { + + *Test: all values dummies (missing would have been excluded in regression and we keep if e(sample) + cap assert inlist(`dumvar',0,1) + if _rc { + noi display as error "{phang} The variable `dumvar' is not a dummy. Treatment variable needs to be a dummy (0 or 1) variable. {p_end}" + noi display "" + error 149 + } + } + + /*What we are testing for below: + - We count the number of dummies that each obervation has the value 1 for. + - The count numbers must either fit the case of diff-in-diff or the case of regression with one dummy for each treatment arms + + Regular regression with one dummy for each treatment arm + - Some observations don't have 1 for any dummy - omitted control observations + - No observation has the value 1 in more than one observation - can't be in more than one treatment group + - No treatment group can have no observation with value 1 for that dummy + + Diff-in-Diff + - Some observations don't have 1 for any dummy - omitted controls observations in time = 0 + - Some observation must have value 1 for only the treatment dummy - treatment observations in time = 0 + - Some observation must have value 1 for only the time dummy - control observations in time = 1 + - Some observation must have value 1 for in all three of time, treatment and interaction dummy - treatment observations in time = 1 + + */ + + *Count how many dummies is 1 for each observation + tempvar dum_count + egen `dum_count' = rowtotal(`dumlist') + + *Exactly one dummy is 1, meaning this observation is in one of the treatment arms + count if `dum_count' == 1 + local dum_count_1 `r(N)' + + *No dummies is 1, meaning this observation is control + count if `dum_count' == 0 + local dum_count_0 `r(N)' + + *Exactly 3 dummies are three. Only allowed in the exact case of diff-and-diff regressions + count if `dum_count' == 3 + local dum_count_3 `r(N)' + + *Exactly 2 or more than three is never correct. + count if `dum_count' == 2 | `dum_count' > 3 + local dum_count_2orgt3 `r(N)' + + *Test that there are at least some treatment observations + if `dum_count_0' == 0 noi di as error "{phang} There are no control observations. One category must be omitted and it should be the omitted category in the regression. The omitted category will be considerd the control group. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" + if `dum_count_0' == 0 error 480 + + *Test that there are at least some control observations (this error should be caught by dummies omitted in the regression) + if `dum_count_1' == 0 noi di as error "{phang} There are no treatment observations. None of the dummies have observations for which the dummy has the value 1. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" + if `dum_count_1' == 0 error 480 + + *Test if there are any observations that have two or more than three dummies that is 1 + if `dum_count_2orgt3' > 0 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" + if `dum_count_2orgt3' > 0 error 480 + + *After passing the previous two steps, test if there are cases that are only allowed in diff + if `dum_count_3' > 0 { + + *Diff-and-diff must have exactly 3 dummies + if `:list sizeof dumlist' != 3 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}" + if `:list sizeof dumlist' != 3 error 480 + + * Test if valid diff-diff + testDumsDD `dum_count' `dumlist' + } + + end + + cap program drop testDumsDD + program define testDumsDD + + local dum_count `1' + + **Test that for only two of three dummies there are observations + * that has only that dummy. I.e. the two that is not the + * interaction. If the interaction is 1, all three shluld be 1. + + *Count how many dummies the condition is above applies to + local counter 0 + + *Loop over all dummies + forvalues i = 2/4 { + + *Test the number + count if ``i'' == 1 & `dum_count' == 1 + if `r(N)' > 0 local ++counter + + } + *Count that exactly two dummies fullfilled the condition + if `counter' != 2 noi di as error "{phang} There is overlap in the treatment dummies. The dummies must be mutually exclusive meaning that no observation has the value 1 in more than one treatment dummy. The exception is when you use a diff-and-diff, but this dummies is not a valid diff and diff. See helpfile for more info. Disable this test by using option ignoredummytest.{p_end}"" + if `counter' != 2 error 480 + + end + + * Test inputs for label + cap prog drop sizename + prog def sizename, rclass + + args name + + capture findfile gsize-`name'.style + + if ( _rc == 601 ) { + + noi di "{phang} WARNING: Option mlabsize() was incorrectly specified. Only {help textsizestyle} values are accepted. Default size used.{p_end}" + return local LABEL_SIZE 0 + } + + end + + cap prog drop test_color + prog def test_color, rclass + + syntax, color(string) option(string) + + capture findfile color-`color'.style + if ( _rc == 601 ) { + noi di as error "{pstd} The color {inp:`color'} used in option {inp:`option'()} was incorrectly specified. Only colors listed in {help colorstyle} are accepted.{p_end}" + error 99 + exit + } + end + + + cap prog drop clockname + prog def clockname, rclass + + args name + + capture findfile clockdir-`name'.style + + if ( _rc == 601 ) { + + noi di "{phang} WARNING: Option mlabposition() was incorrectly specified. Only {help clockposstyle} values are accepted. Default position used.{p_end}" + return local LABEL_POS 0 + } + + end diff --git a/src/ado_files/iekdensity.ado b/src/ado/iekdensity.ado similarity index 99% rename from src/ado_files/iekdensity.ado rename to src/ado/iekdensity.ado index ffb863f9..bd8532fa 100644 --- a/src/ado_files/iekdensity.ado +++ b/src/ado/iekdensity.ado @@ -1,8 +1,13 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org - cap prog drop iekdensity +cap prog drop iekdensity prog define iekdensity +qui { + + // Set minimum version for this command + version 12.0 + syntax varname(numeric) [if] [in] [aw fw iw] , /// Specify outcome variable (only fweights, aweights, and iweights are allowed in original [kdensity] command) /// by(varname numeric) /// Specify treatment variable @@ -27,11 +32,6 @@ Prepare settings *******************************************************************************/ - qui { - - // Set minimum version for this command - version 12 - // Preserve current dataset preserve diff --git a/src/ado_files/iematch.ado b/src/ado/iematch.ado similarity index 99% rename from src/ado_files/iematch.ado rename to src/ado/iematch.ado index eb8d82d8..5a3cfaed 100644 --- a/src/ado_files/iematch.ado +++ b/src/ado/iematch.ado @@ -1,8 +1,13 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org cap program drop iematch program define iematch +qui { + + * Set version + version 12.0 + syntax [if] [in] , /// GRPdummy(varname) /// MATCHvar(varname) /// @@ -21,10 +26,7 @@ ***** - qui { - * Set version - version 12 ******************************** * diff --git a/src/ado_files/iesave.ado b/src/ado/iesave.ado similarity index 99% rename from src/ado_files/iesave.ado rename to src/ado/iesave.ado index 14e89a2c..e6355f8c 100644 --- a/src/ado_files/iesave.ado +++ b/src/ado/iesave.ado @@ -1,8 +1,11 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org capture program drop iesave program iesave , rclass +qui { + version 12.0 + syntax anything, /// /* Required options */ /// IDvars(varlist) /// @@ -41,13 +44,9 @@ capture program drop iesave * is standardized for this command local version_char "c(stata_version):`c(stata_version)' c(version):`c(version)' c(userversion):`c(userversion)'" - version 12 - /******************************************************************************* Test input *******************************************************************************/ -qui { - * Get target versions from ietoolkit command ietoolkit diff --git a/src/ado/ietoolkit.ado b/src/ado/ietoolkit.ado new file mode 100644 index 00000000..533a4e3b --- /dev/null +++ b/src/ado/ietoolkit.ado @@ -0,0 +1,46 @@ +*! version 7.3 20240404 - DIME Analytics - dimeanalytics@worldbank.org + +cap program drop ietoolkit + program define ietoolkit + +qui { + + version 12.0 + + * Do not manually edit these locals. They are updated with ad_publish in the adodown workflow + local version "7.3" + local versionDate "20240404" + local cmd "ietoolkit" + + syntax [anything] + + version 12 + + /********************** + Error messages + **********************/ + + * Make sure that no arguments were passed + if "`anything'" != "" { + noi di as error "This command does not take any arguments, write only {it:ietoolkit}" + error 198 + } + + /********************** + Output + **********************/ + + * Stata versions commands in this package allows when applicable + return local stata_target_versions "12 12.0 12.1 13 13.0 13.1 14 14.0 14.1 14.2 15 15.0 15.1 16.0 16.1 17.0 18.0" + return local dta_target_versions "12 13 14" + + * Prepare returned locals + return local versiondate "`versionDate'" + return scalar version = `version' + + * Display output + noi di "" + noi di _col(4) "This version of ietoolkit installed is version " _col(54)"`version'" + noi di _col(4) "This version of ietoolkit was released on " _col(54)"`versionDate'" + + end diff --git a/src/ado_files/iedorep.ado b/src/ado_files/iedorep.ado deleted file mode 100644 index b9a2fafd..00000000 --- a/src/ado_files/iedorep.ado +++ /dev/null @@ -1,452 +0,0 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org - -cap program drop iedorep - program define iedorep, rclass - - syntax anything , /// - [Recursive] /// - [alldata] [allsort] [allseed] /// Verbose reporting of non-errors - [debug] [qui] // Programming option to view exact temp do-file - -/***************************************************************************** -Options -*****************************************************************************/ - - // Optionally request all data changes to be flagged - if "`alldata'" != "" { - local alldata1 = `" ("Changed") ("") ("") ("") ("") ("") ("") "' - local alldata2 = `" ("") ("ERROR! ") ("") ("") ("") ("") ("") "' - } - else { - local alldata1 = `" ("") ("") ("") ("") ("") ("") ("") "' - local alldata2 = `" ("Changed") ("ERROR! ") ("") ("") ("") ("") ("") "' - } - - // Optionally request all sorts to be flagged - if "`allsort'" != "" { - local allsort1 = `" ("") ("") ("") ("") ("Sorted") ("") ("") "' - local allsort2 = `" ("") ("") ("") ("") ("") ("ERROR! ") ("") "' - } - else { - local allsort1 = `" ("") ("") ("") ("") ("") ("") ("") "' - local allsort2 = `" ("") ("") ("") ("") ("Sorted") ("ERROR! ") ("") "' - } - - // Optionally request all seeds to be flagged - if "`allseed'" != "" { - local allseed1 = `" ("") ("") ("Used") ("") ("") ("") ("") "' - local allseed2 = `" ("") ("") ("") ("ERROR! ") ("") ("") ("") "' - } - else { - local allseed1 = `" ("") ("") ("") ("") ("") ("") ("") "' - local allseed2 = `" ("") ("") ("Used") ("ERROR! ") ("") ("") ("") "' - } - -/***************************************************************************** -One-time prep -*****************************************************************************/ -preserve - file close _all - postutil clear - tempfile newfile1 - tempfile newfile2 - local comment = 0 - local loopstate = "" - local loop = 0 - local logic = 0 - local linenum = 1 - local clear - -// Open the file to be checked - di as err " " - di as err `"Processing: `anything'"' - file open original using `anything' , read - file read original line // Need initial read - local linenum_real = 1 - -// Open the files to be written - qui file open edited using `newfile1' , write replace - qui file open checkr using `newfile2' , write replace - -// Initialize locals in new file - file write edited /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap postutil clear " _n /// (see [P] postfile) - " cap _return drop _all " _n /// (see [P] _return) - " cap discard " _n /// (see [P] discard) - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap mata: mata clear " _n /// (see [M-3] mata clear) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n - file write edited "tempname theSORT theRNG allRNGS whichRNG theDATA" _n - file write edited "tempfile posty allDATA" _n "postfile posty Line " /// - "str15(Data Err_1 Seed Err_2 Sort Err_3) str2000(Path) using \`posty' , replace" _n - - file write edited `"local \`theRNG' = "\`c(rngstate)'" "' _n - file write checkr `"local \`theRNG' = "\`c(rngstate)'" "' _n - - file write edited `"local \`theSORT' = "\`c(sortrngstate)'" "' _n - file write checkr `"local \`theSORT' = "\`c(sortrngstate)'" "' _n - - file write edited "datasignature" _n `"local \`theDATA' = "\`r(datasignature)'" "' _n - file write checkr "datasignature" _n `"local \`theDATA' = "\`r(datasignature)'" "' _n - -/***************************************************************************** -Big loop through target do-file contents -*****************************************************************************/ -while r(eof)==0 { - - /***************************************************************************** - Setup and state checks - *****************************************************************************/ - - // Increment line - local linenum = `linenum' + 1 - - // Reproduce file contents - // Catch any [clear all] or [ieboilstart] commands - if strpos(`"`macval(line)'"',"clear ") /// - & ( strpos(`"`macval(line)'"',"all") /// - | strpos(`"`macval(line)'"',"*") ) { - di as err "This file contained [clear all] or [clear *]. That has been replaced. Check functionality." - file write edited /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap _return drop _all " _n /// (see [P] _return) - " cap mata: mata clear " _n /// (see [M-3] mata clear) - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n /// - " cap estimates clear " _n - file write checkr /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap _return drop _all " _n /// (see [P] _return) - " cap mata: mata clear " _n /// (see [M-3] mata clear) - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n /// - " cap estimates clear " _n - } - else if strpos(`"`macval(line)'"',"ieboilstart") { - di as err "This file contained [ieboilstart]. That has been modified. Check functionality." - file write edited /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap _return drop _all " _n /// (see [P] _return) - " cap mata: mata clear " _n /// (see [M-3] mata clear) - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n /// - " cap estimates clear " _n - file write checkr /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap _return drop _all " _n /// (see [P] _return) - " cap mata: mata clear " _n /// (see [M-3] mata clear) - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n /// - " cap estimates clear " _n - file write edited `"`macval(line)' noclear "' _n - file write checkr `"`macval(line)' noclear "' _n - } - else { - file write edited `"`macval(line)'"' _n - file write checkr `"`macval(line)'"' _n - } - - // Catch comments - if strpos(`"`macval(line)'"',"/*") local comment = 1 - if strpos(`"`macval(line)'"',"*/") local comment = 0 - - // Monitor loop state and do not evaluate within loops - - // Set flag whenever looping word or logic word - if strpos(`"`macval(line)'"',"if ") local logic = 1 - if strpos(`"`macval(line)'"',"else ") local logic = 1 - if strpos(`"`macval(line)'"',"forv") local loop = 1 - if strpos(`"`macval(line)'"',"foreach") local loop = 1 - if strpos(`"`macval(line)'"',"while") local loop = 1 - - // Track state when logic entered (unless ALSO loop) - if `logic' == 1 & `loop' == 0 & strpos(`"`macval(line)'"',"{") /// - local loopstate "logi `loopstate'" - if `logic' == 1 & strpos(`"`macval(line)'"',"{") /// - local logic = 0 - - // Track state when loop entered - if `loop' == 1 & strpos(`"`macval(line)'"',"{") { - local loopstate "loop `loopstate'" - local loop = 0 - } - - // Track state whenever logic or loop exited - if strpos(`"`macval(line)'"',"}") /// - local loopstate = substr("`loopstate'",6,.) - - /***************************************************************************** - Implement logic checks in file copy - *****************************************************************************/ - if (`comment' == 0) & !strpos("`loopstate'","loop") { - // Add checkers if line end - if !strpos(`"`macval(line)'"',"///") { - local logic = 0 // If we are here with logic flagged, it was a subset - - // Catch any [do] or [run] commands - if strpos(`"`macval(line)'"',"do ") { - local theRECURSION = substr(`"`macval(line)'"',strpos(`"`macval(line)'"',"do ")+3,.) - file write edited `" post posty (`linenum_real') ("") ("") ("") ("") ("") ("") (`"`theRECURSION'"') "' _n - } - else if strpos(`"`macval(line)'"',"ru ") { - local theRECURSION = substr(`"`macval(line)'"',strpos(`"`macval(line)'"',"ru ")+3,.) - file write edited `" post posty (`linenum_real') ("") ("") ("") ("") ("") ("") (`"`theRECURSION'"') "' _n - } - if strpos(`"`macval(line)'"',"run ") { - local theRECURSION = substr(`"`macval(line)'"',strpos(`"`macval(line)'"',"run ")+4,.) - file write edited `" post posty (`linenum_real') ("") ("") ("") ("") ("") ("") (`"`theRECURSION'"') "' _n - } - - // Flag changes to RNG state - file write edited /// - `"if ("\`c(rngstate)'" != "\`\`theRNG''") {"' _n /// - `"post posty (`linenum_real') `allseed1' "' _n /// - `"local \`theRNG' = "\`c(rngstate)'" "' _n /// - `"local \`allRNGS' = "\`\`allRNGS'' \`c(rngstate)'" "' _n /// - `"}"'_n - - // Error changes to RNG state - file write checkr /// - `"if ("\`c(rngstate)'" != "\`\`theRNG''") {"' _n /// - `"local \`whichRNG' = \`\`whichRNG'' + 1"' _n /// - `"local \`theRNG' = "\`c(rngstate)'" "' _n /// - `"if ("\`c(rngstate)'" != "\`: word \`\`whichRNG'' of \`\`allRNGS'''") {"' _n /// - `"post posty (`linenum_real') `allseed2' "' _n /// - `"}"'_n /// - `"}"'_n - - // Flag changes to Sort RNG state - file write edited /// - `"if ("\`c(sortrngstate)'" != "\`\`theSORT''") {"' _n /// - `"post posty (`linenum_real') `allsort1' "' _n /// - `"local \`theSORT' = "\`c(sortrngstate)'" "' _n /// - `"tempfile `linenum_real'_x"' _n /// - `"save \``linenum_real'_x' , emptyok"' _n /// - `"local theLOCALS "\`theLOCALS' `linenum_real'_x" "' _n /// - `"}"'_n - - // Flag Errors to Sort RNG state - file write checkr /// - `"if ("\`c(sortrngstate)'" != "\`\`theSORT''") {"' _n /// - `"local \`theSORT' = "\`c(sortrngstate)'" "' _n /// - `"cap cf _all using \``linenum_real'_x'"' _n /// - `"if _rc != 0 {"'_n /// - `"post posty (`linenum_real') `allsort2' "' _n /// - `"}"'_n /// - `"}"'_n - - // Flag changes to DATA state - file write edited /// - "datasignature" _n /// - `"if ("\`r(datasignature)'" != "\`\`theDATA''") {"' _n /// - `"post posty (`linenum_real') `alldata1' "' _n /// - `"local \`theDATA' = "\`r(datasignature)'" "' _n /// - `"local theLOCALS "\`theLOCALS' `linenum_real'" "' _n /// - `"local `linenum_real' = "\`r(datasignature)'" "' _n /// - `"}"'_n - - // Error changes to DATA state - file write checkr /// - "datasignature" _n /// - `"if ("\`r(datasignature)'" != "\`\`theDATA''") {"' _n /// - `"local \`theDATA' = "\`r(datasignature)'" "' _n /// - `"if ("\`r(datasignature)'" != "\``linenum_real''") {"'_n /// - `"post posty (`linenum_real') `alldata2' "' _n /// - `"}"'_n /// - `"}"'_n - - // Advance line number - local linenum_real = `linenum' - } - - // Error if delimiter - if strpos(`"`macval(line)'"',"#d") { - di as err " Note: The delimiter may have been changed in this file (#d)." - di as err " " - } - - } // Comments and loops logic - - // Advance through file - file read original line - -} - -/***************************************************************************** -Append the checking dofile to the edited dofile -Betwen dofiles, use [di] to advance seed and use [clear] for data -Then remove all macros other than the ones we are using -*****************************************************************************/ -file close checkr -file open checkr using `"`newfile2'"' , read - file read checkr line // Need initial read - file write edited _n /// - "// CLEANUP LOCALS BETWEEN FILES -------------------------------------------" _n /// - "local theLOCALS posty theSORT theRNG allRNGS whichRNG allDATA theDATA theLOCALS " /// - "\`posty' \`theSORT' \`theRNG' \`allRNGS' \`whichRNG' \`allDATA' \`theDATA' \`theLOCALS'" _n /// - `"mata : st_local("all_locals", invtokens(st_dir("local", "macro", "*")'))"' _n /// - "local toDROP : list all_locals - theLOCALS" _n /// - "cap macro drop \`toDROP' " _n /// - "foreach macro in \`toDROP' {" _n /// - `" mata : st_local("\`macro'","") "' _n /// - "}" _n /// - "// ADVANCE RNG AND CLEAR DATA -------------------------------------------" _n /// - "qui di \`=rnormal()'" _n /// - " cap drop _all " _n /// (see [D] drop) - " cap frames reset " _n /// (see [D] frames reset) - " cap collect clear " _n /// (see [TABLES] collect clear) - " cap label drop _all " _n /// (see [D] label) - " cap matrix drop _all " _n /// (see [P] matrix utility) - " cap scalar drop _all " _n /// (see [P] scalar) - " cap constraint drop _all " _n /// (see [R] constraint) - " cap cluster drop _all " _n /// (see [MV] cluster utility) - " cap file close _all " _n /// (see [P] file) - " cap _return drop _all " _n /// (see [P] _return) - " cap mata: mata clear " _n /// (see [M-3] mata clear) -/// " cap discard " _n /// (see [P] discard) TODO: Figure out why [discard] kills postfile - " cap timer clear " _n /// (see [P] timer) - " cap putdocx clear " _n /// (see [RPT] putdocx begin) - " cap putpdf clear " _n /// (see [RPT] putpdf begin) - " cap python clear " _n /// (see [P] PyStata integration) - " cap java clear " _n /// - "// SECOND RUN STARTS HERE ------------------------------------------------" _n _n - - while r(eof)==0 { - file write edited `"`macval(line)'"' _n - file read checkr line - } - file write edited `"postclose posty"' _n - file write edited `"use \`posty' , clear"' _n - file write edited `"collapse (firstnm) Data Err_1 Seed Err_2 Sort Err_3 Path , by(Line)"' _n - file write edited `"compress"' _n - -/***************************************************************************** -Cleanup and then run the combined temp dofile -*****************************************************************************/ - - file close _all - di as err `"Entering `anything' run...."' - clear - if `"`debug'"' != "" { - local debugpath = subinstr(`"`anything'"',".do","_temp.do",.) - copy `newfile1' `debugpath' , replace - `qui' do `newfile1' - } - else qui do `newfile1' - di as err `"Done with `anything'!"' - -/***************************************************************************** -Output flags and errors -*****************************************************************************/ - - qui replace Data = Err_1 + Data - qui replace Seed = Err_2 + Seed - qui replace Sort = Err_3 + Sort - qui gen Subfile = "Yes" if Path != "" - qui keep if !(Data == "" & Seed == "" & Sort == "") - li Line Data Seed Sort Subfile, noobs divider - -/***************************************************************************** -Pseudo-recursion -*****************************************************************************/ - - if "`recursive'" != "" { - qui keep if !(Err_1 == "" & Err_2 == "" & Err_3 == "") & (Path != "") - if `c(N)' == 0 { - di as err " " - di as err "No errors detected in sub do-files; recursion completed." - di as err " " - } - else { - di as err " " - di as err "Errors detected in the following sub do-files; starting recursion." - li Line Path , noobs divider - qui duplicates drop Path, force - sort Line - forvalues i = 1/`c(N)' { - local file = Path[`i'] - iedorep `file' , `debug' `qui' `recursive' `alldata' `allsort' `allseed' - if `r(errors)' == 0 { - di as err "!!------ WARNING ------!!" - di as err "An error was expected in this sub do-file but none was found." - di as err " This can occur when sub do-files are not independent." - di as err " Check that this sub do-file does not depend on the calling file." - di as err " This includes both the data state and global macros;" - di as err " the data is reset on each run, but macros are not." - di as err " " - error 459 - } - } - } - } - -/***************************************************************************** -Return -*****************************************************************************/ - - qui count if !(Err_1 == "" & Err_2 == "" & Err_3 == "") - return scalar errors = `r(N)' - -/***************************************************************************** -END -*****************************************************************************/ - -end - -// diff --git a/src/ado_files/ietoolkit.ado b/src/ado_files/ietoolkit.ado deleted file mode 100644 index 37222707..00000000 --- a/src/ado_files/ietoolkit.ado +++ /dev/null @@ -1,41 +0,0 @@ -*! version 7.3 01FEB2024 DIME Analytics dimeanalytics@worldbank.org - -capture program drop ietoolkit -program ietoolkit, rclass - - * UPDATE THESE LOCALS FOR EACH NEW VERSION PUBLISHED - local version "7.3" - local versionDate "01FEB2024" - - syntax [anything] - - version 12 - - /********************** - Error messages - **********************/ - - * Make sure that no arguments were passed - if "`anything'" != "" { - noi di as error "This command does not take any arguments, write only {it:ietoolkit}" - error 198 - } - - /********************** - Output - **********************/ - - * Stata versions commands in this package allows when applicable - return local stata_target_versions "12 12.0 12.1 13 13.0 13.1 14 14.0 14.1 14.2 15 15.0 15.1 16.0 16.1 17.0 18.0" - return local dta_target_versions "12 13 14" - - * Prepare returned locals - return local versiondate "`versionDate'" - return scalar version = `version' - - * Display output - noi di "" - noi di _col(4) "This version of ietoolkit installed is version " _col(54)"`version'" - noi di _col(4) "This version of ietoolkit was released on " _col(54)"`versionDate'" - -end diff --git a/src/dev/README.md b/src/dev/README.md new file mode 100644 index 00000000..2ac562e8 --- /dev/null +++ b/src/dev/README.md @@ -0,0 +1,6 @@ +# Dev tools + +This folder contains files that are relevant for the package, but not directly related to code development. +This includes SSC zip-file outputs from `ad_publish`, `adodown` run utils, support files for web documentation (logo, css etc.). + +This folder is a great location for the team to create sub-folders for any content that does not fit into any other folder in the `adodown` structure. diff --git a/src/dev/run-adodown-util.do b/src/dev/run-adodown-util.do new file mode 100644 index 00000000..6e5857f4 --- /dev/null +++ b/src/dev/run-adodown-util.do @@ -0,0 +1,6 @@ + + reproot , project(ietoolkit) roots(clone) prefix(ietk_) + + ad_sthlp , adfolder("${ietk_clone}") + + ad_publish, adf("${ietk_clone}") ssczip diff --git a/src/help_files/iebaltab.sthlp b/src/help_files/iebaltab.sthlp deleted file mode 100644 index a82b5018..00000000 --- a/src/help_files/iebaltab.sthlp +++ /dev/null @@ -1,740 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iebaltab} -{hline} - -{title:Title} - -{phang2}{cmdab:iebaltab} {hline 2} produces balance tables with multiple groups or treatment arms - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iebaltab":DIME Wiki}. - -{title:Syntax} - -{phang2} -{cmd:iebaltab} {it:balancevarlist} [{help if:if}] [{help in:in}] [{help weight}] -, {opt group:var(varname)} [ -{it:{help iebaltab##columnrowoptions:columnrow_options}} -{it:{help iebaltab##estimateoptions:estimation_options}} -{it:{help iebaltab##statoptions:stat_display_options}} -{it:{help iebaltab##labeloptions:label_note_options}} -{it:{help iebaltab##exportoptions:export_options}} -{it:{help iebaltab##latexoptions:latex_options}} -] - -{phang2}where {it:balancevarlist} is one or several continuous or binary variables (from here on called balance variables) for which the command -will test for differences across the categories in {opt groupvar(varname)}. - -{marker opts}{...} -{synoptset 22}{...} -{synopthdr:Options} -{synoptline} -{pstd}{it: {ul:{hi:Required options:}}}{p_end} - -{synopt :{opth group:var(varname)}}Variable indicating the groups (ex. treatment arms) to test across{p_end} - -{pstd}{it: {ul:{hi:Optional options}}}{p_end} - -{marker columnrowoptions}{...} -{synopthdr:Column and row options} -{synopt :{opt co:ntrol(groupcode)}}Indicate a single group that all other groups are tested against. Default is all groups are tested against each other{p_end} -{synopt :{opt or:der(groupcodelist)}}Manually set the order the groups appear in the table. Default is ascending. See details on {it:groupcodelist} below{p_end} -{synopt :{opt tot:al}}Include descriptive stats on all observations included in the table{p_end} -{synopt :{opt onerow}}Write number of observations (and number of clusters if applicable) in one row at the bottom of the table{p_end} - -{marker estimateoptions}{...} -{synopthdr:Estimation options} -{synopt :{opth vce:(vce_option:vce_types)}}Options for estimating variance{p_end} -{synopt :{opth fix:edeffect(varname)}}Include fixed effects in the pair-wise regressions (and for F-tests if applicable){p_end} -{synopt :{opth cov:ariates(varlist)}}Include covariates (control variables) in the pair-wise regressions (and for F-tests if applicable){p_end} -{synopt :{opt ft:est}}Include a row with the F-test for joint significance across all balance variables for each test pair{p_end} -{synopt :{opt feqt:est}}Include a column with the F-test for joint significance across all groups for each variable{p_end} - -{marker statoptions}{...} -{synopthdr:Stat display options} -{synopt :{cmd:stats(}{it:{help iebaltab##statstr:stats_string}}{cmd:)}}Specify which statistics to display in the tables. See options for {it:stats_string} below{p_end} -{synopt :{opth star:levels(numlist)}}Manually set the three significance levels used for significance stars{p_end} -{synopt :{opt nostar:s}}Do not add any stars to the table{p_end} -{synopt :{opth form:at(format:%fmt)}}Apply Stata formats to the non-integer values outputted in the table{p_end} - -{marker labeloptions}{...} -{synopthdr:Label/notes options} -{synopt :{opt groupc:odes}}Use the values in the {opt groupvar()} variable as column titles. Default is to use value labels if any{p_end} -{synopt :{opt groupl:abels(codetitles)}}Manually set the group column titles. See details on {it:codetitles} below{p_end} -{synopt :{opt totall:abel(string)}}Manually set the title of the total column{p_end} -{synopt :{opt rowv:arlabels}}Use the variable labels instead of variable name as row titles{p_end} -{synopt :{opt rowl:abels(nametitles)}}Manually set the row titles. See details on {it:nametitles} below{p_end} -{synopt :{opt nonote}}Suppress the default not at the bottom of the table{p_end} -{synopt :{opt addnote(string)}}Add a manual note to the bottom of the table{p_end} - -{marker exportoptions}{...} -{synopthdr:Export options} -{synopt :{opt browse}}View table in the data browser{p_end} -{synopt :{opth savex:lsx(filename)}}Save table to Excel file on disk{p_end} -{synopt :{opth savec:sv(filename)}}Save table to csv-file on disk{p_end} -{synopt :{opth savet:ex(filename)}}Save table to LaTeX file on disk{p_end} -{synopt :{opth texnotefile(filename)}}Save table note in a separate LaTeX file on disk{p_end} -{synopt :{opt replace}}Replace file on disk if the file already exists{p_end} - -{marker latexoptions}{...} -{synopthdr:LaTeX options} -{synopt :{opth texn:otewidth(numlist)}}Manually adjust width of note{p_end} -{synopt :{opt texc:aption(string)}}Specify LaTeX table caption{p_end} -{synopt :{opt texl:abel(string)}}Specify LaTeX label{p_end} -{synopt :{opt texdoc:ument}}Create a stand-alone LaTeX document{p_end} -{synopt :{opt texcolwidth(string)}}Limit width of the first column on LaTeX output{p_end} - -{synoptline} - -{title:Description} - -{pstd}{cmd:iebaltab} is a command that generates balance tables (difference-in-means tables). -The command tests for statistically significant difference in the balance variables between -the categories defined in the {opt groupvar(varname)}. The command can either test one control group -against all other groups, using the {opt control(groupcode)} option, -or test all groups against each other (the default). The command also allows for -fixed effects, covariates and different types of variance estimators.{p_end} - -{pstd}The balance variables are expected to be continuous or binary variables. -Categorical variables (for example 1=single, 2=married, 3=divorced) will not -generate an error but will be treated like a continuous variable -which is most likely statistically invalid. -Consider converting each category to binary variables.{p_end} - -{pstd}The command can also add a note to the bottom of the table. -The default note is not meant to be included in the final publication. -It includes technical information about how the command was specified. -This is helpful in the early stage of research where several specifications -are often explored, but should be replace with a more human readable note -in the final version.{p_end} - -{pstd}See the {help iebaltab##est_defs:estimation/statistics definitions} -section below for a detailed documentation of what statistics this command -calculates and how they are calculated.{p_end} - -{title:Options (detailed descriptions)} - -{pstd}{it:{ul:{hi:Required options:}}}{p_end} - -{phang}{opth group:var(varname)} specifies the variable indicating groups -(for example treatment arms) across which the command will -test for difference in mean of the balance variable. -The group variable can only be one variable and -it must be numeric and may only hold integers. -See {help egen:egen group} for help on creating a single variable where -each integer represents a category from string variables and/or multiple variables. -Observations with missing values in this variable will be excluded when running this command. - -{pstd}{it:{ul:{hi:Optional options}}}{p_end} - -{pstd}{it:Column and row options:}{p_end} - -{phang}{opt co:ntrol(groupcode)} specifies one group that is the control group -that all other groups are tested against for difference in means and -where {it:groupcode} is an integer used in {opt groupvar()}. -The default is that all groups are tested against each other. -The control group will be listed first (leftmost) in the table -unless another order is specified in {opt order()}. -When using {opt control()} the order of the groups in the pair is (non-control)-(control) -so that a positive statistic (in for example {it:diff} or {it:beta}) indicates that -the mean for the non-control is larger than for the control.{p_end} - -{phang}{opt or:der(groupcodelist)} manually sets the column order of the groups in the table. {it:groupcodelist} may -be any or all of the values in the group variable specified in {opt groupvar()}. -The default order if this option is omitted is ascending order of the values in the group variable. -If any values in {opt groupvar()} are omitted when using this option, -they will be sorted in ascending order after the values included.{p_end} - -{phang}{opt tot:al} includes a column with descriptive statistics on the full sample. -This column still exclude observations with missing values in {opt groupvar()}.{p_end} - -{phang}{opt onerow} displays the number of observations in an additional row -at the bottom of the table. If the number of observations are not identical -across all rows within a column, then this option throws an error. -This also applies to number of clusters. -If not specified, the number of observations (and clusters) per variable per group -is displayed on the same row in an additional column -next to the descriptive statistics.{p_end} - -{pstd}{it:Estimation options:}{p_end} - -{phang}{opth vce:(vce_option:vce_types)} sets the type of variance estimator -to be used in all regressions for this command. -See {help vce_option:vce_types} for more details. -However, the types allowed in this command are only -{hi:robust}, {hi:cluster} {it:clustervar} or {hi:bootstrap}. -See the {help iebaltab##est_defs:estimation definition} section -for exact definitions on how these vce types are included in the regressions.{p_end} - -{phang}{opth fix:edeffect(varname)} specifies a single variable to be used as fixed effects in all regressions -part from descriptive stats regressions. -The variable specified must be a numeric variable. -If more than one variable is needed as fixed effects, and it is not desirable to combine multiple variables into one -(using for example {help egen:egen group}), -then they can be included using the {opt i.} notation in the {opt covariates()} option. -See the {help iebaltab##est_defs:estimation definition} section for exact definitions on how the fixed effects are included in the regressions.{p_end} - -{phang}{opth cov:ariates(varlist)} includes the variables specified in the regressions for t-tests (and for -F-tests if applicable) as covariate variables (control variables). See the description section above for details on how the covariates -are included in the estimation regressions. The covariate variables must be numeric variables. -See the {help iebaltab##est_defs:estimation definition} section for exact definitions on how the covariates are included in the regressions.{p_end} - -{phang}{opt ft:est} adds a single row at the bottom fo the the table with -one F-test for each test pair, testing for joint significance across all balance variables. -See the {help iebaltab##est_defs:estimation definition} section for exact definitions on how these tests are estimated.{p_end} - -{phang}{opt feqt:est} adds a single column in the table with an F-test for each balance variable, -testing for joint significance across all groups in {opt groupvar()}. -See the {help iebaltab##est_defs:estimation definition} section for exact definitions on how these tests are estimated.{p_end} - -{pstd}{it:Statistics display options:}{p_end} - -{marker statstr}{...} -{phang}{cmd:stats(}{it:{help iebaltab##statstr:stats_string}}{cmd:)} -indicates which statistics to be displayed in the table. -The {it:stats_string} is expected to be on this format (where at least one of the sub-arguements -{opt desc}, {opt pair}, {opt f} and {opt feq} are required):{p_end} - -{pmore}{cmd: stats(desc({it:desc_stats}) pair({it:pair_stats}) f({it:f_stats}) feq({it:feq_stats))}}{p_end} - -{pmore}The table below lists the valid values for -{it:desc_stats}, {it:pair_stats}, {it:f_stats} and {it:feq_stats}. -See the {help iebaltab##est_defs:estimation definition} section -for exact definitions of these values and how they are estimated/calculated.{p_end} - -{p2colset 9 21 23 0}{...} -{p2col:{it:desc_stats:}}{cmd:se var sd}{p_end} -{p2col:{it:pair_stats:}}{cmd:diff beta t p nrmd nrmb se sd none}{p_end} -{p2col:{it:f_stats:}}{cmd:f p}{p_end} -{p2col:{it:feq_stats:}}{cmd:f p}{p_end} - -{phang}{opth star:levels(numlist)} manually sets the -three significance levels used for significance stars. -Expected input is decimals (between the value 0 and 1) in descending order. -The default is (.1 .05 .01) where .1 corresponds -to one star, .05 to two stars and .01 to three stars.{p_end} - -{phang}{opt nostar:s} makes the command not add any stars to the table -regardless of significance levels.{p_end} - -{phang}{opth form:at(format:%fmt)} applies the Stata formats specified to all values outputted -in the table apart from values that always are integers. -Example of values that always are integers is number of observations. -For these integer values the format is always %9.0f. -The default for all other values when this option is not used is %9.3f.{p_end} - -{pstd}{it:Label and notes options:}{p_end} - -{phang}{opt groupc:odes} makes the integer values used for the group codes in -{opt groupvar()} the group column titles. -The default is to use the value labels used in {opt groupvar()}. -If no value labels are used for the variable in {opt groupvar()}, -then this option does not make a difference.{p_end} - -{phang}{opt groupl:abels(codetitles)} manually sets the group column titles. -{it:codetitles} is a string on the following format:{p_end} - -{pmore}{opt grouplabels("code1 title1 @ code2 title2 @ code3 title3")}{p_end} - -{pmore}Where code1, code2 etc. must correspond to the integer values used for each -group used in the variable {opt groupvar()}, -and title1, title2 etc. are the titles to be used for the corresponding integer value. -The character "@" may not be used in any title. -Codes omitted from this option will be assigned a column title -as if this option was not used. -This option takes precedence over {cmd:groupcodes} when used together, -meaning that group codes are only used for groups -that are not included in the {it:codetitlestring}. -The title can consist of several words. -Everything that follows the code until the end of a string -or a "@" will be included in the title.{p_end} - -{phang}{opt totall:abel(string)} manually sets the column title for the total column.{p_end} - -{phang}{opt rowv:arlabels} use the variable labels instead of variable name as row titles. -The default is to use the variable name. For variables with no variable label defined, -the variable name is used as row label even when this option is specified.{p_end} - -{phang}{opt rowl:abels(nametitles)} manually sets the row titles for each -of the balance variables in the table. -{it:nametitles} is a string in the following format:{p_end} - -{pmore}{opt rowlabels("name1 title1 @ name2 title2 @ name3 title3")}{p_end} - -{pmore}Where name1, name2 etc. are variable names used as balance variables, -and title1, title2 etc. are the titles to be used for the corresponding variable. -The character "@" may not be used in any of the titles. -Variables omitted from this option are assigned a row title as if this option was not used. -This option takes precedence over {cmd:rowvarlabels} when used together, -meaning that default labels are only used for variables -that are not included in the {it:nametitlestring}. -The title can consist of several words. -Everything that follows the variable name until -the end of a string or a "@" will be included in the title.{p_end} - -{phang}{opt nonote} suppresses the default note that the command adds to -the bottom of the table with technical information -on how the command was specified. -This note is great during explorative analysis as it documents how -{opt iebaltab} was specified to generate exactly that table. -Eventually however, this note should probably be replaced with -a note more suitable for publication.{p_end} - -{phang}{opt addnote(string)} adds the string provided in this option -to the note at the bottom of table. -If {opt nonote} is not used, then this manually provided note -is added to the end of the default note. - -{pstd}{it:Export options:}{p_end} - -{phang}{opt browse} replaces the data in memory with the table -so it can be viewed using the command {h browse} instead of saving it to disk. -This is only meant to be used during explorative analysis -when figuring out how to specify the command. -Note that this overwrites data in memory.{p_end} - -{phang}{opth savex:lsx(filename)} exports the table to an Excel (.xsl/.xlsx) file and saves it on disk.{p_end} - -{phang}{opth savec:sv(filename)} exports the table to a comma separated (.csv) file and saves it on disk.{p_end} - -{phang}{opth savet:ex(filename)} exports the table to a LaTeX (.tex) file and saves it on disk.{p_end} - -{phang}{opth texnotefile(filename)} exports the table note in a separate LaTeX file on disk. -When this option is used, no note is included in the {opt savetex()} file. -This allows importing the table using the {it:threeparttable} LaTeX package which -is an easy way to make sure the note always has the same width as the table. -See example in the example section below.{p_end} - -{phang}{opt replace} allows for the file in {opt savexlsx()}, {opt savexcsv()}, -{opt savetex()} or {opt texnotefile()} -to be overwritten if the file already exist on disk.{p_end} - -{pstd}{it:LaTeX options:}{p_end} - -{phang}{opth texn:otewidth(numlist)} manually adjusts the width of the note -to fit the size of the table. -The note width is a multiple of text width. -If not specified, default is one, which makes the table width equal to text width. -However, when the table is resized when rendered in LaTeX -this is not always the same as the table width. -Consider also using {opt texnotefile()} and the LaTeX package {it:threeparttable}.{p_end} - -{phang}{opt texdoc:ument} creates a stand-alone LaTeX document ready to be compiled. -The default is that {opt savetex()} creates a fragmented LaTeX file -consisting only of a tabular environment. -This fragment is then meant to be imported to a main LaTeX file -that holds text and may import other tables.{p_end} - -{phang}{opt texc:aption(string)} writes the table's caption in LaTeX file. -Can only be used with option {opt texdocument}.{p_end} - -{phang}{opt texl:abel(string)} specifies table's label, -used for meta-reference across LaTeX file. -Can only be used with option {opt texdocument}.{p_end} - -{phang}{cmd:texcolwidth(}{it:string}{cmd:)} limits the width of table's first column -so that a line break is added when a variable's name or label is too long. -{it:string} must consist of a numeric value with one of the following units: -"cm", "mm", "pt", "in", "ex" or "em". -For more information on these units, -{browse "https://en.wikibooks.org/wiki/LaTeX/Lengths":check LaTeX lengths manual}.{p_end} - -{marker est_defs}{...} -{title:Estimation/statistics definitions} - -{pstd}This section details the regressions that are used to estimate -the statistics displayed in the balance tables generated by this command. -For each test there is a {it:basic form} example to highlight the core of the test, -and an {it:all options} example that shows exactly how all options are applied. -Here is a glossary for the terms used in this section:{p_end} - -{p2colset 5 23 23 0}{...} -{p2col:{it:balance variable}}The variables listed as {it:balancevarlist}{p_end} -{p2col:{it:groupvar}}The variable specified in {opt groupvar(varname)}{p_end} -{p2col:{it:groupcode}}Each value in {it:groupvar}{p_end} -{p2col:{it:test pair}}Combination of {it:group codes} to be used in pair wise tests{p_end} -{p2col:{it:tp_dummy}}A dummy variable where the first {it:group code} in a {it:test pair} -has the value 1 and the second {it:group code} has the value 0, -and all other observations has missing values{p_end} - -{pstd}{ul:{it:Group descriptive statistics}}{break} -Descriptive statistics for all groups are always displayed in the table. -If option {opt total} is used then these statistics are also calculated on the full sample. -For each balance variable and for each value group code, -the descriptive statistics is calculated using the following code:{p_end} - -{pstd}{it:basic form:} -{break}{input:reg balancevar if groupvar = groupcode}{p_end} - -{pstd}{it:all options:} -{break}{input:reg balancevar if groupvar = groupcode weights, vce(vce_option)}{p_end} - -{pstd}The table below shows the stats estimated/calculated based on this regression. -A star (*) in the {it:Stat} column indicate that is the optional statistics displayed by default -if the {inp:stats()} option is not used. -The {it:Display option} column shows what sub-option to use in {inp:stats()} to display this statistic. -The {it:Mat col} column shows what the column name in the result matrix for the column that stores this stat. -{it:gc} stands for {it:groupcode}, see definition above. -If the option {inp:total} is used, -then {it:gc} will also include {it:t} for stats on the full sample. -See more about the result matrices in the {it:Result matrices} section below. -The last column shows how the command obtains the stat in the Stata code.{p_end} - -{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 33}{c TRC} -{c |} Stat {col 11}{c |} Display option {col 31}{c |} Mat col {col 37}{c |} Estimation/calculation {col 75}{c |} -{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 33}{c RT} -{c |} # obs {col 11}{c |} Always displayed {col 31}{c |} n_{it:gc} {col 41}{c |} {cmd:e(N)} after {cmd:reg} {col 75}{c |} -{c |} cluster {col 11}{c |} Displayed if used {col 31}{c |} cl_{it:gc} {col 41}{c |} {cmd:e(N_clust)} after {cmd:reg} {col 75}{c |} -{c |} mean {col 11}{c |} Always displayed {col 31}{c |} mean_{it:gc} {col 41}{c |} {cmd:_b[cons]} after {cmd:reg} {col 75}{c |} -{c |} se * {col 11}{c |} {inp:stats(desc(se))} {col 31}{c |} se_{it:gc} {col 41}{c |} {cmd:_se[cons]} after {cmd:reg} {col 75}{c |} -{c |} var {col 11}{c |} {inp:stats(desc(var))} {col 31}{c |} var_{it:gc} {col 41}{c |} {cmd:e(rss)/e(df_r)} after {cmd:reg} {col 75}{c |} -{c |} sd {col 11}{c |} {inp:stats(desc(sd))} {col 31}{c |} sd_{it:gc} {col 41}{c |} {cmd:_se[_cons]*sqrt(e(N))} after {cmd:reg} {col 71}{c |} -{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 33}{c BRC} - - -{pstd}{ul:{it:Pair-wise test statistics}}{break} -Pair-wise test statistics is always displayed in the table -unless {cmd:stats(pair({it:none}))} is used. -For each balance variable and for each test pair, this code is used. -Since observations not included in the test pair have missing values in the test pair dummy, -they are excluded from the regression without using an if-statement. - -{pstd}{it:basic form:} -{break}{input:reg balancevar tp_dummy} -{break}{input:test tp_dummy}{p_end} - -{pstd}{it:all options:} -{break}{input:reg balancevar tp_dummy covariates i.fixedeffect weights, vce(vce_option)} -{break}{input:test tp_dummy}{p_end} - -{pstd}The table below shows the stats estimated/calculated based on this regression. -A star (*) in the {it:Stat} column indicate that is the optional statistics displayed by default -if the {inp:stats()} option is not used. -The {it:Display option} column shows what sub-option to use in {inp:stats()} to display this statistic. -The {it:Mat col} column shows what the column name in the result matrix for the column that stores this stat. -{it:tp} stands for {it:test pair}, see definition above. -See more about the result matrices in the {it:Result matrices} section below. -The last column shows how the command obtains the stat in the Stata code. -See the group descriptive statistics above for definitions on -{inp:mean_1}, {inp:mean_2}, {inp:var_1} and {inp:var_2} -also used in the table below.{p_end} - -{c TLC}{hline 8}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 45}{c TRC} -{c |} Stat {col 10}{c |} Display option {col 30}{c |} Mat col {col 37}{c |} Estimation/calculation {col 86}{c |} -{c LT}{hline 8}{c +}{hline 19}{c +}{hline 9}{c +}{hline 45}{c RT} -{c |} diff * {col 8}{c |} {inp:stats(pair(diff))} {col 27}{c |} diff_{it:tp} {col 37}{c |} If pair 1_2: {inp:mean_1}-{inp:mean_2} {col 86}{c |} -{c |} beta {col 10}{c |} {inp:stats(pair(beta))} {col 27}{c |} beta_{it:tp} {col 37}{c |} {inp:e(b)[1,1]} after {inp:reg}{col 86}{c |} -{c |} t {col 10}{c |} {inp:stats(pair(t))} {col 30}{c |} t_{it:tp} {col 40}{c |} {inp:_b[tp_dummy]/_se[tp_dummy]} after {inp:reg}{col 86}{c |} -{c |} p {col 10}{c |} {inp:stats(pair(p))} {col 30}{c |} p_{it:tp} {col 40}{c |} {cmd:e(p)} after {cmd:test}{col 86}{c |} -{c |} nrmd {col 10}{c |} {inp:stats(pair(nrmd))} {col 30}{c |} nrmd_{it:tp} {col 40}{c |} If pair 1_2: {inp:diff_{it:tp}/sqrt(.5*(var_1+var_2))} {col 86}{c |} -{c |} nrmb {col 10}{c |} {inp:stats(pair(nrmb))} {col 30}{c |} nrmb_{it:tp} {col 40}{c |} If pair 1_2: {inp:beta_{it:tp}/sqrt(.5*(var_1+var_2))}{col 86}{c |} -{c |} se {col 10}{c |} {inp:stats(pair(se))} {col 30}{c |} se_{it:tp} {col 40}{c |} {cmd:_se[tp_dummy]} after {cmd:reg}{col 86}{c |} -{c |} sd {col 10}{c |} {inp:stats(pair(sd))} {col 30}{c |} sd_{it:tp} {col 40}{c |} {cmd:_se[tp_dummy] * sqrt(e(N))} after {cmd:reg}{col 86}{c |} -{c BLC}{hline 8}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 45}{c BRC} - - -{pstd}{ul:{it:F-test statistics for balance across all balance variables}}{break} -Displayed in the balance table if the option {opt ftest} is used. -For each test pair the following code is used. - -{pstd}{it:basic form:} -{break}{input:reg tp_dummy balancevars } -{break}{input:testparm balancevars}{p_end} - -{pstd}{it:all options:} -{break}{input:reg tp_dummy balancevars covariates i.fixedeffect weights, vce(vce_option)} -{break}{input:testparm balancevars}{p_end} - -{pstd}The table below shows the stats estimated/calculated based on this regression. -A star (*) in the {it:Stat} column indicate that is the optional statistics displayed by default -if the {inp:stats()} option is not used. -The {it:Display option} column shows what sub-option to use in {inp:stats()} to display this statistic. -The {it:Mat col} column shows what the column name in the result matrix for the column that stores this stat. -{it:tp} stands for {it:test pair}, see definition above. -The F-test statistics is stored in -a separate result matrix called {inp:r(iebtab_fmat)}. -See more about the result matrices in the {it:Result matrices} section below. -The last column shows how the command obtains the stat in the Stata code.{p_end} - -{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 24}{c TRC} -{c |} Stat {col 11}{c |} Display option {col 31}{c |} Mat col {col 41}{c |} Estimation/calculation {col 66}{c |} -{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 24}{c RT} -{c |} # obs {col 11}{c |} Always displayed {col 31}{c |} fn_{it:tp} {col 41}{c |} {cmd:e(N)} after {cmd:reg} {col 66}{c |} -{c |} cluster {col 11}{c |} Displayed if used {col 31}{c |} fcl_{it:tp} {col 41}{c |} {cmd:e(N_clust)} after {cmd:reg} {col 66}{c |} -{c |} f * {col 11}{c |} {inp:stats(f(f))} {col 31}{c |} ff_{it:tp} {col 41}{c |} {cmd:r(F)} after {cmd:testparm} {col 66}{c |} -{c |} p {col 11}{c |} {inp:stats(f(p))} {col 31}{c |} fp_{it:tp} {col 41}{c |} {cmd:r(p)} after {cmd:testparm} {col 66}{c |} -{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 24}{c BRC} - -{pstd}{ul:{it:F-test statistics for balance across all groups}}{break} -Dipslayed in the balance table if the option {opt feqtest} is used. -For each balance variable the below code is used where -{it:feqtestinput} is a list on the format -{input:x2.groupvar = x3.groupvar ... xn.groupvar = 0}, -and where {input:x2}, {input:x3} ... {input:xn}, -represents all group codes apart from the first code. - -{pstd}{it:basic form:} -{break}{input:reg balancevar i.groupvar} -{break}{input:test feqtestinput}{p_end} - -{pstd}{it:all options:} -{break}{input:reg balancevar i.groupvar covariates i.fixedeffect weights, vce(vce_option)} -{break}{input:test feqtestinput}{p_end} - -{pstd}The table below shows the stats estimated/calculated based on this regression. -A star (*) in the {it:Stat} column indicate that is the optional statistics displayed by default -if the {inp:stats()} option is not used. -The {it:Display option} column shows what sub-option to use in {inp:stats()} to display this statistic. -The {it:Mat col} column shows what the column name in the result matrix for the column that stores this stat. -See more about the result matrices in the {it:Result matrices} section below. -The last column shows how the command obtains the stat in the Stata code.{p_end} - -{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 24}{c TRC} -{c |} Stat {col 11}{c |} Display option {col 31}{c |} Mat col {col 41}{c |} Estimation/calculation {col 66}{c |} -{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 24}{c RT} -{c |} # obs {col 11}{c |} Always displayed {col 31}{c |} feqn {col 41}{c |} {cmd:e(N)} after {cmd:reg} {col 66}{c |} -{c |} cluster {col 11}{c |} Displayed if used {col 31}{c |} feqcl {col 41}{c |} {cmd:e(N_clust)} after {cmd:reg} {col 66}{c |} -{c |} f * {col 11}{c |} {inp:stats(feq(f))} {col 31}{c |} feqf {col 41}{c |} {cmd:r(F)} after {cmd:test} {col 66}{c |} -{c |} p {col 11}{c |} {inp:stats(feq(p))} {col 31}{c |} feqp {col 41}{c |} {cmd:r(p)} after {cmd:test} {col 66}{c |} -{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 24}{c BRC} - -{title:Result matrices} - -{pstd}There is an unlimited variation in preferences for -how a balance table should be structured or look. -A single command like {inp:iebaltab} simply cannot satisfy them all. -To still enable infinite customization this commands return two matrices -with all the stats calculated by this command. -From these matrices all values can be extracted and -put into any output of your liking.{p_end} - -{pstd}The two returned matrices are called {inp:iebtab_rmat} and {inp:iebtab_fmat}. -All stats related to the F-test across all balance variables (option {inp:ftest}) -are stored in the {inp:iebtab_fmat} matrix, -all other stats are stored in the {inp:iebtab_rmat} matrix. -The {inp:iebtab_fmat} matrix always has exactly one row with the row name {it:fstats}. -The {inp:iebtab_rmat} matrix has one row per balance variable -and each row is named after each balance var. -In both matrices the column names corresponds to a statistics. -The column name for each statistics and its definition can be found -in the {it:Estimation/statistics definitions} section above.{p_end} - -{pstd}See examples below for how to access the values.{p_end} - -{title:Missing values} - -{pstd}When statistics are estimated/calculated they can be missing for multiple reasons. -This section explain what each -{help missing:extended missing values} ({inp:.c},{inp:.v} etc.) represents. -The exported tables or the result matrices should never include -the standard missing value ({inp:.}). -If you ever encounter the standard missing value in any of them, -please report that using the contact information at the bottom of this help file.{p_end} - -{pstd}{ul:{it:Missing value: .b}}{break} -Missing value {inp:.b} means that the statistics -could not be estimated/calculated as bootstrapping was set -to be used as the variance estimator in {inp:vce(bootstrap)}. -When bootstrap is used there is no single value for variance -to be reported in stat {inp:desc(var)}. -As a result of that, the stats {inp:pair(nrmd)} and {inp:pair(nrmb)} -are not reported either as they use the variance as input.{p_end} - -{pstd}{ul:{it:Missing value: .c}}{break} -Missing value {inp:.c} are only used when there is -no number of clusters to report as the errors estimations were not cluster. -A value for number of clusters are only reported if the -variance estimator option is set to {inp:vce(cluster {it:clustervar})}.{p_end} - -{pstd}{ul:{it:Missing value: .f}}{break} -Missing value {inp:.f} is used to indicate that F-test option for -that statistics (either {inp:fstat} or {inp:feqstat}) was not used, -and the value was therefore not calculated.{p_end} - -{pstd}{ul:{it:Missing value: .m}}{break} -Missing value {inp:.m} is used to indicate that an option to skip -a full section was used. For example, {inp:stats(pair(none))} where all -pair-wise statistics are skipped.{p_end} - -{pstd}{ul:{it:Missing value: .n}}{break} -Missing value {inp:.n} is used to indicate that the R-squared value -was not defined in the pair-wise regression for this test pair. -This is most likely caused by no variance in the balance variable. -Here is an example:{p_end} - -{pstd}{inp:sysuse census}{break} -{inp:gen constant = 1}{break} -{inp:iebaltab medage constant, groupvar(region) browse}{p_end} - -{pstd}In this example the variable {inp:constant} has no variance. -This variable has the mean 1 and 0 variance in the descriptive statistics -and statistics can be reported in the descriptive statistics section. -However, the R-square value is not defined for any test pair -in the pair-wise regression, -and no pair-wise stats are reported for the {inp:constant} variable.{p_end} - -{pstd}{ul:{it:Missing value: .o}}{break} -Missing value {inp:.o} is used to indicate that in the F-test regression -for joint significance across all balance variables (see option {inp:ftest}) -for this test pair and at least one balance variable was omitted. -This is most likely caused by no variance in that balance variable. -Here is an example:{p_end} - -{pstd}{inp:sysuse census}{break} -{inp:replace pop = 0 if (region == 1) | (region == 2)}{break} -{inp:iebaltab medage pop, groupvar(region) ftest browse}{p_end} - -{pstd}In this example the variable {inp:pop} has no variance in test pair 1_2, -and that variable will be omitted from the F-test regression and -no stats are reported for this F-test for this test pair.{p_end} - -{pstd}{ul:{it:Missing value: .t}}{break} -Missing value {inp:.t} is used to indicate that no descriptive statistics -were calculated for the full sample since the option {inp:total} was not used.{p_end} - -{pstd}{ul:{it:Missing value: .v}}{break} -Missing value {inp:.v} is used to indicate that -all variance in the balance variable can be explained by one or several -other variables included in the regression. -This is defined as the R-squared value is 1. -Here are a few examples:{p_end} - -{pstd}{inp:sysuse census}{break} -{inp:gen region2 = region}{break} -{inp:gen pop_neg = 0}{break} -{inp:replace pop_neg = pop * -1 if (region == 1) | (region == 2)}{break} -{inp:iebaltab medage pop region2, groupvar(region) covar(pop_neg) browse}{p_end} - -{pstd}The variance in variable {inp:region2} is perfectly explained -by the group variable {inp:region} for each test pair -and the R-sqaured is 1 in all pair-wise regressions and no statistics are reported. -Similarly, {inp:pop_neg} that is included as a covariate control variable -has prefect negative correlation with the balance variable {inp:pop} in test pair 1_2. -The R-sqaured is 1 in the regression for pair 1_2 and no pair-wise statistics are reported for that pair.{p_end} - -{title:Examples} - -{pstd}{hi:Example 1.} - -{pmore}{inp:sysuse census}{break} -{inp:gen group = runiform() < .5}{break} -{inp:iebaltab pop medage, groupvar(group) browse}{break} -{inp:browse}{p_end} - -{pmore}In the example above, Stata's built in census data is used. -First a dummy variable is created at random. -Using this random group variable a balance table is created testing for -differences in {inp:pop} and {inp:medage}. -By using {inp:browse} the data in memory is replaced with the table so that -the table can be used in the browse window. -You most likely never should use the {inp:browse} option in your final code -but it is convenient in examples like this and when first testing the command. -See examples on how to save the table to a file on disk below.{p_end} - -{pstd}{hi:Example 2.} - -{pmore}{inp:sysuse census}{break} -{inp:iebaltab pop medage, groupvar(region) browse}{break} -{inp:browse}{p_end} - -{pmore}In this example we use the variable region as group variable that has four categories. -All groups are tested against each other.{p_end} - -{pstd}{hi:Example 3.} - -{pmore}{inp:sysuse census}{break} -{inp:iebaltab pop medage, groupvar(region) browse control(4)}{break} -{inp:browse}{p_end} - -{pmore}Comparing all groups against each other becomes unfeasible when the number of -categories in the group variable grows. -The option {inp:control()} overrides this behavior so that the category indicated -in this options are tested against all other groups, -but the other groups are not tested against each other. -For statistics where the direction matters (for example {it:diff} or {it:beta}) -the order is changed so that the test is ({it:other_group} - {it:control}) -such that a positive value indicates that the other group has a higher -mean in the balance variable.{p_end} - -{pstd}{hi:Example 4.} - -{pmore}{inp:sysuse census}{break} -{inp:iebaltab pop medage, groupvar(region) browse control(4) stats(desc(var) pair(p))}{break} -{inp:browse}{p_end} - -{pmore}You can control which statistics to output in using the {inp:stats()} option. -In this example, the sub-option {inp:desc(var)} indicates that -the variance should be displayed in the descriptive statistics section -instead of standard error which is the default. -The sub-option {inp:pair(p)} indicates that -the p-value in from the t-tests in the pairwise test section should be displayed -instead of the difference in mean between the groups which is the default. -See above in this help file for full details on the sub-options you may use.{p_end} - -{pstd}{hi:Example 5.} - -{pmore}{inp:sysuse census}{break} -{inp:local outfld {it:"path/to/folder"}}{break} -{inp:iebaltab pop medage, groupvar(region) control(4) ///}{break} -{space 2}{inp:stats(desc(var) pair(p)) replace ///}{break} -{space 2}{inp:savecsv("`outfld'/iebtb.csv") savexlsx("`outfld'/iebtb.xlsx") ///}{break} -{space 2}{inp:savetex("`outfld'/iebtb.tex") texnotefile("`outfld'/iebtb_note.tex")}{p_end} - -{pmore}This example shows how to export the tables to the three formats supported. -CSV, Excel and LaTeX. -To run this code you must update the path {it:"path/to/folder"} to point -to a folder on your computer where the tables can be exported to. -This is what we recommend over using the {inp:browse} options for final code. -When exporting to LaTeX we recommend exporting the note to a seperate file -using the option {inp:texnotefile()} and then import it in LaTeX using the -package {inp:threeparttable} like the code below. -It makes it easier to align the note with the table when LaTeX adjust the size -of the table to fit a page. - - {input} - \begin{table} - \centering - \caption{Balance table} - \begin{adjustbox}{max width=\textwidth} - \begin{threeparttable}[!h] - \input{./balancetable.tex} - \begin{tablenotes}[flushleft] - \item\hspace{-.25em}\input{./balancetable_note.tex} - \end{tablenotes} - \end{threeparttable} - \end{adjustbox} - \end{table} - {text} - -{pstd}{hi:Example 6.} - -{pmore}{inp:sysuse census}{break} -{inp:iebaltab pop medage, groupvar(region)}{break} -{inp:local rnum = rownumb(r(iebtab_rmat),"medage")}{break} -{inp:local cnum = colnumb(r(iebtab_rmat),"p_2_4")}{break} -{inp:local p_medage_2_4 = el(r(iebtab_rmat),`rnum',`cnum')}{break} -{inp:di "The p-value in the test for medage between region 2 and 4 is: `p_medage_2_4'"}{p_end} - -{pmore}In this example none of the export options ({inp:browse}, {inp:savecsv()} etc.) are used -and the only place where the results are stored -is in the {inp:r(iebtab_rmat)} matrix. -The {inp:rownumb()} and the {inp:colnumb()} functions can be used to get -the row and column number from the row and column names. -These row and and column numbers can be used to get the individual value in the function {inp:el()}. -If you know the row and column number you can use the {inp:el()} function directly.{p_end} - - -{title:Author} - -{phang}All commands in ietoolkit are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. - -{phang}Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iebaltab" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/ieboilstart.sthlp b/src/help_files/ieboilstart.sthlp deleted file mode 100644 index 4e2622f8..00000000 --- a/src/help_files/ieboilstart.sthlp +++ /dev/null @@ -1,463 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:ieboilstart} -{hline} - -{title:Title} - -{phang}{cmdab:ieboilstart} {hline 2} applies best practices for -collaboration and reproducibility within a project.{p_end} - -{phang2}For a more descriptive discussion on the intended usage and workflow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Ieboilstart":DIME Wiki}. - -{phang}{hi:DISCLAIMER} {hline 1} One objective of this command -is to harmonize settings across users. -However, it is impossible to guarantee that different types of Stata -(version number, Small/IC/SE/MP or PC/Mac/Linux) -will work exactly the same in every possible context. -This command does not guarantee against any version discrepancies in Stata -or in user-contributed commands. -This command is solely a collection of common practices to reduce the risk -that the same code generates different outputs -when running on different computers. -See more details {help ieboilstart##desc:below}. - -{marker synt}{...} -{title:Syntax} - -{phang}Note that one important feature of this command requires that -{inp: `r(version)'} is written on the first do-file line after {cmd: ieboilstart}, -as this setting cannot be done inside a user-command. -This will set the Stata version to the correct setting. - -{phang}{cmdab:ieboilstart} , {opt v:ersionnumber(Stata_version)} -[{opt ado:path("path/to/folder", {strict|nostrict})} -{opt noclear} {opt q:uietly} {opt veryquietly} -{it:{help ieboilstart##mset:memory_options}}]{p_end}{phang}`r(version)'{p_end} - -{marker opts}{...} -{synoptset 34}{...} -{synopthdr:Options} -{synoptline} -{synopt :{opt v:ersionnumber(Stata_version)}}Sets the Stata version -for all subsequent code execution (required){p_end} -{synopt :{opt ado:path("path", {strict|nostrict})}}Sets the folder where this -project's ado-files or user-written commands are stored (required for standalone reproducibility packages){p_end} -{synopt :{opt noclear}}Makes the command not start by clearing all data{p_end} -{synopt :{opt q:uietly}}Suppresses most of the command's output{p_end} -{synopt :{opt veryquietly}}Suppresses all of the command's output{p_end} - -{marker mset}{...} -{pstd}{it:Memory options}{p_end} -{synopt :{opt maxvar(numlist)}}Manually specify maximum -number of variables allowed{p_end} -{synopt :{opt matsize(numlist)}}Manually specify maximum -number of variables allowed in estimation commands{p_end} -{synopt :{opt noperm:anently}}Disable the default to -permanently set some best practice memory settings{p_end} -{synoptline} - -{marker desc}{...} -{title:Description} - -{pstd}{cmdab:ieboilstart} applies best practices for -collaboration and reproducibility within a research project. -Making the same Stata code consistently generate the same results when -run on other people's computers is harder than what it first might seem. -This is especially true in order to ensure that Stata code will function identically in the future, -even if new versions of Stata and user-written commands (such as those on SSC) -have been released. -The objective of this command is to reduce the risk -that a research project's code changes its results -when running the same code on different computers -or in different points in the future. -However, note that it is not technically possible -to fully eliminate this risk.{p_end} - -{pstd}The best practice settings this command applies -can be categorized into the following types: -version control of built-in commands, -version control of user-written commands, -and {it:other} settings.{p_end} - -{dlgtab:Version control: Stata and built-in commands} - -{pstd}Research projects often span over several years, -and are required to be reproducible for anyone in the future -reviewing the results. -After several years have passed, it is likely that -a new version of Stata has been released. -When Stata releases a new version they add new built-in commands, -but they might also make changes to already published commands.{p_end} - -{pstd}For you to make sure that old code in your project behaves the same way -even after you update your Stata installation -you need to version control the built-in commands in Stata. -You also need to version control the built-in commands in Stata -when you are collaborating as you cannot be sure what version of Stata -everyone else are using at all points in time. -Finally, this becomes particularly important when preparing a -reproducibility package that should stand the test of time, -as you definitely do not know -what version of Stata someone in the future will use.{p_end} - -{pstd}One example where this becomes important is reproducible randomization. -Sometimes Stata updates the random number generator between versions. -Unless the built-in commands that use randomization are version controlled, -then the results of the randomization can vary between versions of Stata. -This is true even if other requirements for reproducible randomization is used, -such as setting the {help seed:seed}. -Each time Stata updates the random number generator it gets marginally better. -However, for the vast majority of research projects, -this improvement is so marginal it is most definitely negligible.{p_end} - -{pstd}This command uses the Stata command {help version:version} to -version control all built-in commands. -For some good technical reasons, it is not possible for {cmd:ieboilstart} -to set the version for the rest of the project's code from inside the command. -This means that all {cmd:ieboilstart} start is preparing the line of code -you need to run to version control all built-in commands. -You need to run this line of code on the -immediate subsequent line after {cmd:ieboilstart}. -Like this:{p_end} - -{phang}{cmdab:ieboilstart} , {it:options}{p_end}{phang}`r(version)'{p_end} - -{pstd}The version setting has the scope of a local, -meaning that it expires when a do-file -and all sub-dofiles it is calling are completed. -If -{browse "https://dimewiki.worldbank.org/Master_Do-files":main/master do-files} -are used, -then the version should be set in the main file, -and only results generated when running all code from the main file -should be considered reproducible.{p_end} - -{pstd}It is just as important, if not more important, -to version control the user-written commands as well. -See next section for how to version control user-written commands, -such as commands installed from {help ssc:scc install}. -{p_end} - -{dlgtab:Version control: User-written commands} - -{pstd}The option {opt adopath()} makes one key -reproducibility component easy to use in Stata. -Many projects in Stata relies on user-written commands, -such as commands installed from {help ssc:SSC}. -With user-written commands there is always a risk that the project code -does not reproduce correctly if a different -version of any user-written command is used. -This applies when team members collaborate in real team on a project, -but it is especially a risk if -someone would try to reproduce the project results in the future. -User-written commands updates frequently, -and depending on when a user installed a command or when it was last updated, -the version of a command that user use -will inevitable eventually be different. -The option {opt adopath()} provides an easy to use tool -to completely eliminate this risk.{p_end} - -{pstd}When a project use the {opt adopath()} option -with the sub-option {opt strict}, -as in {opt adopath("path", strict)}, -it is guaranteed that no one running that project's code will ever use any -other version of user-written commands than -what was intended for that project. -When using the sub-option {opt strict} -it is referred to as using {opt adopath()} in {it:strict mode}. -The intention is that this option should -almost always be used in strict mode.{p_end} - -{pstd}The folder that {it:path} in {opt adopath("path", strict)} points to -is referred to as the project's {it:ado-folder}. -To make the project's code reproducible as promised above, -then this folder needs to be shared with the rest of the project's code. -Therefore it is recommended that each project has its own {it:ado-folder} -and that it is stored together with the rest of that project code. -This makes it easy to include the {it:ado-folder} -when sharing the project code, -no matter if it is shared over Git/GitHub, sync-software like DropBox, -over a network drive, in a reproducibility archive etc. -This folder should include all user-written commands this project uses.{p_end} - -{pstd}When using strict mode, the command {opt net install} -(including commands that builds on it such as {opt ssc install}) -will install the commands in the project's {it:ado-folder}. -Therefore, the intended workflow is that whenever a project needs -another user-written command, then in strict mode, -the user simply installs the command using {opt ssc install} as usual -but the command will be installed in the project {it:ado-folder} -instead of in that user's individual Stata installation. -After this, then all users will be guaranteed to use that exact version -of that command as long as strict mode is still used.{p_end} - -{pstd}In order to guarantee that no user use any command other than -the commands in the project's {it:ado-folder}, -the option {opt adopath()} in strict mode, -makes all commands the user have installed -in their Stata installation unavailable. -This setting is restored when the user restarts Stata -so nothing is uninstalled or made permanently unavailable. -The purpose of this functionality is to make sure that -no-one forgets to include any user-written command that -the project needs in the {it:ado-folder}.}{p_end} - -{pstd}The {opt nostrict} sub-option, -as in {opt adopath("path", nostrict)}, -exists to temporarily disable the functionality in strict mode. -For example, if someone wants to test using a command -installed in their Stata installation -before installing it in the project {it:ado-folder} -then this option can be used. -When {opt nostrict} is used, -then the commands installed in the user's Stata installation, -are available in addition to the commands in the project's {it:ado-folder}. -If a user has a command installed in their Stata installation with -the same name as a command installed in the {it:ado-folder}, -then the version installed in the {it:ado-folder} will always be used. -While using the {opt nostrict} option can perhaps be seen as more convenient, -it would defy the purpose of {opt adopath()} to use -{it:nostrict} as a projects standard mode.{p_end} - -{pstd}A in-depth technical presentation on how this feature works -can be found in a recording found {browse "https://osf.io/6tg3b":here}. -The slides used in that presentation can be found -{browse "https://osf.io/wa3tr":here}. -Note that in this presentation {opt nostrict} was called {it:default mode}. -While the option {opt adopath()} makes one component needed -for a gold-standard level reproducibility easy to use, -it is not the only thing needed for reproducibility. -Other practices such as setting the seed -if using randomization is still as important.{p_end} - -{dlgtab:Other settings} - -{pstd}It is rare that any of the settings in this category -is anything a typical user ever needs to worry about. -These settings mostly prevents that some unusual and outlier memory setting -is the reason some computer is not able to run -the code the same way as other computers. -One example use case where it can be relevant for a user to -modify these settings is if the code is developed to run -on a computer or server with unusual -(for example very small) specifications.{p_end} - -{pstd}This command also standardize some settings that could, in some cases, -could otherwise cause the code to run differently or with interruptions. -For example, {help set more:set more off}, -{help set varabbrev:set varabbrev off}, {help set type:set type float}, -etc.{p_end} - -{pstd}See the tables below for a discussion of which settings used and -why certain default values were used.{p_end} - -{p2colset 5 23 25 2} -{p2col : Other Settings}Explanation{p_end} -{p2line} -{pstd}{it: Basic Memory Settings:}{p_end} -{p2col :{cmdab:set maxvar}}sets the maximum number of variables allowed. -The default value is the maximum allowed in the version of Stata. -A lower maximum number can manually be set by the option {cmdab:maxvar()}. -This value is fixed in Stata Small or IC, -so this setting is ignored when any of those versions of Stata is used. -See {help set maxvar:set maxvar}.{p_end} -{p2col :{cmdab:set matsize}}sets the maximum number of variables -that can be included in estimation commands such as {cmd:regress}. -The default value used in this command is 400 which -is the default value for Stata. -A higher value is often allowed but it slows down Stata -and is only needed when running very complex analysis. -This option can be used to set a higher value, -as long as the value does not violate the limitations in -the versions of Stata this code will be used in. -See {help set matsize:set matsize}.{p_end} -{break} -{pstd}{it: Dynamic Memory Settings (see {help memory:memory} for default values):}{p_end} -{p2col :{cmdab:set min_memory}}sets a lower bound -for the amount of memory assigned to Stata. -The default value is no lower bound.{p_end} -{p2col :{cmdab:set max_memory}}sets an upper bound -for the amount of memory assigned to Stata. -The default is as much as the hardware of the computer allows.{p_end} -{p2col :{cmdab:set niceness}}defines how quickly Stata releases -unused memory back to the computer{p_end} -{p2col :{cmdab:set segmentsize}}defines how large bundles of data -is assigned each time Stata request more memory. -Too large bundles make Stata occupy -an unnecessary large part of the computer's memory -(that otherwise could have been used by other applications), -and too small bundles makes Stata have to interrupt itself to request -more bundles of memory too frequently{p_end} -{break} -{pstd}{it: Code Flow Settings:}{p_end} -{p2col :{cmdab:set more off}}disables the default setting that -Stata stops and waits for the user to press any key each time -the output window is full. -Long dofiles would take a very long time to run and require -constant attention from the user without this setting. -Most Stata users always disable the default which is {cmdab:set more on}. -See {help set more:set more}.{p_end} -{p2col :{cmdab:pause on}}allows the usage of the command {cmdab:pause} -which can be very useful during debugging. -See {help pause:pause}.{p_end} -{break} -{pstd}{it: Variable Settings:}{p_end} -{p2col :{cmdab:set varabbrev off}}allows users to abbreviate variable names. -Somewhat similarly to command names abbreviation such as -{inp:gen} for {inp:generate} and {inp:reg} for {inp:regress}. -However, command name abbreviations are set up to make sure there is no -name conflicts that makes the abbreviations ambiguous. -This is not true for variable name abbreviation and -code that relies on variable name abbreviations tend to be error prone. -See {help set varabbrev} for more details and carefully -consider these words of caution before enabling -variable name abbreviation in a collaborative dofile.{p_end} -{p2col :{cmdab:set type float}}sets the default variable type to {it:float} -when creating a new variable and no type is specified. -Different default types can lead to differences in randomization -as this setting affects the precision in the randomization. -For extremely large dataset the type {it:double} might be required, -when generating random numbers that is expected to be unique. -But since that type is twice as storage intensive, -this command use {it:float} as default, -and users need to specify {it:double} in the rare cases -it makes a difference.{p_end} -{p2line} - -{title:Options} - -{phang}{opt v:ersionnumber(string)} sets a stable version of Stata -for all users. Stata does not (for good reasons) allow a user-written command -to alter the version setting from inside a command. Therefore, this option does -{ul:nothing} unless "`r(version)'" is included as described in the -{help ieboilstart##synt:syntax section}. While the version number cannot be set -inside the command code, {cmd:ieboilstart} does two things. First it reminds -the user to set the version since it is a required command. Second, it makes -sure that the version number used is not too old. A too old version might -risk that there are far too big a difference in many commands. Best -practice is therefore to keep the same version number throughout a project, -unless there is something specific to a newer version -that is required for any dofile. -Only major and recent versions are allowed in order -to reduce errors and complexity. -All versions of Stata can be set to run -any older version of Stata but not a newer.{p_end} - -{phang}{opt ado:path("path/to/folder" [, strict])} adds the folder specified -in this option to the {help sysdir:ado-file paths}. -When {it:strict} is not used this option sets the {it:PERSONAL} path -to the path specified in this command. -When {it:strict} is used then this option instead sets -that path to the {it:PLUS} path. -Read more in {help sysdir} about the {it:PERSONAL} and {it:PLUS} paths. -When {it:strict} is used the all other ado-paths are removed apart from the -{it:BASE} path where the built-in Stata commands are stored. -When preparing a reproducibility package one should use the {it:strict} -to make sure that all user-written commands are saved in the project ado-folder. -If a project should eventually be turned into a reproducibility package, -then it is easier to use {it:strict} from the beginning -and continuously add user-written commands as -they are introduced to the project's code. -This is easier compared to, in the very end making sure that -the correct versions of all user-written commands -are installed in the project ado-folder.{p_end} - -{phang}{opt noclear} prevents the command from clearing -any data set currently loaded into Stata's working memory. -The default is to clear data as the working memory needs to be empty -in order to modify settings for maxvar, min_memory, max_memory and segmentsize. -Nothing saved to hard drive memory will ever be deleted by this command. -This command is intended to be placed at the very top of a dofile, -before any data is loaded into working memory. -For these reasons, {cmdab:noclear} and {cmdab:maxvar()} -cannot be used together.{p_end} - -{phang}{opt q:uietly} suppresses the most verbose outputs from this command, -but not the most important outputs.{p_end} - -{phang}{opt veryquietly} suppresses all the output from this command. -Including the important reminder to set the version number using -{inp:`r(version)'} after running the command. - -{phang}{opt maxvar(numlist)} manually sets -the maximum number of variables allowed in a data set. -The default is to set the number to -the highest allowed in the user's version of Stata. -Reducing this number can occasionally improve performance, -but it is unlikely to make a difference to a modern computer. -This option can be used if a project wants to make sure that the code -can run on smaller versions of Stata or small computers. -Then the project can use this option to restrict all computers -to those limitations, so no one write codes exceeding them.{p_end} - -{phang}{opt matsize(numlist)} manually sets the maximum number of variables -allowed in estimation commands, for example {help reg:regress}. -The default is to set the number to the highest allowed -in the user's version of Stata. -Reducing this number can occasionally improve performance, -but it is unlikely to make a difference to a modern computer. -This option can be used if a project wants to make sure that the code -can run on smaller versions of Stata or small computers. -Then the project can use this option to restrict all computers -to those limitations, so no one write codes exceeding them.{p_end} - -{phang}{opt noperm:anently} is used to disable that this command -updates any default settings in a user's installation of Stata. -For extensively used best practices, this command updates the default settings -such that they apply even after the user has restarted their Stata session. -See option permanently in {help memory:memory} for more details. -The setting {cmd:set more off} is always set permanently, -regardless of if this option used, -as it universally agreed within the Stata community to be better.{p_end} - -{title:Examples} - -{pstd}{hi:Example 1.} - -{phang2}{cmd: ieboilstart}, {opt versionnumber(12.1)}{p_end} -{phang2}{inp:`r(version)'}{p_end} - -{pmore}After running the two lines of code above -all users will run their version of Stata as if the version was 12.1. -That means that anyone who bought or upgraded their Stata -to version 12.1 or a more recent version can run this code -and will behave as identical as possible.{p_end} - -{pstd}{hi:Example 2.} - -{phang2}{inp:local proj_ado} {it:"/path/to/project/code/ado"}{p_end} -{phang2}{cmd:ieboilstart}, {opt versionnumber(15.1)} -{opt adopath("`proj_ado'", strict)}{p_end} -{phang2}{inp:`r(version)'}{p_end} - -{pmore}In this example the Stata version is set to 15.1 -and the ado-folders are updated. -Let's say a project folder is located at {it:"/path/to/project"} and -inside it there is a folder called {it:code} where all code files are located. -This would be a great location for a folder called {it:ado} that would be -the project specific ado-folder. -Since the sub-option {it:strict} is used this is the only place -where Stata would look for commands that are not built-in commands. -Any commands installed by SSC before updating -this ado-path is no longer available. -Any such commands that is needed in the code for this project needs -to be installed again in the project specific ado-folder. -Which can be done using {inp:ssc install ...} the regular way -after {cmd:ieboilstart} was run like this. - -{marker auth}{...} -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit ieboilstart" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/ieddtab.sthlp b/src/help_files/ieddtab.sthlp deleted file mode 100644 index 39180535..00000000 --- a/src/help_files/ieddtab.sthlp +++ /dev/null @@ -1,200 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:ieddtab} -{hline} - -{title:Title} - -{phang2}{cmdab:ieddtab} {hline 2} This command runs a Diff-in-Diff regression and displays the baseline values, the two 1st differences and the 2nd difference. - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/ieddtab":DIME Wiki}. - -{title:Syntax} - -{phang2} {cmdab:ieddtab} {it:varlist} [{help if}] [{help in}] [{help weight}], - {cmdab:t:ime(}{it:varname}{cmd:)} {cmdab:treat:ment(}{it:varname}{cmd:)} - {break}[ - {cmdab:covar:iates(}{it:varlist}{cmd:)} {cmdab:starl:evels(}{it:numlist}{cmd:)} - {cmdab:stardrop} - {cmdab:err:ortype(}{it:string}{cmd:)} {cmdab:rowl:abtype(}{it:string}{cmd:)} - {cmdab:rowlabtext(}{it:label_string}{cmd:)} {cmdab:format(}{it:{help format:%fmt}}{cmd:)} - {cmdab:replace} {cmdab:savet:ex(}{it:filepath}{cmd:)} {cmdab:onerow} {cmdab:nonumbers} - {cmdab:nonotes} {cmdab:addn:otes(}{it:string}{cmd:)} {cmdab:texdoc:ument} - {cmdab:texc:aption(}{it:string}{cmd:)} {cmdab:texl:abel(}{it:string}{cmd:)} - {cmdab:texn:otewidth(}{it:numlist}{cmd:)} {cmdab:texvspace(}{it:string}{cmd:)} - ] - -{pmore}Where {it:varlist} is a list of numeric continuous outcome variables (also called dependent variables or left hand side variables) to be used in the difference-in-difference regression(s) this command runs and presents the results from.{p_end} - -{marker opts}{...} -{synoptset 24}{...} -{synopthdr:options} -{synoptline} -{pstd}{it:Required options:}{p_end} -{synopt :{cmdab:t:ime(}{it:varname}{cmd:)}}Time dummy to use in diff-in-diff regression{p_end} -{synopt :{cmdab:treat:ment(}{it:varname}{cmd:)}}Treatment dummy to use in diff-in-diff regression{p_end} - -{pstd}{it:Statistics options:}{p_end} -{synopt :{cmdab:covar:iates(}{it:varlist}{cmd:)}}Covariates to use in diff-in-diff regression{p_end} -{synopt :{cmdab:vce:(}{it:{help vce_option:vce_types}}{cmd:)}}Options for variance estimation. {hi:Robust}, {hi:cluster} {it:clustervar} or {hi:bootstrap}{p_end} -{synopt :{cmdab:starl:evels(}{it:numlist}{cmd:)}}Significance levels used for significance stars, default values are .1, .05 and .01{p_end} -{synopt :{cmdab:stardrop}}Suppresses all significance stars in all tables.{p_end} -{synopt :{cmdab:err:ortype(}{it:string}{cmd:)}}Type of errors to display, default is standard errors.{p_end} - -{pstd}{it:Output options:}{p_end} -{synopt :{cmdab:rowl:abtype(}{it:string}{cmd:)}}Indicate what to use as row titles, default is variable name.{p_end} -{synopt :{cmdab:rowlabtext(}{it:label_string}{cmd:)}}Manually enter the row titles using label strings (see below).{p_end} -{synopt :{cmdab:nonote}}Disable that the automatically generated note is displayed below the table.{p_end} -{synopt :{cmdab:addn:otes(}{it:string}{cmd:)}}Manually add a note to be displayed below the regression result table.{p_end} -{synopt :{cmdab:onerow}}Display the number of observations on one row at the last row of the table.{p_end} -{synopt :{cmdab:format(}{it:{help format:%fmt}}{cmd:)}}Set the rounding format of the calculated statistics in the table.{p_end} -{synopt :{cmdab:replace}}Replace the file on disk if it already exist. Has no effect if no option with file path is used.{p_end} - -{pstd}{it:LaTeX options:}{p_end} -{synopt :{cmdab:savet:ex(}{it:filepath}{cmd:)}}Generate a LaTeX table of the result and save to the location of the file path.{p_end} -{synopt :{cmdab:texdoc:ument}}Creates a stand-alone TeX document.{p_end} -{synopt :{cmdab:texc:aption(}{it:string}{cmd:)}}Specify table's caption on TeX file.{p_end} -{synopt :{cmdab:texl:abel(}{it:string}{cmd:)}}Specify table's label, used for meta-reference across TeX file.{p_end} -{synopt :{cmdab:texn:otewidth(}{it:numlist}{cmd:)}}Manually enter the width of the note on the TeX file.{p_end} -{synopt :{cmd:texvspace(}{it:string}{cmd:)}}Manually set size of the line space between two rows on TeX output.{p_end} -{synopt :{cmdab:nonumbers}}Omit column numbers from table header in LaTeX output.{p_end} -{synoptline} - -{marker desc} -{title:Description} - -{pstd}{cmdab:ieddtab} is a command that makes it easy to run and display results of differences-in-differences (diff-in-diff) regressions. The table that presents the results from the diff-in-diff regression also presents the mean when the variable in {inp:time()} is 0 (i.e. baseline) for the two groups defined by the variable {inp:treatment()} is 0 and 1 (i.e. control and treatment), and the table also presents the coefficient of the first difference regression in control and treatment.{p_end} - -{pstd}The sample for each row in the table is defined by the sample included in the second difference regression shown below, where {it:outcome_var} is a variable the varlist (one per row) for {inp:ieddtab}, {inp:`interaction'} is the interaction of the dummy listed in {inp:time()} and the dummy listed in {inp:treatment()}, and where {inp:`covariates'} is the list of covariates included in {inp:covariates()} if any. This means that any observation that has any missing value in either of the two dummies or in any of the covariates will be omitted from all statistics presented in the table. The coefficient presented in the table for the diff-in-diff regression is the interaction of the time and treatment variable.{p_end} - -{pstd}{inp:tempvar} {it:interaction}{p_end} -{pstd}{inp:generate `interaction' = `time' * `treatment'}{p_end} -{pstd}{inp:regress} {it:outcome_var} {inp:`time' `treatment' `interaction' `covariates'}{p_end} - -{pstd}The baseline means are then calculated using the following code where the first line is control and the second line is treatment, and the variable {inp:regsample} is dummy indicating if the observation was included in the second difference regression.{p_end} - -{pstd}{inp:mean} {it:outcome_var} {inp:if `treatment' == 0 & `time' == 0 & regsample == 1}{p_end} -{pstd}{inp:mean} {it:outcome_var} {inp:if `treatment' == 1 & `time' == 0 & regsample == 1}{p_end} - -{pstd}The first difference coefficients are then calculated using the following code where the first line is control and the second line is treatment. The coefficient displayed in the table is the coefficient of the variable `time' which is the variable listed in {inp:t()}.{p_end} - -{pstd}{inp:regress} {it:outcome_var} {inp: `time' `covariates' if `treatment' == 0 & regsample == 1}{p_end} -{pstd}{inp:regress} {it:outcome_var} {inp: `time' `covariates' if `treatment' == 1 & regsample == 1}{p_end} - - -{marker optslong} -{title:Options} - -{pstd}{it:{ul:{hi:Required options:}}}{p_end} -{phang}{cmdab:t(}{it:varname}{cmd:)} indicates which variable should be used as the time dummy to use in diff-in-diff regression. This must be a dummy variable, i.e. only have 0, 1 or missing as values, where 0 is baseline and 1 is follow-up.{p_end} - -{phang}{cmdab:treatment(}{it:varname}{cmd:)} indicates which variable should be used as the treatment dummy to use in diff-in-diff regression. This must be a dummy variable, i.e. only have 0, 1 or missing as values.{p_end} - -{pstd}{it:{ul:{hi:Statistics options:}}}{p_end} -{phang}{cmdab:covar:iates(}{it:varlist}{cmd:)} lists the variables that should be included as covariates (independent variables not reported in the table) in the two first difference regressions and the second diffrence regression. Unless the option {cmdab:nonotes} is used a list of covariate variables is included below the table.{p_end} - -{phang}{cmdab:vce:(}{it:{help vce_option:vce_types}{cmd:)}} sets the type of variance estimator to be used in all regressions for this -command. See {help vce_option:vce_types} for more details. The only vce types allowed in this command are {hi:robust}, {hi:cluster} {it:clustervar} or {hi:bootstrap}. -Option {hi:robust} only applied to first and second difference estimators, not to baseline means.{p_end} - - -{phang}{cmdab:starl:evels(}{it:numlist}{cmd:)} sets the significance levels used for significance stars. Exactly three values must be listed if this option is used, all three values must be descending order, and must be between 0 and 1. The default values are .1, .05 and .01. The levels specified in this option is ignored if {cmdab:stardrop} is used.{p_end} - -{phang}{cmdab:stardrop}} suppresses all significance stars in all tables and remove the note on significance levels from the table note.{p_end} - -{phang}{cmdab:err:ortype(}{it:string}{cmd:)} sets the type of error to display. Allowed values for this iption is {inp:se} for standard errors, {inp:sd} for standard deviation and {inp:errhide} for not displaying any errors in the table. The default is to display standard errors.{p_end} - -{pstd}{it:{ul:{hi:Output options:}}}{p_end} -{phang}{cmdab:rowl:abtype(}{it:string}{cmd:)} indicates what to use as row titles. The allowed values are {inp:varname} using the variable name as row titles, {inp:varlab} using the variable labels as row titles (varname will still be used if the variable does not have a variable label). The default is to use the variable name.{p_end} - -{phang}{cmdab:rowlabtext(}{it:label_string}{cmd:)} manually specifies the row titles using label strings. A label string is a list of variable names followed by the row title for that variable separated by "@@". For example {it:varA Row title variable A @@ varB Row title variable B}, where {it:varA} and {it:varB} are outcome variables used in this command. For variable not listed in {cmdab:rowlabtext()} row titles will be determined by the input value or default value in {cmdab:rowl:abtype()}.{p_end} - -{phang}{cmdab:nonotes} disable that the command automatically generates and displays a note below the table describing the output in the table. The note includes description on how number of calculations are calculated, the significance levels used for stars and which covariates were uses if any were used.{p_end} - -{phang}{cmdab:addn:otes(}{it:string}{cmd:)} is used to manually add a note to be displayed below the regression result table. This note is put before the automatically generated note, unless option {cmdab:nonotes} is specified, in which case only the manually added note is displayed.{p_end} - -{phang}{cmdab:onerow} indicates that the number of observations should be displayed on one row at the last row of the table instead on each row. This requires that the number of observations are the same across all rows for each column.{p_end} - -{phang}{cmdab:format(}{it:{help format:%fmt}}{cmd:)} sets the number formatting/rounding rule for all calculated statistics in the table, that is all numbers in the table apart from the number of observations. Only valid {help format:Stata number formats} are allowed. The default is {it:%9.2f}.{p_end} - -{phang}{cmdab:replace} if an option is used that output a file and a file with that name already exists at that location, then Stata will throw an error unless this option is used. If this option is used then Stata overwrites the file on disk with the new output. This option has no effect if no option with file path is used.{p_end} - -{pstd}{it:{ul:{hi:LaTeX options:}}}{p_end} -{phang}{cmdab:savet:ex(}{it:filepath}{cmd:)} saves the table in TeX format to the location of the file path.{p_end} - -{phang}{cmdab:texdoc:ument} creates a stand-alone TeX document that can be readily compiled, without the need to import it to a different file. - As default, {cmd:savetex()} creates a fragmented TeX file consisting only of a tabular environment. - -{phang}{cmdab:texc:aption(}{it:string}{cmd:)} writes table's caption in TeX file. Can only be used with option texdocument. {p_end} - -{phang}{cmdab:texl:abel(}{it:string}{cmd:)} specifies table's label, used for meta-reference across TeX file. Can only be used with option texdocument.{p_end} - -{phang}{cmdab:texn:otewidth(}{it:numlist}{cmd:)} manually adjusts the width of the note to fit the size of the table. -The note width is a multiple of text width. If not specified, default is one, which makes the table width equal to text width.{p_end} - -{phang}{cmd:texvspace(}{it:string}{cmd:)} sets the size of the line space between two variable rows. {it:string} must consist of a numeric value -and one of the following units: "cm", "mm", "pt", "in", "ex" or "em". Note that the resulting line space displayed will be equal to the -specified value minus the height of one line of text. Default is "3ex". For more information on units, -{browse "https://en.wikibooks.org/wiki/LaTeX/Lengths":check LaTeX lengths manual}. {p_end} - -{phang}{cmdab:nonumbers} ommits column numbers from table header in LaTeX output. Default is to display column numbers.{p_end} - -{marker optslong} -{title:Examples} - -{pstd}All the examples below can be run on the Stata's built in census data set, by first running this code:{p_end} - -{pstd}*Open the built in data set{p_end} -{pstd}{inp:sysuse census}{p_end} - -{pstd}*Calculate rates from absolute numbers{p_end} -{pstd}{inp:replace death = 100 * death / pop}{p_end} -{pstd}{inp:replace marriage = 100 * marriage / pop}{p_end} -{pstd}{inp:replace divorce = 100 * divorce / pop}{p_end} - -{pstd}*Randomly assign time and treatment dummies{p_end} -{pstd}{inp:gen t = (runiform()<.5)}{p_end} -{pstd}{inp:gen treatment = (runiform()<.5)}{p_end} - - -{pstd} {hi:Example 1.} - -{pstd} {inp:ieddtab} {it:death marriage divorce} , {inp:t(}{it:time}{inp:)} {inp:treatment(}{it:treatment}{inp:)} - -{pstd}This is the most basic way to run this command with three variables. This will output a table with the baseline means for treatment = 0 and treatment = 1, the first difference regression coefficient for treatment = 0 and treatment = 1 as well as the 2nd difference regression coefficient for treatment = 0 and treatment = 1. - -{pstd} {hi:Example 2.} - -{pstd} {inp:ieddtab} {it:death marriage divorce} , {inp:t(}{it:time}{inp:)} {inp:treatment(}{it:treatment}{inp:)} {inp:rowlabtext(}{it:"death Death Rate @@ divorce Divorce Rate"}{inp:)} {inp:rowlabtype(}{it:"varlab"}{inp:)} - -{pstd}The table generated by example 2 will have the same statistics as in example 1 but the row title for the variables death and divorce are entered manually and the row title for marriage will be its variable label instead of its variable name. - -{pstd} {hi:Example 3.} - -{pstd} {inp:ieddtab} {it:death marriage divorce} , {inp:t(}{it:time}{inp:)} {inp:treatment(}{it:treatment}{inp:)} {inp:rowlabtype(}{it:"varlab"}{inp:)} {inp:savetex(}{it:"DID table.tex"}{inp:)} {inp:replace} - -{pstd}The table will be saved in the current directory under the name "DID table.tex". It will will have the same statistics as in examples 1 and 2, and the row titles will be its variable labels. - -{title:Acknowledgements} - -{phang}This command was initally suggested by Esteban J. Quinones, University of Wisconsin-Madison{p_end} - -{phang}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Benjamin Daniels{break}Jonas Guthoff{break}Nausheen Khan{break}Varnitha Kurli{break}Saori Iwamoto{break}Meyhar Mohammed{break}Michael Orevba{break}Matteo Ruzzante{break}Sakina Shibuya{break}Leonardo Viotti{break} - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations.{p_end} - -{phang}Main author: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group{p_end} - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit ieddtab" in the subject line to:{break} - dimeanalytics@worldbank.org{p_end} - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through - the GitHub repository of ietoolkit:{break} -{browse "https://github.com/worldbank/ietoolkit"}{p_end} diff --git a/src/help_files/iedorep.sthlp b/src/help_files/iedorep.sthlp deleted file mode 100644 index 4b61fdd8..00000000 --- a/src/help_files/iedorep.sthlp +++ /dev/null @@ -1,110 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} - -{hline} -help for {hi:iedorep} -{hline} - -{title:Title} - -{phang}{cmdab:iedorep} {hline 2} detects reproducibility errors in do-files automatically by running them multiple times and comparing the Stata state on a line-by-line basis between executions. - -{title:Syntax} - -{phang2} {cmdab:iedorep} "{it:/path/do/do-file.do}" , [ {cmdab:alldata allseed allsort} ] - -{marker desc} -{title:Description} - -{phang}{cmdab:iedorep} provides a reproduciblity assessment of a do-file or project. - It should be used when a do-file or project is complete to detect any - instabilities or likely sources of replication errors. - {break} - -{phang}{cmdab:iedorep} will run the do-file twice and flag three types of possible - errors between the first and the second run of the do-file. - (1) Changes to data which leave the data at a different state - in the same line of the do-file. (Changes in the datasignature) - (2) Changes to the random number generator state - which result in a different state at the same line in the do-file. (Changes in the RNG state) - (3) Changes to the sort order of the data which leave the data - in a different sort order at the same line of the do-file. (Changes in the sortseed) - {break} - -{phang}{cmdab:iedorep} will first report a warning if the delimiter is changed in the do-file. - It is not designed to work with delimiters other than Stata's default (a newline). - It will also report a warning if you use {cmdab:clear all} or {cmdab:ieboilstart}; - specifically, it will re-write these commands to avoid calling {cmdab:discard}, - as this command makes it impossible for {cmdab:iedorep} to store the necessary data for its diagnostics. - If you experience unusual issues with {cmdab:iedorep}, they are often memory issues; - in particular, the error "post posty not found" often indicates a memory management conflict. - Contact the maintainer to resolve these types of issues, - as they are typically hard-to-find bugs in memory management commands that are not often used. - {break} - -{phang} {cmdab:iedorep} is designed to be used targeting a master do-file (it will work on any file). - Its verbosity options allow the user to see all changes to data, RNG state, - and sort seed state, regardless of whether they are flagged as errors. - -{marker optslong} -{title:Options} - -{phang}The {cmdab:alldata}, {cmdab:allseed} , and {cmdab:allsort} options will - report any time the data is changed, the RNG state changes, or the sort order of the data changed, - even if the result is consistent between the two do-file runs. - This is only recommended for advanced diagnostics; - for example, if reproducibility problems persist despite no errors appearing. - There are known cases where inconsistencies occur with very low - frequency and might not be detected in every given pair of runs. - -{marker example} -{title:Example verbose output} - - iedorep "${ietoolkit}/run/iedorep/iedorep-target-1.do" /// - , alldata allsort allseed - - +---------------------------------------------------------------+ - | Line | Data | Seed | Sort | Subfile | - |------+----------------+-------------+---------------+---------| - | 5 | Changed | | | | - | 11 | Changed | | | | - | 13 | | | Sorted | | - | 15 | | | ERROR! Sorted | | - | 19 | ERROR! Changed | | | | - |------+----------------+-------------+---------------+---------| - | 20 | ERROR! Changed | ERROR! Used | | | - | 22 | | Used | | | - | 24 | ERROR! Changed | | ERROR! Sorted | | - | 26 | ERROR! Changed | | ERROR! Sorted | Yes | - +---------------------------------------------------------------+ - - -{title:Notes} - - {phang}In the example above, the rows without "ERROR!" flags would not appear - if the verbosity options were not specified. - - {phang}We recommend resolving issues from the top down, since later issues - may be resolved by fixing earlier ones. - This is because many reproducibility issues will "cascade": - An inconsistent RNG state early in the do-file will cause many types of - later data creation (such as randomization assignment) to fail to reproduce. - Both issues will be fixed by resolving the first one. - Similarly, a single data inconsistency will cause every subsequent data check to fail - until new data is loaded that matches the data state in the first run, - but there may only be one true issue in the do-file. - -{title:Acknowledgements} - -... - -{title:Author} - -{phang}Main author: Benjamin Daniels, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iedorep" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iedropone.sthlp b/src/help_files/iedropone.sthlp deleted file mode 100644 index e3c4edcd..00000000 --- a/src/help_files/iedropone.sthlp +++ /dev/null @@ -1,147 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iedropone} -{hline} - -{title:Title} - -{phang2}{cmdab:iedropone} {hline 2} Same function as {help drop} but prevents - that additional observations are unintentionally dropped. - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iedropone":DIME Wiki}. - -{title:Syntax} - -{phang2} -{cmdab:iedropone} [if] , {cmdab:n:umobs(}{it:integer}{cmd:)} - {cmdab:mvar(}{it:varname}{cmd:)} {cmdab:mval(}{it:list of values}{cmd:)} - {cmd:zerook}] - -{marker opts}{...} -{synoptset 22}{...} -{synopthdr:options} -{synoptline} -{synopt :{cmdab:n:umobs(}{it:integer}{cmd:)}}Number of observations that is allowed to be dropped. Default is 1.{p_end} -{synopt :{cmd:zerook}}Allows that no observation is dropped.{p_end} -{synopt :{cmdab:mvar(}{it:varname}{cmd:)}}Variable for which multiple values should be dropped. Must be used together with {cmdab:mval()}.{p_end} -{synopt :{cmdab:mval(}{it:list of values}{cmd:)}}The list of values in {cmdab:mvar()} that should be dropped. Must be used together with {cmdab:mvar()}.{p_end} -{synoptline} - -{marker desc} -{title:Description} - -{pstd}This commands might be easier to understand by following - the {help iedropone##examples:examples below} before reading the - description or the explanations of the options. - -{pstd}{cmdab:iedropone} has the same purpose as {help drop} when dropping - observations. However, {cmdab:iedropone} safeguards that no additional - observations are unintentionally dropped, or that changes are made to the - data so that the observations that are supposed to be dropped are no longer dropped. - -{pstd}{cmdab:iedropone} checks that no more or fewer observations than intended are - dropped. For example, in the case that one observation has been identified to - be dropped, then we want to make sure that when re-running the do-file - no other observations are dropped even if more observations are added to that data - set or changed in any other way. - -{pstd}While the default is 1, {cmdab:iedropone} allows the user to set any another number - of observation that should be dropped. If the number of observations that fit the - drop condition is different, then the command will throw an error. - -{marker optslong} -{title:Options} - -{phang}{cmdab:n:umobs(}{it:integer}{cmd:)} this allows the user to set the - number of observation that should be dropped. The default is 1 but any - positive integer can be used. The command throws an error if any other number - of observations match the drop condition. - -{phang}{cmd:zerook} allows that no observations are dropped. The default is that - an error is thrown if no observations are dropped. - -{phang}{cmdab:mvar(}{it:varname}{cmd:)} and {cmdab:mval(}{it:list of values}{cmd:)} allows - that multiple values in one variable are dropped. These two options must be used together. - If the variable in {cmd:mvar()} is a string variable and some of the values in {cmd:mval()} - includes spaces, then the list of values in {cmd:mval()} must be listed exactly as in example 4 below. The - command loops over the values in {cmd:mval()} and drops the observations that - satisfy the {it:if} condition and each of the value in {cmd:mval()}. For example:{p_end} - -{pmore}{inp:iedropone if village == 100 , mvar(household_id) mval(21 22 23)} - -{pmore}is identical to: - -{pmore}{inp:iedropone if village == 100 & household_id == 21}{break}{inp:iedropone if village == 100 & household_id == 22}{break}{inp:iedropone if village == 100 & household_id == 23} - -{pmore}The default is that exactly one observation should be dropped for each - value in {cmd:mval()} unless {cmd:numobs()} or {cmd:zerook} is used. If those - options are used then, then they apply to all values in {cmd:mval()} separately. - -{phang}{cmdab:mval(}{it:list of values}{cmd:)}, see {cmdab:mvar(}{it:varname}{cmd:)} above. - -{marker examples} -{title:Examples} - -{pstd} {hi:Example 1.} - -{pmore}{inp:iedropone if household_id == 712047} - -{pmore}Let's say that we have identified the household with the ID 712047 to be - incorrect and it should be dropped. Identical to {inp:drop if household_id == 712047} - but it will test that exactly one observation is dropped each time the do-file runs. - This guarantees that we will get an error message that no observation is dropped - if someone makes a change to the ID. Otherwise we would unknowingly keep this - incorrect observation in our data set. - -{pmore}Similarly, if a new observation is added that is the correct household with ID 712047, - then both observation would be dropped without warning if we would have - used {inp:drop if household_id == 712047}. {cmd:iedropone} will make sure that - our drop condition are applied as intended even if the data set is changed. - - -{pstd} {hi:Example 2.} - -{pmore}{inp:iedropone if household_id == 712047 & household_head == "Bob Smith"} - -{pmore}Let's say we have added a new household with the ID 712047. In order to - drop only one of those observations we must expand the if condition to - indicate which one of them we want to drop. - -{pstd} {hi:Example 3.} - -{pmore}{inp:iedropone if household_id == 712047, numobs(2)} - -{pmore}Let's say we added a new household with the ID 712047 but we want to drop - exactly both of them, then we can use the option {cmd:numobs()} like above. - The command will now throw an error if not exactly two observations have the - household ID 712047. - -{pstd} {hi:Example 4.} - -{pmore}{inp:iedropone if village == 100, mvar(household_head) mval(`" "Bob Smith" "Ann Davitt" "Blessing Johnson" "')} - -{pmore}If the values in {cmd:mvar()} are strings with empty spaces then then each - value have to be enclosed in double quotes and the full list needs to start - with {inp:`"} and end with {inp:"'}. - -{title:Acknowledgements} - -{phang}I would like to acknowledge the help in testing and proofreading I - received in relation to this command and help file from (in alphabetic - order):{p_end} -{pmore}Paula Gonzalez-Martinez{break}Seungmin Lee{break}Mrijan Rimal{break} - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iedropone" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iefolder.sthlp b/src/help_files/iefolder.sthlp deleted file mode 100644 index 289401f9..00000000 --- a/src/help_files/iefolder.sthlp +++ /dev/null @@ -1,206 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iefolder} -{hline} - -{title:Title} - -{phang2}{cmdab:iefolder} {hline 2} sets up project folders and master do-files according to World Bank DIME's standards.{p_end} - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iefolder":DIME Wiki}. - -{title:Syntax} - -{pstd} {ul:When initially setting up the {hi:DataWork} folder in a new project:}{p_end} - -{phang2}{cmd:iefolder} new project, {cmdab:proj:ectfolder(}{it:directory}{cmd:)} {p_end} - - -{pstd} {ul:When adding folders to and already existing {hi:DataWork} folder:}{p_end} - -{phang2}{cmd:iefolder} new {it:itemtype} {it:itemname} , {cmdab:proj:ectfolder(}{it:directory}{cmd:)} - [{cmdab:abb:reviation(}{it:string}{cmd:)} {cmdab:sub:folder(}{it:folder}{cmd:)}] {p_end} - -{pmore}where {it:itemtype} is either {it:round}, {it:unitofobs} or {it:subfolder}. See - details on {it:itemtype} and {it:itemname} below.{p_end} - -{marker opts}{...} -{synoptset 22}{...} -{synopthdr:options} -{synoptline} -{synopt : {cmdab:proj:ectfolder(}{it:dir}{cmd:)}}The location of - the project folder where the {hi:DataWork} folder should be - created (new projects), or where it is located (new rounds, unitofobs and subfolders).{p_end} -{synopt : {cmdab:abb:reviation(}{it:string}{cmd:)}}Optional abbreviation - of round name to be used to make globals shorter. Can only be used - when {it:itemtype} is round.{p_end} -{synopt : {cmdab:sub:folder(}{it:folder}{cmd:)}}Creates the round folders inside - a subfolder to DataWork. Only works with new rounds and only after the subfolder - has been created with {it:iefolder new subfolder}.{p_end} -{synoptline} - -{marker desc}{title:Description} - -{pstd}{cmdab:iefolder} automates the process of setting up the folders and master do-files - where all the data work will take place in a project folder. The folder structure set - up by {cmdab:iefolder} follows {browse "https://dimewiki.worldbank.org/wiki/DataWork_Folder":DIME's best practices}. - -{pstd}In addition to setting up the {hi:DataWork} folder and its folder structure, the - command creates master do-files linking to all main folders in the folder structure. These - master do-files are updated whenever more rounds, units of observations, and - subfolders are added to the project folder using this command. - -{pstd}{ul:{hi:itemtypes}}{break} This command can create either a new DataWork folder or add folders to an - existing DataWork folder. The existing DataWork folder must have been created - with {cmd:iefolder} for the additions to work. A new DataWork folder is created using specifying {ul:project}. There are three types of folders that can be added to an existing folder by specifying {ul:round}, {ul:unitofobs} or {ul:subfolder}. See - next paragraphs for descriptions. - -{pstd}{ul:{it:project}} sets up a new DataWork folder and its initial folder structure. You must always do this before you can do anything else. It also sets up the main master do-file for this DataWork folder. {cmd:iefolder} is implemented so that you can keep working for years with your project in between adding folders. The command reads and preserves changes made manually to the DataWork folder and master do-file before adding more folders using {cmd:iefolder}. - -{pstd}{ul:{it:round}} folders are folders specific to a data collection round, for example, {it:Baseline}, {it:Endline}, - {it:Follow Up} etc. (See {it:subfolder} below if your project is more complex than that.) When adding a new round, a round folder is added to the DataWork folder, and inside it the round folder structure described {browse "https://dimewiki.worldbank.org/wiki/DataWork_Survey_Round":here} is created. {cmd:iefolder} also - creates a master do-file specific for this round with globals referencing the main folders - in the folder structure specific to this round. Folders are created in two places, both in the DataWork folder, and in the Encrypted folder. - -{pstd}{ul:{it:unitofobs}} folders are folders specific to a unit of observation, - for example the master data set folder. Read more about master data sets and the folder structure - this commands sets up for you at {browse "https://dimewiki.worldbank.org/wiki/Master_Data_Set":here}. A - master data folder for each new unit of observation is created in two places. Both in - the MasterData folder in the DataWork folder, and in the Encrypted folder. - -{pstd}{ul:{it:subfolder}} can be used to organize folders with a lot of data collections. For examples, instead of having only one baseline data collection, a project might have a student, a teacher, and a school data collections all in baseline. With {it:subfolder} you can, using this example, create a folder called Baseline in the DataWork folder, and when creating the rounds for student, teacher and school, you can create those round inside the Baseline folder using the option {cmd:subfolder(}{it:Baseline}{cmd:)}. When creating a subfolder, only a single folder is created in the DataWork folder and it is empty. The main master do-file is however updated with a global to this folder. - -{marker optslong}{title:Options} - -{phang}{cmdab:proj:ectfolder(}{it:dir}{cmd:)} should point to the same folder regardless - of which {it:itemtype} is created. If {it:new project} is specified, the file path should - point to where DataWork should be created, and if {it:new round} or {it:new project} is - specified, it should point to where DataWork was already created. See how the file path is - the same both time when {cmd:iefolder} is called twice in Example 1 below. - -{phang}{cmdab:abb:reviation(}{it:string}{cmd:)} can be used to shorten the globals created - in the master do-files that point to the sub-folders to {it:round} folders. For example, - if you create a new {it:round} called Baseline, as in Example 1, then a global to the - DataSet folder called Baseline_dt will be created in the master do-file. If the - abbreviation option would have been used, like in Example 2, then the global would - have been called BL_dt. - -{phang}{cmdab:sub:folder(}{it:folder}{cmd:)} creates a round folder inside the folder specified in this option. This option can only be used when creating a new round. The folder specified must have been created using {cmd:iefolder}. See example 3. - -{title:Examples} - -{pstd}{hi:Example 1.} - -{pmore}{inp:global projectFolder "C:\Users\Documents\DropBox\ProjectABC"} - -{pmore}{inp:iefolder new project , projectfolder("$projectFolder")}{break} -{inp:iefolder new round baseline , projectfolder("$projectFolder")} - -{pstd}In the example above, in the line the first time {cmd:iefolder} is used, a folder - called {hi:DataWork} is created at the location of {it:"C:\Users\Documents\DropBox\ProjectABC"}. - In the line where {cmd:iefolder} used a second time, a folder for the baseline round - is created inside the {hi:DataWork} folder. Note that the folder provided - in {inp:projectfolder()} is the same both times. - -{pstd}Both the {hi:DataWork} folder and the {hi:baseline} folder created have sub-folders - and master do-files creating globals pointing to these. - - -{pstd}{hi:Example 2.} - -{pmore}{inp:global projectFolder "C:\Users\Documents\DropBox\ProjectABC"} - -{pmore}{inp:iefolder new project , projectfolder("$projectFolder")}{break} -{inp:iefolder new round baseline , projectfolder("$projectFolder") abbreviation("BL")} - -{pstd}The example above creates the same folder structure as in Example 1, but - in the globals in the master do-files the abbreviation BL is used instead of - baseline. But the folders created on disk will still be called baseline. - -{pstd} {hi:Example 3.} - -{pstd}This example shows how to use subfolders. - -{pmore}{inp:global projectFolder "C:\Users\Documents\DropBox\ProjectABC"} - -{pmore}{inp:iefolder new project , projectfolder("$projectFolder")} - -{pmore}{inp:iefolder new subfolder baseline , projectfolder("$projectFolder")}{break} -{inp:iefolder new round studentBL , projectfolder("$projectFolder") subfolder("baseline")}{break} -{inp:iefolder new round teacherBL , projectfolder("$projectFolder") subfolder("baseline")} - -{pstd}The code above creates a new {hi:DataWork} folder inside the folder ProjectABC. Then {hi:subfolder} is used to create a folder called baseline. Then the two baseline rounds, student and teacher, are created inside the folder baseline. - -{pstd}The code below shows how the endline folder can be created in the same folder. Note that the rounds need to have unique names even across subfolders, and that is why the student and teacher round have the suffix EL. - -{pmore}{inp:global projectFolder "C:\Users\Documents\DropBox\ProjectABC"} - -{pmore}{inp:iefolder new subfolder endline , projectfolder("$projectFolder")}{break} -{inp:iefolder new round studentEL , projectfolder("$projectFolder") subfolder("endline")}{break} -{inp:iefolder new round teacherEL , projectfolder("$projectFolder") subfolder("endline")} - -{pstd} {hi:Example 4.} - -{pstd}The example below is meant to describe an intended workflow for a full - life cycle of an impact evaluation. First we need to set up the {hi:DataWork} folder. - We do that using {it:{cmd:iefolder} new project}. Like this: - -{pmore}{inp:iefolder new project , projectfolder("C:\DropBox\ProjectABC")} - -{pstd}Our first data collection will be a baseline where the unit of observation - is households. We therefore need to set up folders for the unit of observation - "households". In the encrypted master folder for "housholds" you can create your - list over households and you have a subfolder called {it:Sampling} where you - can keep do files and data with identifying information. We create all of that by - using {it:{cmd:iefolder} new unitofobs household}. Like this: - -{pmore}{inp:iefolder new unitofobs household , projectfolder("C:\DropBox\ProjectABC") abbreviation("BL")} - -{pstd}When we are ready to start preparing for the baseline we want to create the - baseline folder. We do that using {it:{cmd:iefolder} new round baseline}. Like this: - -{pmore}{inp:iefolder new round baseline , projectfolder("C:\DropBox\ProjectABC") abbreviation("BL")} - -{pstd}At this point we can collect the baseline data, save the data in the folders - we created and write the report. Then long stretches of time might pass before - we need to use the command. - -{pstd}Let's say that when we plan for midline we also want - to collect data about the villages that the households we interview in baseline - live in. Then we need to create a new master folder for the unit of observation - villages. We do that using {it:{cmd:iefolder} new unitofobs village}. Like this: - -{pmore}{inp:iefolder new unitofobs village , projectfolder("C:\DropBox\ProjectABC")} - -{pstd}Then we need to create the rounds used for the midline round for both - households and for villages. Since this is separate data collection (although - they might happen at the same time). We create those folders like this: - -{pmore}{inp:iefolder new round midline {space 6}, projectfolder("C:\DropBox\ProjectABC") abbreviation("ML")}{break} -{inp:iefolder new round midlineVillage, projectfolder("C:\DropBox\ProjectABC") abbreviation("MLvill")} - -{pstd}Finally, in the last round of data collection, we are only collecting data - on households again. Since we are not collecting data on any new unit - of observation, we do not need to create any new master folder. - -{pmore}{inp:iefolder new round endline , projectfolder("C:\DropBox\ProjectABC") abbreviation("EL")} - -{title:Acknowledgements} - -{phang}I would like to acknowledge the help in testing and proofreading I received in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Guadalupe Bedoya{break}Laura Costica{break}Luiza Cardoso De Andrade{break}Mrijan Rimal{break}Sakina Shibuya{break}Seungmin Lee - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iefolder" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iegitaddmd.sthlp b/src/help_files/iegitaddmd.sthlp deleted file mode 100644 index bfc2a21f..00000000 --- a/src/help_files/iegitaddmd.sthlp +++ /dev/null @@ -1,130 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iegitaddmd} -{hline} - -{title:Title} - -{cmd:iegitaddmd} {hline 2} Creates a placeholder file in subfolders of a GitHub repository folder, which allows committing folder structures with empty folders. - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iegitaddmd":DIME Wiki}. - -{title:Syntax} - -{phang} {cmdab:iegitaddmd} , {opt folder(full_file_path)} [{opt comparefolder(full_file_path)} {cmd:customfile(}{it:{help filename}}{cmd:)} {opt all} {opt skip} {opt replace} {opt skipfolders(folder_name)} {opt auto:matic} {opt dry:run}] - -{marker opts}{...} -{synoptset 28}{...} -{synopthdr:options} -{synoptline} -{synopt :{opt folder(full_file_path)}}Specifies the folder path to the project folder clone where placeholder files will be created{p_end} -{synopt :{opt comparefolder(full_file_path)}}Specifies the top folder of a folder tree to be compared with {opt folder()}{p_end} -{synopt :{cmd:customfile(}{it:{help filename}}{cmd:)}}Specifies a file saved on disk that is used instead of the default file as placeholder{p_end} -{synopt :{cmd:all}}Creates the placeholder file in every subfolder of {opt folder()}, whether empty or not{p_end} -{synopt :{opt skip}}If option {opt all} is used and a folder has a file with same name as placeholder file, then nothing is done{p_end} -{synopt :{opt replace}}If option {opt all} is used and a folder has a file with same name as placeholder file, then the file is overwritten{p_end} -{synopt :{opt skipfolders(folder_name)}}List of folders to be skipped. The folder {it:.git} is always added to this list, even when option is not used{p_end} -{synopt :{opt auto:matic}}Makes the command create placeholder files without prompting the user for each file{p_end} -{synopt :{opt dry:run}}Makes the command list all the files that would have been created without this option.{p_end} -{synoptline} - -{marker desc} -{title:Description} - -{pstd}GitHub does not sync empty folders, or folder that only contain ignored files. However, it is common in research projects that these types of folders needs to be shared anyways. {cmd:iegitaddmd} provides a solution to this by creating placeholder files in in these folders. This placeholder file can then be shared to GitHub and that way the folder is also shared. {cmd:iegitaddmd} have two ways to identify which those folders are that are developed with the two use cases described below in mind.{p_end} - -{pstd}{bf:Use case 1.} It is common in the beginning of a research project that a standardized folder structure is set up (for example with {help iefolder}) where some folders are created that are not yet needed. Examples of folders like that could be the output folders. If these folders are not shared at the time they are created, there is a risk that different team members name them differently which will be confusing and could lead to errors. {cmd:iegitaddmd} can solve this by scanning a folder and all its sub-folders for completely empty folders, and create a placeholder file in that folder.{p_end} - -{pstd}The solution to use case 1 in {cmd:iegitaddmd} is a Stata adaptation of {it:Solution B} in {browse "http://bytefreaks.net/gnulinux/bash/how-to-add-automatically-all-empty-folders-in-git-repository" :this post}.{p_end} - -{pstd}{bf:Use case 2.} A common method when transferring an already ongoing research project to GitHub is to copy all of the data work folder from wherever the files and folders where shared before (for example DropBox) to a clone of the repository. Then only the files that are meant to be shared on GitHub are uploaded to the cloud using a {it:.gitignore file}. Empty folders or folders where all files are ignored is then not shared through GitHub. {cmd:iegitaddmd} can solve this by scanning the DropBox folder (or wherever the project folder was shared before) for sub-folders that exist in that folder but not in the clone and crate that folder in the clone and put a placeholder in it.{p_end} - -{pstd}The way you differentiate between these two use cases when using {cmd:iegitaddmd} is whether the option {opt comparefolder()} is used or not. If that option is used, then {cmd:iegitaddmd} will identify all folders that are in {opt comparefolder()} that is not in {opt folder()}, and create a placeholder file there. If {opt comparefolder()} is not used, then {cmd:iegitaddmd} will identify all completely empty folders (no files or subfolders) and create a placeholder file there.{p_end} - -{pstd}The default placeholder file used if no file is specified using option {opt customfile()} is called README.md, which is a name and format recognized by GitHub.com so that the content of the file is displayed on GitHub.com when navigating to that folder using a browser. The placeholder file may be removed as soon as files that are not ignored have been added to the folder, or even better is to keep the file but edit the content of it so it documents the content of that folder for other and future team members.{p_end} - -{marker optslong} -{title:Options} - -{phang}{opt folder(file_path)} is the folder path to the project folder clone where the placeholder files will be created. Unless option {opt comparefolder()} or {opt all} is used, then placeholder files will be created in all empty folders. See option {opt manual} for a way to manually confirm each folder before a placeholder file is created in it.{p_end} - -{phang}{opt comparefolder(file_path)} is used to compare a file tree in a different location and create the folders with placeholder files in all folders that exist in {opt comparefolder()} but not in {opt folder()}. If a folder that does no exist in {opt folder()} has a subfolder, then both the folder and the subfolder will be created and the placeholder file is only crated in the sub-folder. This is enough to share both folder and the subfolder in GitHub. If the {opt comparefolder()} and {opt folder()} ends with folders with different names, for example {opt folder(${project}/datawork/baseline)} and {opt comparefolder(${project}/datawork)}, then the command will throw an error as it is likely that the paths do not point to corresponding folders in the two folder trees. See option {opt manual} for a way to manually confirm each folder before a placeholder file is created in it.{p_end} - -{phang}{cmd:customfile(}{it:{help filename}}{cmd:)} allows the user to specify a file saved on - the computer to be used as the placeholder file instead of the default README.md file. This - allows people and organizations to write their own template placeholder files according to their own - preferences. We recommend that a file of type .md (markdown) and name README.md is used as - GitHub.com recognizes this name and format and will display the content of the file when someone - browse to that folder on GitHub.com. But this is not a technical requirement, any file type - and name can be used as placeholder file.{p_end} - -{phang}{opt all} creates the placeholder file in {opt folder()} and in every subfolder, - regardless if they are empty or not. This allows the user to create a placeholder file in every - folder that can be edited with documentation and instructions to the purpose and usage of - each subfolder. This option can also be important when .{it:gitignore} is used, as {cmd:iegitaddmd} will not - create files to subfolders that only has ignored file -- in which case the folder will not - be synced by GitHub.{p_end} - -{phang}{opt skip} and {opt replace} tells {cmd:iegitaddmd} what to do if the option {opt all} is used - and if any of the folders contain a file with the same name as the placeholder file the command - is trying to create. If a file with the same name as the placeholder file exist and neither of these options - are used, then the command will throw an error. If {opt skip} is used, then nothing is done in the - folder where the file with the same name exists and the command proceeds to the next folder. - If {opt replace} is used then the file with the same name is overwritten with the new placeholder - file before the command proceeds to the next folder.{p_end} - -{phang}{opt skipfolders(folder_name)} can be used to tell {cmd:iegitaddmd} which folders -in which a placeholder file should never be created. The best example of this is the {it:.git} -folder in which placeholders never should be created. That name is always skipped regardless of -this option being used or not. Use this option to list additional folders to be skipped. You -should not list the full folder path in this option, just the folder name. All folders with -that name will be skipped regardless of their location in the project folder. -Any sub-folder of these folders will also be skipped. The folder names may -be listed with or without quotation marks as long as there are no spaces in the names. If any of -the folder names has spaces, then quotation marks must be used for all folder names. - -{phang}{opt auto:matic} can be used to speed up the creation of placeholders by telling the -command to not prompt the users for confirmation for each file before it is created. The -default is that the command is asking the user before creating each place holder file. -This option should only be used when you are confident you have specified the correct folder -paths. We recommend that you use the {opt dryrun} with this option to make sure that the -folder paths are correct.{p_end} - -{phang}{opt dry:run} can be used to safely test that the folder paths are specified correctly -before any placeholder files are created. When this option it used the command simply lists -the file that would have been created if this option were not used. Once you are confident -that list is correct, you can remove this option and re-run the command and the files will -be created.{p_end} - -{title:Example} - -{pstd}{inp:global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectA"}{break}{inp:iegitaddmd , folder({it:"$github_folder"})}{p_end} - -{pstd}In the example above, there is a GitHub repository in the folder ProjectA. This - repository has a folder structure where some folders are still empty but will later - be populated with files. In order to have all folders, even the empty ones, synced on all - collaborators' cloned local copies of the repository, the folders need to contain at least - one file, which is being created by the command.{p_end} - -{pstd}{inp:global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectB"}{break}{inp:iegitaddmd , folder({it:"$github_folder"}) skipfolders("foo" "bar")}{p_end} - -{pstd}In the example above, there is a GitHub repository in the folder ProjectB. This -is a project similar to ProjectA above but it has to folder, called {inp:foo} and {inp:bar} -in which no placeholder files should ever be created in. Any subfolders in {inp:foo} -or {inp:bar} will be skipped as well. The folder {inp:.git} is a system folder in git -repositories and will always be skipped.{p_end} - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Author: DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iegitaddmd" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iegraph.sthlp b/src/help_files/iegraph.sthlp deleted file mode 100644 index 8be88d3e..00000000 --- a/src/help_files/iegraph.sthlp +++ /dev/null @@ -1,266 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iegraph} -{hline} - -{title:Title} - -{phang2}{cmdab:iegraph} {hline 2} Generates graphs based on regressions with treatment dummies common in impact evaluations. - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iegraph":DIME Wiki}. - -{title:Syntax} - -{phang2} -{cmdab:iegraph} {varlist} -, [ -{cmdab:basicti:tle(}{it:string}{cmd:)} -{cmdab:varl:abels} -{cmdab:save(}{it:string}{cmd:)} -{cmdab:gray:scale} -{cmdab:yzero} -{cmdab:barl:abel} -{cmdab:mlabc:olor:(}{it:{help colorstyle:colorname}}{cmd:)} -{cmdab:mlabp:osition:(}{it:{help clockposstyle:clockpos}}{cmd:)} -{cmdab:mlabs:ize:(}{it:{help textsizestyle:size}}{cmd:)} -{cmd:barlabelformat} -{cmd:noconfbars} -{cmdab:confbarsnone(}{it:varlist}{cmd:)} -{cmdab:confintval(}{it:numlist}{cmd:)} -{cmd:norestore} -{cmdab:baropt:ions(}{it:string}{cmd:)} -{cmdab:ignoredummytest} -{it:{help scatter##twoway_options:twoway_scatter_options}} -] - -{marker opts}{...} -{synoptset 22}{...} -{synopthdr:options} -{synoptline} -{synopt :{cmdab:basicti:tle(}{it:string}{cmd:)}} Manually sets the title of the graph.{p_end} -{synopt :{cmdab:varl:abels}} Uses variable labels for legends instead of variable names.{p_end} -{synopt :{cmdab:save(}{it:string}{cmd:)}} Sets the filename and the directory to which the graph will be set/exported.{p_end} -{synopt :{cmdab:gray:scale}} Uses grayscales for the bars instead of colors.{p_end} -{synopt :{cmdab:yzero}} Forces y-axis on the graph to start at 0.{p_end} -{synopt :{cmdab:barl:abel}} Adds a label on top of the bars with their respective values.{p_end} -{synopt :{opth barc:olors(colornames)}} Manually set the colors of the bars.{p_end} -{synopt :{cmdab:mlabc:olor:(}{it:{help colorstyle:colorname}}{cmd:)}} Set color of bar label.{p_end} -{synopt :{cmdab:mlabp:osition:(}{it:{help clockposstyle:clockpos}}{cmd:)}} Set position of bar label.{p_end} -{synopt :{cmdab:mlabs:ize:(}{it:{help textsizestyle:size}}{cmd:)}} Set font size of bar label.{p_end} -{synopt :{cmd:barlabelformat}} Customizes format of bar label. Must be used with {it:barlabel}.{p_end} -{synopt :{cmd:noconfbars}} Removes the confidence interval bars from graphs for all treatments.{p_end} -{synopt :{cmdab:confbarsnone(}{it:varlist}{cmd:)}} Removes confidence interval bars from only the {it:varlist} listed.{p_end} -{synopt :{cmdab:confintval(}{it:numlist}{cmd:)}} Sets the confidence interval for the confidence interval bars. Default is .95.{p_end} -{synopt :{cmd:norestore}} Allows you to debug your two way graph settings on the data set prepared by iegraph. To be used with {it:r(cmd)}.{p_end} -{synopt :{cmdab:baropt:ions(}{it:string}{cmd:)}} Allows you to add formatting to the bars.{p_end} -{synopt :{cmdab:ignoredummytest}} Ignores the tests that tests if the dummies fits one of the two models below.{p_end} -{synoptline} - -{pstd}Any twoway graph scatter options that can be used with normal twoway graph scatter commands can - also be used. If any of these commands conflict with any of the built in options, - then the user specified settings have precedence. See example 2 for details.{p_end} - -{marker desc} -{title:Description} - -{pstd}{cmdab:iegraph} This command creates bar graphs on the basis of the coefficients - of treatment dummies in regression results. This command is developed for reading - stored results from two types of impact evaluation regression models, but there - are countless of other examples where the command also can be used. {cmd:iegraph} must - be used immediately after running the regression or as long as the regression result is - still stored in or restored to Stata's {help ereturn} results. - -{pstd}{bf:Model 1: OLS with Treatment Dummies}{break}The most typical impact evaluation regression is - to have the outcome variable as the dependent variable and one dummy for each - treatment arm where control is the omitted category. These regressions can also include - covariates, fixed effects etc., but as long as the treatment status is defined by - mutually exclusive dummy variables. See especially examples 1 and 2 below. This command - works with any number of treatment arms but works best from two arms (treatment - and control) to five treatment arms (4 different treatments and control). More - arms than that may result in a still correct but perhaps cluttered graph. - -{pstd}{bf:Model 2: Difference-in-Differences}{break}Another typical regression model in impact - evaluations are difference-in-difference (Diff-in-Diff) models with two treatment arms (treatment - and control) and two time periods. If the Diff-in-Diff regression is specified as having the - outcome variable as the dependent variable and three dummy variables (time, treatment - and time*treatment) as the independent variables, then this command will produce a nice - graph. Controls, treatment effects etc. may be added to the regression model. See especially example 3. - -{pstd}{bf:Graph Output}{break}The graph generated by this command is created using the following values. The - control bar is the mean of the outcome variable for the control group. It is not - the constant from the regression as those are not identical if, for example, fixed effects - and covariates were used. For each treatment group the bar is the sum of the value - of the control bar and the beta coefficient in the regression of the corresponding - treatment dummy. The confidence intervals are calculated from the variance in the - beta coefficients in the regression.{p_end} - -{pstd}The graph also includes the N for each treatment arm in the regression and uses - that value as labels on the x-axis. Stars are added to this value if the corresponding - coefficient is statistically different from zero in the regression{p_end} - -{marker optslong} -{title:Options} - -{phang}{cmdab:basicti:tle(}{it:string}{cmd:)} Manually sets the title of the graph. To - apply formatting like title size, position, etc., use Stata's built - in {help title_options:title() option} instead.{p_end} - -{phang}{cmdab:varl:abels} Sets the legends to the variable labels for the - variables instead of the variable names.{p_end} - -{phang}{cmdab:save(}{it:string}{cmd:)} Sets the filename and the directory to which - the graph will be set. If the filename ends with no extension or '.gph', it will be - saved in the graph format. Extensions(png, pdf, tif, wmf, emf, ps, and eps) will be exported. - wmf and emf are only available for the Windows version of Stata. Png and Tif for all - versions of Stata except Console.{p_end} - -{phang}{cmdab:gray:scale} Uses grayscale for the bars instead of colors. The color - of the control bar will be black and the treatment bar will run in equal shade - differences from light grey to dark grey.{p_end} - -{phang}{cmdab:yzero} Manually sets the y-axis of the graph to start at zero - instead of the Stata default. In many cases, we expect that neither the default - settings nor this option will make the axes look perfect, but you may use Stata's built - in {help axis_option:axis options} that allow you to set the axes to perfectly fit - your data. The command will ignore the {cmdab:yzero} option in cases where the graph cannot - be forced to zero i.e. where the values in the graph extend beyond zero, both positively - or negatively. A warning will be displayed telling the user that the option has - been ignored. Despite the warning, the graph will be produced correctly.{p_end} - -{phang}{cmdab:barl:abel} Adds a label on top of the bars with their respective values. Equivalent - to specifying option {help help blabel_option:blabel(bar)} in a - {help graph_bar: bar graph}. {p_end} - -{phang}{opt barc:olors(string)} manually sets the colors of the bars. -All color names listed in {help colorstyle} are allowed. -If there are more groups than colors listed, -then the list of colors will be repeated. -If color codes such as {it:"255 255 191"} is used, -then the string must use compounded quotes {inp: `""'}. -For example: {opt barcolors(`" red "215 25 28" gs14 "')}.{p_end} - -{phang}{cmdab:mlabc:olor:(}{it:{help colorstyle:colorname}}{cmd:)} -Set color of bar label. May only be used with {it:barlabel}.{p_end} - -{phang}{cmdab:mlabp:osition:(}{it:{help clockposstyle:clockpos}}{cmd:)} -Set position of bar label. May only be used with {it:barlabel}.{p_end} - -{phang}{cmdab:mlabs:ize:(}{it:{help textsizestyle:size}}{cmd:)} -Set font size of bar label. May only be used with {it:barlabel}.{p_end} - -{phang}{cmd:barlabelformat} Customize barlabel format. Must be used with {it:barlabel}. -Options allowed have the formats %#.#f or %#.#e. -Default if %9.1f. See {help format} for more information. {p_end} - -{phang}{cmd:noconfbars} Removes the confidence interval bars from graphs for all - treatments. The default value for the confidence interval bars is 95%. {p_end} - -{phang}{cmdab:confbarsnone(}{it:varlist}{cmd:)} Removes confidence interval bars - from only the {it:varlist} listed. The remaining variables in the graphs which - have not been specified in {cmdab:confbarsnone} will still have the confidence - interval bars. {p_end} - -{phang}{cmdab:confintval(}{it:numlist}{cmd:)} Sets the confidence interval for - the confidence interval bars. Default is .95. Values between 0 and 1 are allowed.{p_end} - -{phang}{cmdab:norestore} Returns the data set that iegraph prepares to create - the graph. This is helpful when de-bugging how one of Stata's many graph - options can be applied to an iegraph graph. This option is meant to be - used in combination with the {help return:returned result} in {it:r(cmd)}. {it:r(cmd)} - gives you the line of code iegraph prepares to create the graph and {cmdab:norestore} gives you - access to the data that code is meant to be used on. This approach will help - you de-bug how to apply Stata's built in graph options to an iegraph graph. - Note that this option deletes any unsaved changes made to your data.{p_end} - -{phang}{cmdab:baropt:ions(}{it:string}{cmd:)} Allows you to add formatting - option that are applied to each bar and not the graph itself. Example of - such option are {help twoway_bar} options and {help axis_options} options. - It is not possible to use this option to add formatting to individual bars. - Everything added in this option is added to all bars. - Formatting added in this option takes precedence over - any default formatting or formatting set in any other option.{p_end} - -{phang}{cmd:ignoredummytest} Ignores the tests that test if the dummies fits one - of the two models this command is intended for. The two models are described - in detail above above. There might be models we have not thought of for which - this command is helpful as well. Use this option to lift the restrictions of - those two models. But be careful, this command has not been tested for other - models than the two described.{p_end} - -{marker optslong} -{title:Examples} - -{pstd} {hi:Example 1.} - -{pmore} {inp:regress} {it:outcomevar treatment_dummy}{break} - {inp:iegraph} {it:treatment_dummy} , {inp:basictitle({it:"Treatment Effect on Outcome"})} - -{pmore}In the example above, there are only two treatment arms (treatment and - control). {it:treatment_dummy} has a 1 for all treatment observations and - a 0 for all control observations. The graph will have one bar for control and - it shows the mean for {it:outcomevar} for all observations in control. The - second bar in the graph will be the sum of that mean and the coefficient - for {it:treatment_dummy} in the regression. The graph will also have the - title: Treatment Effect on Outcome. - -{pstd} {hi:Example 2.} - -{pmore} {inp:regress} {it:income tmt_1 tmt_2 age education}{inp:, cluster(}{it:district}{inp:)}{break} - {inp:iegraph} {it:tmt_1 tmt_2}{inp:, noconfbars yzero basictitle({it:"Treatment effect on income"}) } - -{pmore}In the example above, the treatment effect on income in researched. There - are three treatment arms; control, treatment 1 ({it:tmt_1}) and treatment - 2 ({it:tmt_2}). It is important that no observation has the value 1 in - both {it:tmt_1} and {it:tmt_2} (i.e. no observation is in more than one - treatment) and some observations must have the value 0 in both {it:tmt_1} - and {it:tmt_2} (i.e. control observations). The variables {it:age} and - {it:education} are covariates (control variables) and are not included - in {cmd:iegraph}. {inp:noconfbars} omits the confidence interval bars - , and {inp:yzero} sets the y-axis to start at 0. - -{pstd} {hi:Example 3.} - -{pmore} {inp:regress} {it:chld_wght time treat timeXtreat}{break} - {inp:iegraph} {it:time treat timeXtreat} {inp:, basictitle({it:"Treatment effect on Child Weight (Diff-in-Diff)"})} - -{pmore}In the example above, the data set is a panel data set with two time - periods and the regression estimates the treatment effect on child weight - using a Difference-in-Differences model. - The dummy variable {it:time} indicates if it is time period 0 or 1. - The dummy variable {it:treat} indicates if the observation is treatment - or control. {it:timeXtreat} is the interaction term of {it:time} - and {it:treat}. This the standard way to set up a Difference-in-Differences - regression model. - -{pstd} {hi:Example 4.} - -{pmore} {inp:regress} {it:harvest T1 T2 T3 } {break} - {inp:iegraph} {it:T1 T2 T3} {inp:, basictitle({it:"Treatment effect on harvest"})} - xlabel(,angle(45)) yzero ylabel(minmax) save({it:"Graph1.gph"})} - -{pmore}The example above shows how to save a graph to disk. It also shows that - most two-way graph options can be used. In this example the {cmd:iegraph} - option {cdm:yzero} conflicts with the two-way option {cmd:ylabel(minmax)}. - In such a case the user specified option takes precedence over {cmd:iegraph} - options like {cdm:yzero}. - - -{title:Acknowledgements} - -{phang}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Michael Orevba{break}Ahmad Zia Wahdat{break} - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, Mrijan Rimal, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iegraph" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iekdensity.sthlp b/src/help_files/iekdensity.sthlp deleted file mode 100644 index 5725be66..00000000 --- a/src/help_files/iekdensity.sthlp +++ /dev/null @@ -1,188 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iekdensity} -{hline} - -{title:Title} - -{phang2}{cmd:iekdensity} {hline 2} This command plots univariate kernel density estimates by treatment assignment. - -{* {phang2}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/wiki/Iekdensity":DIME Wiki}.} - -{title:Syntax} - - {phang2} {cmd:iekdensity} {it:yvar} [{help if}] [{help in}] [{help weight}], - {opt by(treatmentvar)} - {break}[ - {opt stat(string)} - {opt statstyle(string)} - {opt effect} - {cmdab:control(}{it:{help numlist:numlist}}{cmd:)} - {cmdab:effectformat(}{it:{help format:%fmt}}{cmd:)} - {opt abs:orb(varname)} - {opt reg:ressionoptions(string)} - {opt kdensity:options(string)} - {opt color(string)} - {it:{help twoway_options}} - ] - - {pmore}Where {it:yvar} is a numeric continuous outcome variable, whose distribution is to be plotted by treatment assignment.{p_end} - - -{marker opts}{...} -{synoptset 24}{...} -{synopthdr:options} -{synoptline} - -{pstd}{it:Required options:}{p_end} - {synopt :{opt by(treatmentvar)}}Treatment (dummy or factor) variable.{p_end} - -{pstd}{it:Content options:}{p_end} - {synopt :{opt stat(string)}}Add vertical lines for each treatment group with statistic specified.{p_end} - {synopt :{opt statstyle(string)}}Specify graphic style of statistic lines.{p_end} - {synopt :{opt effect}}Add note with treatment effect, containing point estimate, standard error, and p-value.{p_end} - {synopt :{cmdab:control(}{it:{help numlist:numlist}}{cmd:)}}Specify value of variable for control group.{p_end} - {synopt :{cmdab:effectformat(}{it:{help format:%fmt}}{cmd:)}}Specify format of point estimate and standard error of the treatment effect.{p_end} - -{pstd}{it:Estimation options:}{p_end} - {synopt :{opt abs:orb(varname)}}Specify fixed effects variable, if any.{p_end} - {synopt :{opt reg:ressionoptions(string)}}Specify regression options.{p_end} - {synopt :{opt kdensity:options(string)}}Specify kernel estimation options.{p_end} - -{pstd}{it:Graphic options:}{p_end} - {synopt :{opt color(string)}}Specify colors for each group.{p_end} - {synopt :{help twoway_options}}Specify graph options.{p_end} - -{synoptline} - -{marker desc} -{title:Description} - - {pstd}{cmd:iekdensity} is a command that allows to easily plot the distribution of a variable by treatment group. - It also allows to include additional information, such as descriptive statistics and treatment effect(s).{p_end} - -{marker optslong} -{title:Options} - - {pstd}{it:{ul:{hi:Required options:}}}{p_end} - {phang}{opt by(treatmentvar)} indicates which variable should be used to idenfity the treatment assignment. This can be a dummy variable (0/1) or a factor variable, when there are multiple treatments.{p_end} - - {pstd}{it:{ul:{hi:Content options:}}}{p_end} - {phang}{opt stat(string)} specifies a descriptive statitistic to be plotted over the kernel density graph. In particular, vertical lines for each treatment group are added. Accepted statistics are: {it:mean}, {it:p1}, {it:p5}, {it:p10}, {it:p25}, {it:p50}, {it:p75}, {it:p90}, {it:p95}, {it:p99}, {it:min} and {it:max}.{p_end} - - {phang}{opt statstyle(string)} specifies the graphic style to be used for the statistic lines. Namely, you will be able to use {cmdab:lpattern(}{help linepatternstyle}{cmdab:)} and {cmdab:lwidth(}{help linewidthstyle}{cmdab:)} options. Colors are instead controlled by option {opt color(string)}.{p_end} - - {phang}{opt effect} adds a note with treatment effect, containing point estimate, standard error, and p-value, to the graph.{p_end} - - {phang}{cmdab:control(}{it:{help numlist:numlist}}{cmd:)} indicates which value the variable {opt by(treatmentvar)} takes for the control group. This is usually equal to 0 when the treatment is binary, but may vary when dealing with multiple treatment arms.{p_end} - - {phang}{cmdab:effectformat(}{it:{help format:%fmt}}{cmd:)} specify the format in which treatment effect point estimate and standard error should be displayed in the graph note.{p_end} - - {pstd}{it:{ul:{hi:Estimation options:}}}{p_end} - - {phang}{opt abs:orb(varname)} indicates the fixed effects variable (for example, the experimental strata when the treatment was stratified) to be included in the estimation. This variable must be numerical.{p_end} - - {phang}{opt reg:ressionoptions(string)} indicates other options to be employed for the treatment effect estimations, for example suppress constant term ({opt nocons:tant}) or clustered standard errors ({opt cl:uster(varname)}). All options accepted by {help regress} (or {help areg} when option {opt absorb()} is specified) are accepted.{p_end} - - {phang}{opt kdensity:options(string)} specifies kernel estimation options, such as kernel function and half-width of kernel. The default kernel function is {opt kernel(epanechnikov)}. Many options accepted by {help kdensity} are allowed (namely, {cmdab:kernel(}{help kdensity##kernel:kernel}{cmdab:)}, {opt bwidth(#)}, {opt n(#)}, and all the {help cline_options} for univariate kernel density estimation.{p_end} - - {pstd}{it:{ul:{hi:Graphic options:}}}{p_end} - - {phang}{opt color(string)} indicates the colors to be used for each treatment arm. The colors should come in the order of the values in {opt by(treatmentvar)}. For instance, if the treatment is binary, you can set the line colors by typing {opt color(color1 color2)}. See {help colorstyle}. {p_end} - - {phang}{it:{help twoway_options}} indicates other options to be applied to the graph, such as additional text and lines, changes axes, titles, and legend, etc.{p_end} - -{marker optslong} -{title:Examples} - - {pstd}All the examples below can be run on the Stata's built in automobile data set, by first running this code:{p_end} - - {pstd}* Open the built in data set{p_end} - {pstd}{inp:sysuse auto}{p_end} - - {pstd}* Randomly assign time and treatment dummies{p_end} - {pstd}{inp:gen treatment = (runiform() < .5)}{p_end} - - {pstd} {hi:Example 1.} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} - - {pstd} This is the most basic way to run this command. This will output a graph with the distributions of of the variable of interests ({it:price} in this case) by treatment assignment. - - {pstd} {hi:Example 2.} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by((}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} - - {pstd} This is an easy way to add descriptive information to the graph. This will output the same graph as above with the addition of two vertical lines for the medians of the control and treatment groups. - - {pstd} {hi:Example 2.1} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:statstyle(}lpattern(dash) lwithd(2){inp:)} - - {pstd} This changes the style of the median vertical lines. - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:statstyle(}lpattern(dash) lwithd(2){inp:)} - - {pstd} {hi:Example 2.2} - - {pstd} This sets the colors of the control and treatment lines to different shades of blue. - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:statstyle(}lpattern(dash) lwithd(2){inp:)} {inp:color(}eltblue edkblue{inp:)} - - {pstd} {hi:Example 2.3} - - {pstd} This changes some of the graphical options. - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:statstyle(}lpattern(dash) lwithd(2){inp:)} {inp:title(}auto distribution{inp:)} {inp:subtitle(}By Treatment Assignment{inp:)} {inp:ylab(}, angle(horizontal){inp:)} {inp:graphregion(}color(white){inp:)} {inp:plotregion(}color(white){inp:)} - - {pstd} {hi:Example 3.} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:effect} - - {pstd} This adds a note to the graph, displaying the treatment effect in terms of point estimate, standard error and statistical significance. - - {pstd} {hi:Example 3.1} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:stat(}{it:p50}{inp:)} {inp:effect} {inp:effectformat(}%9.0fc{inp:)} - - {pstd} This changes the format of the treatment effect in the note. The point estimate and the standard error now do not include any decimal points. - - - {pstd} {hi:Example 4.1} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:effect} {inp:absorb(}{it:foreign}{inp:)} - - {pstd} The treatment effect is now derived from a regression controlling for the variable {it:foreign} fixed effects. - - {pstd} {hi:Example 4.2} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:effect} {inp:absorb(}{it:foreign}{inp:)} {inp:regressionoptions(}{it:cluster(foreign)}{inp:)} - - {pstd} The treatment effect is now derived from a regression controlling for the variable {it:foreign} fixed effects and clustering standard errors at {it:foreign} level. - - {pstd} {hi:Example 5} - - {pstd} {inp:iekdensity} {it:auto} , {inp:by(}{it:treatment}{inp:)} {inp:kdensityoptions(}epan2 bwidth(5){inp:)} - - {pstd} The kernel density is estimated through the alternative Epanechnikov kernel function and half-width of the kernel is specified to be equal to 5. - -{title:Acknowledgements} - - {phang}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order):{p_end} - {pmore}Luiza Andrade{break} - -{title:Authors} - - {phang}All commands in ietoolkit are developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations.{p_end} - - {phang}Main author: Matteo Ruzzante, DIME, The World Bank Group.{p_end} - - {phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iekdensity" in the subject line to:{break} - dimeanalytics@worldbank.org{p_end} - - {phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through - the GitHub repository of ietoolkit:{break} - {browse "https://github.com/worldbank/ietoolkit"}{p_end} diff --git a/src/help_files/iematch.sthlp b/src/help_files/iematch.sthlp deleted file mode 100644 index 622624a8..00000000 --- a/src/help_files/iematch.sthlp +++ /dev/null @@ -1,286 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iematch} -{hline} - -{title:Title} - -{phang2}{cmdab:iematch} {hline 2} Matching base observations towards target observations using on a single continous variable. - -{phang2}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Iematch":DIME Wiki}. - -{title:Syntax} - -{phang2} -{cmdab:iematch} {ifin} -, {cmdab:grp:dummy(}{it:varname}{cmd:)} {cmdab:match:var(}{it:varname}{cmd:)} -[{cmdab:id:var(}{it:varname}{cmd:)} {cmdab:m1} {cmdab:maxdiff(}{it:numlist}{cmd:)} {cmd:seedok} -{cmdab:matchid:name(}{it:string}{cmd:)} {cmdab:matchdi:ffname(}{it:string}{cmd:)} -{cmdab:matchre:sultname(}{it:string}{cmd:)} {cmdab:matchco:untname(}{it:string}{cmd:)} -{cmdab:replace}] - -{marker opts}{...} -{synoptset 22}{...} -{synopthdr:options} -{synoptline} -{synopt :{cmdab:grp:dummy(}{it:varname}{cmd:)}}The group dummy variable where 1 - indicates base observations and 0 target observations{p_end} -{synopt :{cmdab:match:var(}{it:varname}{cmd:)}}The variable with a continous value - to match on{p_end} -{synopt :{cmdab:id:var(}{it:varname}{cmd:)}}The uniquely and fully identifying ID - variable. Used to indicate which target observation a base observation is match - with. If omitted an ID variable will be created. See below if you have multiple ID vars.{p_end} -{synopt :{cmdab:maxdiff(}{it:numlist}{cmd:)}}Set a maximum difference allowed in - {cmdab:matchvar()}. If a base observation has no match within this difference - then it will remain unmatched{p_end} -{synopt :{cmdab:m1}}Allows many-to-one matches. The default is to allow only - one-to-one matches. See the {help iematch##desc:description} section.{p_end} -{synopt :{cmdab:maxmatch(}{it:integer}{cmd:)}}Sets the maximum number of base - observations that each target observation is allowed to match with in a {cmd:m1} - (many-to-one) match.{p_end} -{synopt :{cmd:seedok}}Supresses the error message thrown when there are duplicates - in {cmd:matchvar()}. When there are duplicates, the seed needs to be set in order - to have a replicable match. The {help seed} should be set before this command.{p_end} -{synopt :{cmdab:matchre:sultname(}{it:string}{cmd:)}}Manually sets the name of - the variable that indicates if an observation was matched, or provide a reason why - it was not. The default is _matchResult{p_end} -{synopt :{cmdab:matchid:name(}{it:string}{cmd:)}}Manually sets the name of the - variable that indicates which target observation each base observation is - matched with. The default is _matchID{p_end} -{synopt :{cmdab:matchdi:ffname(}{it:string}{cmd:)}}Manually sets the name of the - variable that indicates the differnece in {cmdab:matchvar()} in each match - pair/group. The default is _matchDiff{p_end} -{synopt :{cmdab:matchco:untname(}{it:string}{cmd:)}}Manually sets the name of the - variable that indicates how many observations a target observation is matched - with in a many-to-one matches. The default is _matchCount{p_end} -{synopt :{cmd:replace}}Replaces variables in memory if there are name conflicts - when generating the output variables.{p_end} -{synoptline} - -{marker desc} -{title:Description} - -{pstd}{cmdab:iematch} matches base observations towards target observations in terms - of nearest value in {cmd:matchvar()}. Base observations are observations with - value 1 in {cmd:grpdummy()} and target observations are observations with value - 0. For example, in a typical p-score match, base observations are treatment and - target is control, however, there are many other examples of matching where it could - be different. - -{pstd}{cmdab:iematch} bases its matching algorithm on the Stable Marriage algorithm. - This algorithm was chosen because it always provides a solution and allows stable - matching even if multiple observations have identical match - values (see {cmd:seed()} option for more details). One disadvantage of this - algorithm is that it takes into account local efficiency only, and not global efficiency. This - means that it is possible that other matching algorithms might generate a more - efficient match in terms of the sum of the difference of all matched pairs/groups. - -{pstd}{hi:{ul:One-to-one matching algorithm}}{break} - The algorithm used in a one-to-one match starts by evaluating which - target observation each base observation is closest to and vice versa for each - target observations. If a base and target observation pair mutually prefer - each other, then these two observations are matched. The algorithm then repeats - the initial two evaluation steps, and excludes observations after they are matched, - until all base observations are either matched or excluded due to the option {cmdab:maxdiff()}. - Matched observations ends up in pairs of exactly one base observation and one - target observation. - -{pstd}In a one-to-one match, there has to be at least as many target observations - as there are base observations. A one-to-one match returns three variables. One - variable indicates the result of the matching for each observation, such as, - matched, not matched, no match within the max difference, etc. The other two variables - hold information on the matched pair. One variable is the ID of the target observation - in the matched pair, and the other variable is the difference in {cmd:matchvar()} - between the two observations in the match pair. See the below in this section - for more details on the variables generated. - -{pstd}{hi:{ul:Many-to-one matching algorithm}}{break} - The algorithm used for many-to-one matching is the same as in a one-to-one match. But instead - of matching only when there is a mutual preference, all base observations are - matched towards their preferred target observation in the first step, as long - as the match is within the max-value if {cmdab:maxdff()} is used. Matched observations - end up in groups in which there is exactly one target observation but where there are - either one or several base observations. - -{pstd}In a many-to-one match, there is no restriction in terms of the number of - base observations in relation to target observations. The many-to-one matching - yields four variables. Three of the variables are the same as in one-to-one - matching, and only the variable listing the difference The fourth variable indicates how many base observations that were matched - towards each target observation. See the below in this section for more details on - the variables generated. - -{pstd}{hi:{ul:Variables generated}}{break} - This section explains the variables that are generated by this command. All variables - will be referred to by their default names, but those names can be manually set to something - else (see the options for this command). - -{pstd}{hi:_matchResult}{break} - This variable indicates the result of the match for all observations. Observations - that ended up in a match pair/group has the value 1. Target observations not matched have the - value 0. Base observations without a valid match due to {cmdab:maxdff()} are - assigned the value .d. Observations excluded from the match using {inp:if}/{inp:in} are - assigned the value .i. Observations excluded from the match due to missing value in {cmd:grpdummy()} are - assigned the value .g. Observations excluded from the match due to missing value in {cmd:matchvar()} are - assigned the value .m. All values have descriptive value labels. - -{pstd}{hi:_matchID}{break} - This variable indicates the ID of the target observations in each match pair/group. For matched - target observations, the value in _matchID will be equal to the value in the ID - variable. Since the values in the ID variable are unique and there is exactly one target - observation in each matched pair/group, this variable functions as a unique pair/group ID. - In addition to indicating which observations are included in the same pair/group, this - variable can be used to include a pair/group fixed effect in a regression. - -{pstd}{hi:_matchDiff}{break} - This variable indicates the difference in {cmd:matchvar()} between matched base observations - and target observations. In a one-to-one match this value is the identical for - both the base observation and the target observation in each matched pair. - In a many-to-one match, this value is only indicated for base observations. It is - missing for target observations as there are potentially multiple matches, and - subsequently multiple differences. - -{pstd}{hi:_matchCount}{break} - In a many-to-one match, this variable indicates how many base observations were - matched towards each matched target observation. This variable can be used as regression - weights when controlling for the fact that some observations are matched towards multiple - observations. - -{marker optslong} -{title:Options} - -{phang}{cmdab:grp:dummy(}{it:varname}{cmd:)} is the dummy variable that indicates if an observation - is a base or target observation. This variable, must be numeric and is only allowed to have - the values 1, 0 or missing. 1 indicates a base observation, 0 indicates a target observation, - and observations with a missing value will be excluded from the matching. - -{phang}{cmdab:match:var(}{it:varname}{cmd:)} is the variable used to compare observations when - matching. This must be a numeric variable, and it is typically a continuous - variable. Observations with a missing value will be excluded from the matching. - -{phang}{cmdab:id:var(}{it:varname}{cmd:)} indicates the variable that uniquely - and fully identifies the data set. The values in this variable is the values - that will be used in the variable that indicates which target observation each - base observations matched against. If this option is omitted, a variable called - _ID will be generated. The observation in the first row is given the value 1, - the second row value 2 and so fourth. - -{pmore}This command assumes only one ID variable as that is the best practice this command - follows (see next paragraph for the exception of panel data sets). Here follows two - suggested solutions if a data set this command will be used on has more than one ID - variable. {bf:1.} Do not use the {cmd:idvar()} option and after the matching copy the multiple - ID variables yourself. {bf:2.} Combine your ID variables into one ID variable. Here are two - examples on how that can be done (the examples below work just as well when combining more - than two ID variables to one.): - -{pmore2}{inp:egen }{it:new_ID_var }{inp:= group(}{it:old_ID_var1 old_ID_var2}{inp:)} - -{pmore2}{inp:gen}{space 2}{it:new_ID_var }{inp:= }{it:old_ID_var1 }{inp:+ "_" + }{it:old_ID_var2}{space 4}//Works only with string vars - -{pmore}Panel data sets are one of the few cases where multiple ID variables is good practice. However, - in the case of matching it is unlikely that it is correct to include multiple time rounds for - the same observation. That would lead to some base observations being matched to - one target observation in the first round, and one another in the second. In impact - evaluations, matchings are almost exclusively done only on the baseline data. - -{phang}{cmdab:maxdiff(}{it:numlist}{cmd:)} sets a maximum allowed difference between - a base observation and a target observation for a match to be valid. Any base - observation without a valid match within this difference will end up unmatched. - -{phang}{cmdab:m1} sets the match to a many-to-one match (see {help iematch##desc:description}). - This allows multiple base observations to be matched towards a single target observation. - The default is the one-to-one match where a maximum one base observation is matched towards - each target observation. This option allows the number of base observations - to be larger than the number of target observations. - -{phang}{cmdab:maxmatch(}{it:integer}{cmd:)} sets the maximum number of base observations a - target observation is allowed to match with in a {cmd:m1} (many-to-one) match. The integer - in {cmd:maxmatch()} is the maximum number of base observations in group but there is also a - always a target observation in the group, so in a maxed out match group it will be {cmd:maxmatch()} - plus one observations. - -{phang}{cmd:seedok} supresses the error message thrown when there are duplicates among - the base observations or the target observations in {cmd:matchvar()}. When there - are duplicates a random variable is used to distinguish which variable to match. - Setting the seed makes this randomization replicable and thereby making the matching - also replicable. The {help seed} should be set before this command by the user. When the - seed is set, or if replicable matching is not important, then the option {cmd:seedok} can - be used to suppress the error message. Duplicate pairs where one observation is a base - observation and the other is a target observations are allowed. - -{phang}{cmdab:matchre:sultname(}{it:string}{cmd:)} manually sets the - name of the variable that reports the matching result for each observation. - If omitted, the default name is {inp:_matchResult}. The names {inp:_ID}, - {inp:_matchID}, {inp:_matchDiff} and {inp:_matchCount} are not allowed. - -{phang}{cmdab:matchid:name(}{it:string}{cmd:)} manually sets the - name of the variable that list the ID of the target observations in each match pair/group. - If omitted, the default name is {inp:_matchID}. The names {inp:_ID}, {inp:_matchDiff}, {inp:_matchResult} - and {inp:_matchCount} are not allowed. - -{phang}{cmdab:matchdi:ffname(}{it:string}{cmd:)} manually sets the name of the variable - that indicates the difference between the matched base observations - and target observations. If omitted, the default name is {inp:_matchDiff}. The - names {inp:_ID}, {inp:_matchID}, {inp:_matchResult} and {inp:_matchCount} are - not allowed. - -{phang}{cmdab:matchco:untname(}{it:string}{cmd:)} manually sets the - name of the variable that indicates the number of base observations that has - been matched towards each matched matched target observation. This option may - only be used in combination with option {cmd:m1}. If omitted, the default - name is {inp:_matchCount}. The names {inp:_ID}, {inp:_matchID}, {inp:_matchDiff} - and {inp:_matchResult} are not allowed. - -{phang}{cmdab:replace} allows {cmd:iematch} to replace variables in memory when - encountering name conflicts while creating the variables with the results of the matching. - -{title:Examples} - -{pstd} {hi:Example 1.} - -{pmore}{inp:iematch , grpdummy({it:tmt}) matchvar({it:p_hat})} - -{pmore}In the example above, the observations with value 1 in {it:tmt} will be matched - towards the nearest, in terms of {it:p_hat}, observations with value 0 in {it:tmt}. - -{pstd} {hi:Example 2.} - -{pmore}{inp:iematch if {it:baseline} == 1 , grpdummy({it:tmt}) matchvar({it:p_hat}) maxdiff(.001)} - -{pmore}In the example above, the observations with value 1 in {it:tmt} will be matched - towards the nearest, in terms of {it:p_hat}, observations with value 0 in {it:tmt} as - long as the difference in {it:p_hat} is less than .001. Only observations that has the - value 1 in variable {it:baseline} will be included in the match. - -{pstd} {hi:Example 3.} - -{pmore}{inp:iematch , grpdummy({it:tmt}) m1 maxmatch(5) matchvar({it:p_hat}) maxdiff(.001)} - -{pmore}In the example above, the observations with value 1 in {it:tmt} will be matched - towards the nearest, in terms of {it:p_hat}, observations with value 0 in {it:tmt} as - long as the difference in {it:p_hat} is less than .001. So far this example is identical - to example 2. However, in this example each target observation is allowed to match with up - to 5 base observations. Hence, instead of a result with only pairs of exactly one target - observation and one base observation in each pair, the result is instead match groups - with one target observation and up to 5 base observations. If {cmd:maxmatch()} is omitted - any number of base observations may match with each target observation. - -{title:Acknowledgements} - -{phang}I would like to acknowledge the help in testing and proofreading I received in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Luiza Cardoso De Andrade{break}Seungmin Lee{break}Mrijan Rimal{break} - - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit iematch" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/help_files/iesave.sthlp b/src/help_files/iesave.sthlp deleted file mode 100644 index 43fdb5cc..00000000 --- a/src/help_files/iesave.sthlp +++ /dev/null @@ -1,211 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} -{hline} -help for {hi:iesave} -{hline} - -{title:Title} - -{phang2}{cmdab:iesave} {hline 2} applies best practices before saving data, -with option to save meta data report about the data saved. - -{title:Syntax} - -{phang2} -{cmdab:iesave} {help filename}, -{opth id:vars(varlist)} {opt v:ersion(version_number)} [{opt replace} -{opt userinfo} {opt report(report_options)}]{p_end} - -{marker opts}{...} -{synoptset 25}{...} -{synopthdr:Options} -{synoptline} -{synopthdr:Save options} -{synopt :{opth id:vars(varlist)}} The variable(s) that should identify the data set{p_end} -{synopt :{opt v:ersion(stata_version)}} Specify which {inp:.dta} version to use when saving{p_end} -{synopt :{opt replace}} Replace the data file if it already exits{p_end} -{synopt :{opt userinfo}} Include user info in meta data{p_end} -{synopt :{opt report(report_options)}} Save a report with meta data about the data to disk. See below for opt{p_end} - -{synopthdr:Report options} -{pstd}These options are only to be used inside {inp:report()}{p_end} -{synopt :{opt path("/path/to/report.md")}} Save the report using another name and location than the data file{p_end} -{synopt :{opt replace}} Replace report file if it already exists{p_end} -{synopt :{opt csv}} Create the report in csv format instead of markdown{p_end} -{synopt :{opt noalpha}} Order the variables in the report as in the data set and not alphabetically{p_end} - -{synoptline} - -{title:Description} - -{pstd}The command {cmd:iesave} is an enhanced way of saving data sets to disk, -intended to be used instead of the built in command {help save} -when working with research data. -In addition to saving the data set to disk, -the command applies some best practices steps before saving it -and it compiles meta data about the data set and about each variable. -The meta data about the data set is always saved -in {help char} characteristics to the data file. -Both the data set and the variables meta data -can be exported in a separate file that can be tracked using Git. -When the data points in the data set changes, -then the variable meta data also changes. -Therefore, tracking this report in Git allows you to know -which changes to your code made changes to the data points.{p_end} - -{pstd}Before saving the data {cmd:iesave} uses {help compress} to -minimize the storage space the files takes when saved to disk, -and it throws and error if {help isid} fails to confirm that the -ID variable(s) are uniquely and fully identifying the data. -This means testing that the ID variable(s) have no duplicated values and no missing values.{p_end} - -{pstd}The command requires the user to explicitly set the {inp:.dta} version -that should be used when saving the data set. -This prevents that a team members with a more recent version of Stata -accidently saves the data in a file format that -team members with an older version of Stata cannot open.{p_end} - -{pstd}The data set meta data contains information on the ID variable(s), -the number of observations, the number of variables, the datasignature, -the time and date the file was saved as well as -the .dta version the data set was last saved in using {cmd:iesave}. -If the option {opt userinfo} is used, then the data set meta data also -includes the username and the computer ID of the user that -most recently used {cmd:iesave} to save the data.{p_end} - -{pstd}If the option {opt report} is used, then the same data set meta data -is also saved to a report in a separate file. -In addition to the meta data about the data set, in this report, -meta data on all variables are also included. -This meta data is descriptive statistics on the data in each variable. -The descriptive statistics is different depending on the variable -being a string, date, categorical or continuous variable. -It is often not feasible or desirable to track a .dta file on GitHub -so changes to the data set are usually not be tracked -together with changes in the code. -This is solved by this report, as the variable meta data will change -if the data changes (rare corner case exceptions may exist) -and this report is suitable to be tracked on Git.{p_end} - -{title:Options} - -{dlgtab:Save options:} - -{phang}{opth id:vars(varlist)} is used to specify the variable(s) that -uniquely and fully should identify the observations in the data set. -This command is intended for research data where data -should always be properly identified. -The command will, before saving, throw an error if -the variables specified in this option have -missing values or duplicated values -(duplicated combinations of values if more than one ID variable).{p_end} - -{phang}{opt v:ersion(stata_version)} is used to specify which -{inp:.dta} version should be used when saving the data set. -This allows a team that works in different versions of Stata -to always save in the same {inp:.dta} format no matter -which Stata version any team member have installed on their computer. -This avoids the issue of a team member saving the data in a format that -another team member with an older version cannot read. -The recommendation is to set the highest version number allowed -in the oldest version of Stata any team member has installed. -Not every Stata version include a new {inp:.dta} version. -The only the {inp:.dta} versions used in this command is 12, 13 and 14. -If a Stata version higher than those versions -or a version in-between is specified, -then the highest {inp:.dta} version lower than -the specified version is used. -For example, if 13.1 is specified, then 13 will be used.{p_end} - -{phang}{opt replace} overwrites the data file if it already exits. -If applicable and unless {opt reportpath()} is used, -this also applies to the report file.{p_end} - -{phang}{opt userinfo} includes user information - -user name {inp:c(username)} and computer name {inp:c(hostname)} - -in the meta data. -By default, this information is omitted for privacy reasons. -This applies both to meta data saved to {inp:char} values and, -when applicable, meta data saved in the report.{p_end} - -{phang}{opt report(report_options)} is used to create a report with meta data. -The default is to save the report in markdown format -in the same location as the data file -using the same name as the data file but with {inp:.md} as the file extension. -See below for {it:report_options} that can be used to -change any of the default behavior. -Either {opt report()} or {opt report} can be used -when keeping all default behavior. - -{dlgtab:Report options} - -{pstd}These options are only to be used inside {opt report()}{p_end} - -{phang}{opt path("/path/to/report.md")} is used to -specify a different file location and file name than the default. -The file extension must be {inp:.md} or {inp:.csv}. -If this option is used then the replace option used for the data file -does not apply to the report file. - -{phang}{opt replace} is used to replace the report file if it already exists. -This option only applies of the report option {opt path()} is used, -as otherwise the replace option for the {inp:.dta} file -also applies to the report file. - -{phang}{opt csv} is used to specify that the report should be -created in CSV format instead of markdown. -This option is superseded and has no effect -if the option {opt path()} is also used. - -{phang}{opt noalpha} is used to list the variables in the tables in the report -in the same order as the sort order of the data set. -The default is to sort the variables alphabetically. - -{title:Examples} - -{pstd}{bf:{ul:Example 1}}{p_end} - -{pstd}This is the most basic usage of {cmd:iesave}. -Specified like this, it saves the data set -after it has checked that the variable {inp:make} is -uniquely and fully identifying the data and -have used {help compress} to make sure the data points are stored -in the most memory efficient format.{p_end} - -{pstd}{inp:sysuse auto, clear}{break} -{inp:local myfolder {it:"/path/to/folder"}}{break} -{inp:iesave {it:"`myfolder'/data1.dta"}, replace ///}{break} -{space 2}{inp:idvars(make) version(15)}{p_end} - -{pstd}{bf:{ul:Example 2}}{p_end} - -{pstd}This example is similar to example 1, but it also saves a report -with the meta data about the data set and the variables -to {it:"`myfolder'/data2.md"}.{p_end} - -{pstd}{inp:sysuse auto, clear}{break} -{inp:local myfolder {it:"/path/to/folder"}}{break} -{inp:iesave {it:"`myfolder'/data2.dta"}, replace ///}{break} -{space 2}{inp:idvars(make) version(15) report}{p_end} - -{pstd}{bf:{ul:Example 3}}{p_end} - -{pstd}This example is similar to example 2, but it saves the report in csv format -and saves it in the custom location {it:"`myfolder'/reports/data-report.csv"}.{p_end} - -{pstd}{inp:sysuse auto, clear}{break} -{inp:local myfolder {it:"/path/to/folder"}}{break} -{inp:iesave {it:"`myfolder'/data2.dta"}, replace ///}{break} -{space 2}{inp:idvars(make) version(15) {space 15}///}{break} -{space 2}{inp:report(path({it:"`myfolder'/reports/data-report.csv") replace})}{p_end} - -{title:Author} - -{phang}All commands in iefieldkit are developed by DIME Analytics at the World Bank's Development Impact Evaluations department. - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "iefieldkit iesave" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/iefieldkit":the GitHub repository of iefieldkit}.{p_end} diff --git a/src/help_files/ietoolkit.sthlp b/src/help_files/ietoolkit.sthlp deleted file mode 100644 index 8b650d15..00000000 --- a/src/help_files/ietoolkit.sthlp +++ /dev/null @@ -1,74 +0,0 @@ -{smcl} -{* 01 Feb 2024}{...} - -{hline} -help for {hi:ietoolkit} -{hline} - -{title:Title} - -{phang}{cmdab:ietoolkit} {hline 2} Returns information on the version of ietoolkit installed - -{phang}For a more descriptive discussion on the intended usage and work flow of this -command please see the {browse "https://dimewiki.worldbank.org/wiki/Stata_Coding_Practices#ietoolkit":DIME Wiki}. - -{title:Syntax} - -{phang} -{cmdab:ietoolkit} - -{pstd}Note that this command takes no arguments at all.{p_end} - -{marker desc} -{title:Description} - -{pstd}{cmdab:ietoolkit} This command returns the version of ietoolkit installed. It - can be used in the beginning of a Master Do-file that is intended to be used - by multiple users to programmatically test if ietoolkit is not installed for - the user and therefore need to be installed, or if the version the user has - installed is too old and needs to be upgraded. - -{marker optslong} -{title:Options} - -{phang}This command does not take any options. - -{marker example} -{title:Examples} - -{pstd}The code below is an example code that can be added to the top of any do-file. - The example code first tests if the command is installed, and install it if not. If it is - installed, it tests if the version is less than version 5.0. If it is, it - replaces the ietoolkit file with the latest version. In your code you can skip - the second part if you are not sure which version is required. But you should - always have the first part testing that {inp:r(version)} has a value before using - it in less than or greater than expressions. - -{inp} cap ietoolkit -{inp} if "`r(version)'" == "" { -{inp} *ietoolkit not installed, install it -{inp} ssc install ietoolkit -{inp} } -{inp} else if `r(version)' < 5.0 { -{inp} *ietoolkit version too old, install the latest version -{inp} ssc install ietoolkit , replace -{inp} }{text} - -{title:Acknowledgements} - -{phang}We would like to acknowledge the help in testing and proofreading we received - in relation to this command and help file from (in alphabetic order):{p_end} -{pmore}Luiza Cardoso De Andrade{break}Seungmin Lee{break} - -{title:Author} - -{phang}All commands in ietoolkit is developed by DIME Analytics at DECIE, The World Bank's unit for Development Impact Evaluations. - -{phang}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group - -{phang}Please send bug-reports, suggestions and requests for clarifications - writing "ietoolkit ietoolkit" in the subject line to:{break} - dimeanalytics@worldbank.org - -{phang}You can also see the code, make comments to the code, see the version - history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}.{p_end} diff --git a/src/ietoolkit.pkg b/src/ietoolkit.pkg index dfab0ec8..26bfb6a5 100644 --- a/src/ietoolkit.pkg +++ b/src/ietoolkit.pkg @@ -1,28 +1,51 @@ +* This package file is generated in the adodown workflow. +* Do not edit manually - instead, use the command ad_update in the adodown package +*** version v 7.3 -d iefieldkit. DIME Analytics iefieldkit public beta -d DIME Analytics, World Bank Group, Development Economics Research -f /ado_files/iebaltab.ado -f /ado_files/ieboilstart.ado -f /ado_files/ieddtab.ado -f /ado_files/iedorep.ado -f /ado_files/iedropone.ado -f /ado_files/iefolder.ado -f /ado_files/iegitaddmd.ado -f /ado_files/iegraph.ado -f /ado_files/iekdensity.ado -f /ado_files/iematch.ado -f /ado_files/iesave.ado -f /ado_files/ietoolkit.ado -f /help_files/iebaltab.sthlp -f /help_files/ieboilstart.sthlp -f /help_files/ieddtab.sthlp -f /help_files/iedorep.sthlp -f /help_files/iedropone.sthlp -f /help_files/iefolder.sthlp -f /help_files/iegitaddmd.sthlp -f /help_files/iegraph.sthlp -f /help_files/iekdensity.sthlp -f /help_files/iematch.sthlp -f /help_files/iesave.sthlp -f /help_files/ietoolkit.sthlp +*** title +d 'IETOOLKIT': +*** description +d module providing commands specially developed for Impact Evaluations +d +*** stata +d Requires: Stata version 12.0 +d +*** author +d Author: DIME Analytics +*** contact +d Contact: dimeanalytics@worldbank.org +*** url +d URL: https://github.com/worldbank/ietoolkit/ +d +*** date +d Distribution-Date: 20240404 +*** adofiles +f ado/iesave.ado +f ado/iematch.ado +f ado/iekdensity.ado +f ado/iegraph.ado +f ado/iegitaddmd.ado +f ado/iefolder.ado +f ado/iedropone.ado +f ado/ieddtab.ado +f ado/ieboilstart.ado +f ado/iebaltab.ado +f ado/ietoolkit.ado + +*** helpfiles +f sthlp/iesave.sthlp +f sthlp/iematch.sthlp +f sthlp/iekdensity.sthlp +f sthlp/iegraph.sthlp +f sthlp/iegitaddmd.sthlp +f sthlp/iefolder.sthlp +f sthlp/iedropone.sthlp +f sthlp/ieddtab.sthlp +f sthlp/ieboilstart.sthlp +f sthlp/iebaltab.sthlp +f sthlp/ietoolkit.sthlp + +*** ancillaryfiles + +*** end e diff --git a/src/mdhlp/README.md b/src/mdhlp/README.md new file mode 100644 index 00000000..09c328bf --- /dev/null +++ b/src/mdhlp/README.md @@ -0,0 +1,10 @@ +# Markdown help files + +In the `adodown` workflow you should not create any files in this folder. +Files in this folder is intended to be created using the command `ad_command`. +The markdown files here are then converted into Stata help files in `.sthlp` format using `ad_publish` or `ad_sthlp`. +Those commands saves the converted helpfiles in the `stlhp` folder. + +For syntax rules on how to write Stata helpfiles in markdown syntax in the `adodown` workflow, see [this article](https://lsms-worldbank.github.io/adodown/articles/mdhlp-syntax.html). + +The content in this folder is also used to render a documentation website using the R-tool [`adodownr`](https://github.com/lsms-worldbank/adodownr). diff --git a/src/mdhlp/iebaltab.md b/src/mdhlp/iebaltab.md new file mode 100644 index 00000000..e7f06cdd --- /dev/null +++ b/src/mdhlp/iebaltab.md @@ -0,0 +1,766 @@ +# Title + +__iebaltab__ - produces balance tables with multiple groups or treatment arms + +# Syntax + +__iebaltab__ _balance_varlist_ [if] [in] [weight], __**group**var__(_varname_) [ _column/row_options_ _estimation_options_ _stat_display_options_ _labe/notel_options_ _export_options_ _latex_options_ ] + +where _balance_varlist_ is one or several continuous or binary variables (from here on called balance variables) for which the command +will test for differences across the categories in __groupvar__(_varname_). + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Iebaltab). + +## Required options + +| _options_ | Description | +|-----------|-------------| +| __**group**var__(_varname_) | Variable indicating the groups (ex. treatment arms) to test across | + +## Column and row option + +| _options_ | Description | +|-----------|-------------| +| __**co**ntrol__(_group_code_) | Indicate a single group that all other groups are tested against. Default is all groups are tested against each other | +| __**or**der__(_group_code_list_) | Manually set the order the groups appear in the table. Default is ascending. See details on _group_code_list_ below | +| __**tot**al__ | Include descriptive stats on all observations included in the table | +| __onerow__ | Write number of observations (and number of clusters if applicable) in one row at the bottom of the table | + +## Estimation options + +| _options_ | Description | +|-----------|-------------| +| __vce__(_vce_types_) | Options for estimating variance. See below and `help vce_options` for supported options | +| __**fix**edeffect__(_varname_) | Include fixed effects in the pair-wise regressions (and for F-tests if applicable) | +| __**cov**ariates__(_varlist_) | Include covariates (control variables) in the pair-wise regressions (and for F-tests if applicable) | +| __**ft**est__ | Include a row with the F-test for joint significance across all balance variables for each test pair | +| __**feqt**est__ | Include a column with the F-test for joint significance across all groups for each variable | + +## Statistics display options + +| _options_ | Description | +|-----------|-------------| +| __stats__(_stats_string_) | Specify which statistics to display in the tables. See options for _stats_string_ below | +| __**star**levels__(_numlist_) | Manually set the three significance levels used for significance stars | +| __**nostar**s__ | Do not add any stars to the table | +| __**form**at__(_%fmt_) | Apply Stata formats to the non-integer values outputted in the table. See `help format` for format options. | + +## Label/notes option + +| _options_ | Description | +|-----------|-------------| +| __**groupc**odes__ | Use the values in the `groupvar()` variable as column titles. Default is to use value labels if any | +| __**groupl**abels__(_code_titles_) | Manually set the group column titles. See details on _code_titles_ below | +| __**totall**abel__(_string_) | Manually set the title of the total column | +| __**rowv**arlabels__ | Use the variable labels instead of variable name as row titles | +| __**rowl**abels__(_name_titles_) | Manually set the row titles. See details on _name_titles_ below | +| __nonote__ | Suppress the default not at the bottom of the table | +| __addnote__(_string_) | Add a manual note to the bottom of the table | + +## Export options + +| _options_ | Description | +|-----------|-------------| +| __browse__ | View table in the data browser | +| __**savex**lsx__(_filename_) | Save table to Excel file on disk | +| __**savec**sv__(_filename_) | Save table to csv-file on disk | +| __**savet**ex__(_filename_) | Save table to LaTeX file on disk | +| __texnotefile__(_filename_) | Save table note in a separate LaTeX file on disk | +| __replace__ | Replace file on disk if the file already exists | + +## LaTeX options + +| _options_ | Description | +|-----------|-------------| +| __**texn**otewidth__(_numlist_) | Manually adjust width of note | +| __**texc**aption__(_string_) | Specify LaTeX table caption | +| __**texl**abel__(_string_) | Specify LaTeX label | +| __**texdoc**ument__ | Create a stand-alone LaTeX document | +| __texcolwidth__(_string_) | Limit width of the first column on LaTeX output | + +# Description + +`iebaltab` is a command that generates balance tables (difference-in-means tables). +The command tests for statistically significant difference in the balance variables between +the categories defined in the `groupvar()`. The command can either test one control group +against all other groups, using the `control()` option, +or test all groups against each other (the default). The command also allows for +fixed effects, covariates and different types of variance estimators. + +The balance variables are expected to be continuous or binary variables. +Categorical variables (for example 1=single, 2=married, 3=divorced) will not +generate an error but will be treated like a continuous variable +which is most likely statistically invalid. +Consider converting each category to binary variables. + +The command can also add a note to the bottom of the table. +The default note is not meant to be included in the final publication. +It includes technical information about how the command was specified. +This is helpful in the early stage of research where several specifications +are often explored, but should be replace with a more human readable note +in the final version. + +See the _Estimation/Statistics Definitions_ +section below for a detailed documentation of what statistics this command +calculates and how they are calculated. + +# Options + +## Required options + +__**group**var__(_varname_) specifies the variable indicating groups +(for example treatment arms) across which the command will +test for difference in mean of the balance variable. +The group variable can only be one variable and +it must be numeric and may only hold integers. +See `group()` in `help egen` for help on creating a single variable where +each integer represents a category from string variables and/or multiple variables. +Observations with missing values in this variable will be excluded when running this command. + +## Column and row options + +__**co**ntrol__(_group_code_) specifies one group that is the control group +that all other groups are tested against for difference in means and +where _group_code_ is an integer used in `groupvar()`. +The default is that all groups are tested against each other. +The control group will be listed first (leftmost) in the table +unless another order is specified in `order()`. +When using `control()` the order of the groups in the pair is (non-control)-(control) +so that a positive statistic (in for example _diff_ or _beta_) indicates that +the mean for the non-control is larger than for the control. + +__**or**der__(_group_code_list_) manually sets the column order of the groups in the table. _group_code_list_ may +be any or all of the values in the group variable specified in `groupvar()`. +The default order if this option is omitted is ascending order of the values in the group variable. +If any values in `groupvar()` are omitted when using this option, +they will be sorted in ascending order after the values included. + +__**tot**al__ includes a column with descriptive statistics on the full sample. +This column still exclude observations with missing values in `groupvar()`. + +__onerow__ displays the number of observations in an additional row +at the bottom of the table. If the number of observations are not identical +across all rows within a column, then this option throws an error. +This also applies to number of clusters. +If not specified, the number of observations (and clusters) per variable per group +is displayed on the same row in an additional column +next to the descriptive statistics. + +## Estimation options + +__vce__(_vce_types_) sets the type of variance estimator +to be used in all regressions for this command. +See `help vce_option` for more details. +However, the types allowed in this command are only +`robust`, `cluster` _cluster_var_ or `bootstrap`. +See the estimation definition section +for exact definitions on how these vce types are included in the regressions. + + __**fix**edeffect__(_varname_) specifies a single variable to be used as fixed effects in all regressions +part from descriptive stats regressions. +The variable specified must be a numeric variable. +If more than one variable is needed as fixed effects, and it is not desirable to combine multiple variables into one +(using for example `group()` in `egen` - see `help egen`), +then they can be included using the {opt i.} notation in the `covariates()` option. +See the estimation definition section for exact definitions on how the fixed effects are included in the regressions. + +__**cov**ariates__(_varlist_) includes the variables specified in the regressions for t-tests (and for +F-tests if applicable) as covariate variables (control variables). See the description section above for details on how the covariates +are included in the estimation regressions. The covariate variables must be numeric variables. +See the estimation definition section for exact definitions on how the covariates are included in the regressions. + +__**ft**est__ adds a single row at the bottom of the table with +one F-test for each test pair, testing for joint significance across all balance variables. +See the estimation definition section for exact definitions on how these tests are estimated. + +__**feqt**est__ adds a single column in the table with an F-test for each balance variable, +testing for joint significance across all groups in `groupvar()`. +See the estimation definition section for exact definitions on how these tests are estimated. + +## Statistics display options + +__stats__(_stats_string_) +indicates which statistics to be displayed in the table. +The _stats_string_ is expected to be on this format (where at least one of the sub-arguments `desc`, `pair`, `f` and `feq` are required): + +``` +stats(desc(desc_stats) pair(pair_stats) f(f_stats) feq(feq_stats)) +``` + +The table below lists the valid values for +_desc_stats_, _pair_stats_, _f_stats_ and _feq_stats_. +See the estimation definition section +for exact definitions of these values and how they are estimated/calculated. + +| Type | Options +|-----------|-------------| +| _desc_stats_ | `se` `var` `sd` | +| _pair_stats_ | `diff` `beta` `t` `p` `nrmd` `nrmb` `se` `sd` `none` | +| _f_stats_ | `f` `p` | +| _feq_stats_ | `f` `p` | + +__**star**levels__(_numlist_) manually sets the +three significance levels used for significance stars. +Expected input is decimals (between the value 0 and 1) in descending order. +The default is (.1 .05 .01) where .1 corresponds +to one star, .05 to two stars and .01 to three stars. + + __**nostar**s__ makes the command not add any stars to the table +regardless of significance levels. + +__**form**at__(_%fmt_) applies the Stata formats specified to all values outputted +in the table apart from values that always are integers. +See `help format` for format options +Example of values that always are integers is number of observations. +For these integer values the format is always %9.0f. +The default for all other values when this option is not used is %9.3f. + +## Label/notes option + +__**groupc**odes__ makes the integer values used for the group codes in +`groupvar()` the group column titles. +The default is to use the value labels used in `groupvar()`. +If no value labels are used for the variable in `groupvar()`, +then this option does not make a difference. + + __**groupl**abels__(_code_titles_) manually sets the group column titles. +_code_titles_ is a string on the following format: + +``` +grouplabels("code1 title1 @ code2 title2 @ code3 title3") +``` + +Where code1, code2 etc. must correspond to the integer values used for each +group used in the variable `groupvar()`, +and title1, title2 etc. are the titles to be used for the corresponding integer value. +The character `@` may not be used in any title. +Codes omitted from this option will be assigned a column title +as if this option was not used. +This option takes precedence over _group_codes_ when used together, +meaning that group codes are only used for groups +that are not included in the _code_title_string_. +The title can consist of several words. +Everything that follows the code until the end of a string +or a `@` will be included in the title. + +__**totall**abel__(_string_) manually sets the column title for the total column. + +__**rowv**arlabels__ use the variable labels instead of variable name as row titles. +The default is to use the variable name. For variables with no variable label defined, +the variable name is used as row label even when this option is specified. + +__**rowl**abels__(_name_title_string_) manually sets the row titles for each +of the balance variables in the table. _name_title_string_ is a string in the following format: + +``` +rowlabels("name1 title1 @ name2 title2 @ name3 title3") +``` + +Where name1, name2 etc. are variable names used as balance variables, +and title1, title2 etc. are the titles to be used for the corresponding variable. +The character `@` may not be used in any of the titles. +Variables omitted from this option are assigned a row title as if this option was not used. +This option takes precedence over `rowvarlabels` when used together, +meaning that default labels are only used for variables +that are not included in the _name_title_string_. +The title can consist of several words. +Everything that follows the variable name until +the end of a string or a `@` will be included in the title. + +__nonote__ suppresses the default note that the command adds to +the bottom of the table with technical information +on how the command was specified. +This note is great during explorative analysis as it documents how +`iebaltab` was specified to generate exactly that table. +Eventually however, this note should probably be replaced with +a note more suitable for publication. + +__addnote__(_string_) adds the string provided in this option +to the note at the bottom of table. +If `nonote` is not used, then this manually provided note +is added to the end of the default note. + +## Export options + +__browse__ replaces the data in memory with the table +so it can be viewed using the command `browse` instead of saving it to disk. +This is only meant to be used during explorative analysis +when figuring out how to specify the command. +Note that this overwrites data in memory. + +__**savex**lsx__(_filename_) exports the table to an Excel (.xsl/.xlsx) file and saves it on disk. + +__**savec**sv__(_filename_) exports the table to a comma separated (.csv) file and saves it on disk. + +__**savet**ex__(_filename_) exports the table to a LaTeX (.tex) file and saves it on disk. + +__texnotefile__(_filename_) exports the table note in a separate LaTeX file on disk. +When this option is used, no note is included in the `savetex()` file. +This allows importing the table using the `threeparttable` LaTeX package which +is an easy way to make sure the note always has the same width as the table. +See example in the example section below. + +__replace__ allows for the file in `savexlsx()`, `savexcsv()`, `savetex()` or `texnotefile()` +to be overwritten if the file already exist on disk. + +## LaTeX options + +__**texn**otewidth__(_numlist_) manually adjusts the width of the note +to fit the size of the table. +The note width is a multiple of text width. +If not specified, default is one, which makes the table width equal to text width. +However, when the table is resized when rendered in LaTeX +this is not always the same as the table width. +Consider also using `texnotefile()` and the LaTeX package `threeparttable`. + +__**texc**aption__(_string_) writes the table's caption in LaTeX file. +Can only be used with option `texdocument`. + +__**texl**abel__(_string_) specifies table's label, +used for meta-reference across LaTeX file. +Can only be used with option `texdocument`. + +__**texdoc**ument__ creates a stand-alone LaTeX document ready to be compiled. +The default is that `savetex()` creates a fragmented LaTeX file +consisting only of a tabular environment. +This fragment is then meant to be imported to a main LaTeX file +that holds text and may import other tables. + +__texcolwidth__(_string_) limits the width of table's first column +so that a line break is added when a variable's name or label is too long. +{it:string} must consist of a numeric value with one of the following units: +"cm", "mm", "pt", "in", "ex" or "em". +For more information on these units, +[check LaTeX length's manual](https://en.wikibooks.org/wiki/LaTeX/Lengths). + +# Estimation/statistics definitions + +This section details the regressions that are used to estimate +the statistics displayed in the balance tables generated by this command. +For each test there is a "basic form" example to highlight the core of the test, +and an "all options" example that shows exactly how all options are applied. +Here is a glossary for the terms used in this section: + +| Term | Definition | +|-----------|-------------| +| _balance variable_ | The variables listed as _balance_varlist_ | +| _groupvar_ | The variable specified in `groupvar()` | +| _group_code_ | Each value in _groupvar_ | +| _test_pair_ | Combination of _group codes_ to be used in pair wise tests | +| _tp_dummy_ | A dummy variable where 1 means that the obs' value in `groupvar()` equals the first value in _test_pair_, 0 means it equals the second value, and missing means is matches neither | + +Each section below has a table that shows how the stats are estimated/calculated for each type of statistics. This is what each column means. +A star (*) in the _Stat_ column indicate that is the optional statistics displayed by default if the `stats()` option is not used. +The _Display option_ column shows what sub-option to use in `stats()` to display this statistic. +The _Mat col_ column shows what the column name in the result matrix for the column that stores this stat. See more about the result matrices in the _Result matrices_ section. + +## Group descriptive statistics + +Descriptive statistics for all groups are always displayed in the table. +If option `total` is used then these statistics are also calculated on the full sample. +For each balance variable and for each value group code, +the descriptive statistics is calculated using the following code: + +Basic form: + +``` +reg balancevar if groupvar = groupcode +``` + +All options: + +``` +reg balancevar if groupvar = groupcode weights, vce(vce_option) +``` + +See above for description of each column in this table. +_gc_ stands for _group_code_ (see definition of _group_code_ above). +If the option `total` is used, +then _gc_ will also include _t_ for stats on the full sample. +The last column shows how the command obtains the statistic in the Stata code. +These statistics are stored in +a the result matrix called `r(iebtab_rmat)`. + + +| Stat | Display option | Mat col | Estimation/calculation | +| --- | --- | --- | --- | +| # obs | Always displayed | `n_gc` | `e(N)` after `reg` | +| cluster | Displayed if used | `cl_gc` | `e(N_clust)` after `reg` | +| mean | Always displayed | `mean_gc` | `_b[cons]` after `reg` | +| se * | `stats(desc(se))` | `se_gc` | `_se[cons]` after `reg` | +| var | `stats(desc(var))` | `var_gc` | `e(rss)/e(df_r)` after `reg` | +| sd | `stats(desc(sd))` | `sd_gc` | `_se[_cons]*sqrt(e(N))` after `reg` | + + +## Pair-wise test statistics + +Pair-wise test statistics is always displayed in the table +unless `stats(pair(none))` is used. +For each balance variable and for each test pair, this code is used. +Since observations not included in the test pair have missing values in the test pair dummy, +they are excluded from the regression without using an if-statement. + +Basic form: + +``` +reg balancevar tp_dummy +test tp_dummy +``` + +All options: + +``` +reg balancevar tp_dummy covariates i.fixedeffect weights, vce(vce_option) +test tp_dummy +``` + +See above for description of each column in this table. +_tp_ stands for _test_pair_, see definition above. +The last column shows how the command obtains the stat in the Stata code. +See the group descriptive statistics above for definitions on +_mean_1_, _mean_2_, _var_1_ and _var_2_ +also used in the table below. +These statistics are stored in +a the result matrix called `r(iebtab_rmat)`. + +| Stat | Display option | Mat col | Estimation/calculation | +| --- | --- | --- | --- | +| diff * | `stats(pair(diff))` | `diff_tp` | If pair _1_2_: `mean_1`-`mean_2` | +| beta | `stats(pair(beta))` | `beta_tp` | `e(b)[1,1]` after `reg` | +| t | `stats(pair(t))` | `t_tp` | `_b[tp_dummy]/_se[tp_dummy]` after `reg` | +| p | `stats(pair(p))` | `p_tp` | `e(p)` after `test` | +| nrmd | `stats(pair(nrmd))` | `nrmd_tp` | If pair _1_2_: `diff_tp/sqrt(.5*(var_1+var_2))` | +| nrmb | `stats(pair(nrmb))` | `nrmb_tp` | If pair _1_2_: `beta_tp/sqrt(.5*(var_1+var_2))` | +| se | `stats(pair(se))` | `se_tp` | `_se[tp_dummy]` after `reg` | +| sd | `stats(pair(sd))` | `sd_tp` | `_se[tp_dummy] * sqrt(e(N))` after `reg` | + + + +## F-test statistics for balance across all balance variables + +Displayed in the balance table if the option `ftest` is used. +For each test pair the following code is used. + +Basic form: + +``` +reg tp_dummy balancevars +testparm balancevars +``` + +All options: + +``` +reg tp_dummy balancevars covariates i.fixedeffect weights, vce(vce_option) +testparm balancevars +``` + +See above for description of each column in this table. +_tp_ stands for _test_pair_, see definition above. +These statistics are stored in +a the result matrix called `r(iebtab_fmat)`. + +| Stat | Display option | Mat col | Estimation/calculation | +| --- | --- | --- | --- | +| # obs | Always displayed | `fn_tp` | `e(N)` after `reg` | +| cluster | Displayed if used | `fcl_tp` | `e(N_clust)` after `reg` | +| f * | `stats(f(f))` | `ff_tp` | `r(F)` after `testparm` | +| p | `stats(f(p))` | `fp_tp` | `r(p)` after `testparm` | + + +## F-test statistics for balance across all groups + +Displayed in the balance table if the option `feqtest` is used. +For each balance variable the below code is used where +`feqtestinput` is a list on the format +`x2.groupvar = x3.groupvar ... xn.groupvar = 0`, +and where _x2_, _x3_ ... _xn_, +represents all group codes apart from the first code. + +Basic form: + +``` +reg balancevar i.groupvar +test feqtestinput +``` + +All options: + +``` +reg balancevar i.groupvar covariates i.fixedeffect weights, vce(vce_option) +test feqtestinput +``` + +See above for description of each column in this table. +These statistics are stored in +a the result matrix called `r(iebtab_fmat)`. + +| Stat | Display option | Mat col | Estimation/calculation | +| --- | --- | --- | --- | +| # obs | Always displayed | `feq_n` | `e(N)` after `reg` | +| cluster | Displayed if used | `feq_cl` | `e(N_clust)` after `reg` | +| f * | `stats(feq(f))` | `feq_f` | `r(F)` after `test` | +| p | `stats(feq(p))` | `feq_p` | `r(p)` after `test` | + +# Result matrices + +There is an unlimited variation in preferences for +how a balance table should be structured or look. +A single command like `iebaltab` simply cannot satisfy them all. +To still enable infinite customization this commands return two matrices +with all the stats calculated by this command. +From these matrices all values can be extracted and +put into any output of your liking. + +The two returned matrices are called `iebtab_rmat` and `iebtab_fmat`. +All stats related to the F-test across all balance variables (option `ftest`) +are stored in the `iebtab_fmat` matrix, +all other stats are stored in the `iebtab_rmat` matrix. +The `iebtab_fmat` matrix always has exactly one row with the row name `fstats`. +The `iebtab_rmat` matrix has one row per balance variable +and each row is named after each balance var. +In both matrices the column names corresponds to a statistics. +The column name for each statistics and its definition can be found +in the _Estimation/statistics definitions_ section above. + +See examples in the end of this help file for how to access the values. + +# Missing values + +When statistics are estimated/calculated they can be missing for multiple reasons. +This section explain what each (`.c`,`.v` etc.) represents. +See `help missing` if you are not familiar with extended missing values. +The exported tables or the result matrices should never include +the standard missing value (`.`). +If you ever encounter the standard missing value in any of them, +please report that using the contact information at the bottom of this help file. + +## Missing value: .b + +Missing value `.b` means that the statistics +could not be estimated/calculated as bootstrapping was set +to be used as the variance estimator in `vce(bootstrap)`. +When bootstrap is used there is no single value for variance +to be reported in stat `desc(var)`. +As a result of that, the stats `pair(nrmd)` and `pair(nrmb)` +are not reported either as they use the variance as input. + +## Missing value: .c + +Missing value `.c` are only used when there is +no number of clusters to report as the errors estimations were not cluster. +A value for number of clusters are only reported if the +variance estimator option is set to `vce(cluster clustervar)`. + +## Missing value: .f + +Missing value `.f` is used to indicate that F-test option for +that statistics (either `fstat` or `feqstat`) was not used, +and the value was therefore not calculated. + +## Missing value: .m + +Missing value `.m` is used to indicate that an option to skip +a full section was used. For example, `stats(pair(none))` where all +pair-wise statistics are skipped. + +## Missing value: .n + +Missing value `.n` is used to indicate that the R-squared value +was not defined in the pair-wise regression for this test pair. +This is most likely caused by no variance in the balance variable. +Here is an example: + +``` +sysuse census +gen constant = 1 +iebaltab medage constant, groupvar(region) browse +``` + +In this example the variable _constant_ has no variance. +This variable has the mean 1 and 0 variance in the descriptive statistics +and statistics can be reported in the descriptive statistics section. +However, the R-square value is not defined for any test pair +in the pair-wise regression, +and no pair-wise stats are reported for the _constant_ variable. + +## Missing value: .o +Missing value `.o` is used to indicate that in the F-test regression +for joint significance across all balance variables (see option `ftest`) +for this test pair and at least one balance variable was omitted. +This is most likely caused by no variance in that balance variable. +Here is an example: + +``` +sysuse census +replace pop = 0 if (region == 1) | (region == 2) +iebaltab medage pop, groupvar(region) ftest browse +``` + +In this example the variable _pop_ has no variance in test pair 1_2, +and that variable will be omitted from the F-test regression and +no stats are reported for this F-test for this test pair. + +## Missing value: .t + +Missing value `.t` is used to indicate that no descriptive statistics +were calculated for the full sample since the option `total` was not used. + +## Missing value: .v + +Missing value `.v` is used to indicate that +all variance in the balance variable can be explained by one or several +other variables included in the regression. +This is defined as the R-squared value is 1. +Here are a few examples: + +```sysuse census +gen region2 = region +gen pop_neg = 0 +replace pop_neg = pop * -1 if (region == 1) | (region == 2) +iebaltab medage pop region2, groupvar(region) covar(pop_neg) browse +``` + +The variance in variable _region2_ is perfectly explained +by the group variable _region_ for each test pair +and the R-squared is 1 in all pair-wise regressions and no statistics are reported. +Similarly, _pop_neg_ that is included as a covariate control variable +has prefect negative correlation with the balance variable _pop_ in test pair 1_2. +The R-squared is 1 in the regression for pair 1_2 and no pair-wise statistics are reported for that pair. + +# Examples + +## Example 1 + +``` +sysuse census +gen group = runiform() < .5 +iebaltab pop medage, groupvar(group) browse +browse +``` + +In the example above, Stata's built in census data is used. +First a dummy variable is created at random. +Using this random group variable a balance table is created testing for +differences in _pop_ and _medage_. +By using `browse` the data in memory is replaced with the table so that +the table can be used in the browse window. +You most likely never should use the `browse` option in your final code +but it is convenient in examples like this and when first testing the command. +See examples on how to save the table to a file on disk below. + +## Example 2 + +``` +sysuse census +iebaltab pop medage, groupvar(region) browse +browse +``` + +In this example we use the variable region as group variable that has four categories. +All groups are tested against each other. + +## Example 3 + +``` +sysuse census +iebaltab pop medage, groupvar(region) browse control(4) +browse +``` + +Comparing all groups against each other becomes unfeasible when the number of +categories in the group variable grows. +The option `control()` overrides this behavior so that the category indicated +in this options are tested against all other groups, +but the other groups are not tested against each other. +For statistics where the direction matters (for example _diff_ or _beta_) +the order is changed so that the test is (_other_group_ - _control_) +such that a positive value indicates that the other group has a higher +mean in the balance variable. + +## Example 4 + +``` +sysuse census +iebaltab pop medage, groupvar(region) browse control(4) stats(desc(var) pair(p)) +browse +``` + +You can control which statistics to output in using the `stats()` option. +In this example, the sub-option `desc(var)` indicates that +the variance should be displayed in the descriptive statistics section +instead of standard error which is the default. +The sub-option `pair(p)` indicates that +the p-value in from the t-tests in the pairwise test section should be displayed +instead of the difference in mean between the groups which is the default. +See above in this help file for full details on the sub-options you may use. + +## Example 5 + +``` +sysuse census +local outfld "path/to/folder" +iebaltab pop medage, groupvar(region) control(4) /// + stats(desc(var) pair(p)) replace /// + savecsv("`outfld'/iebtb.csv") savexlsx("`outfld'/iebtb.xlsx") /// + savetex("`outfld'/iebtb.tex") texnotefile("`outfld'/iebtb_note.tex") +``` + +This example shows how to export the tables to the three formats supported. +CSV, Excel and LaTeX. +To run this code you must update the path _"path/to/folder"_ to point +to a folder on your computer where the tables can be exported to. +This is what we recommend over using the `browse` options for final code. +When exporting to LaTeX we recommend exporting the note to a separate file +using the option `texnotefile()` and then import it in LaTeX using the +package `threeparttable` like the code below. +It makes it easier to align the note with the table when LaTeX adjust the size +of the table to fit a page. + +``` +\begin{table} + \centering + \caption{Balance table} + \begin{adjustbox}{max width=\textwidth} + \begin{threeparttable}[!h] + \input{./balancetable.tex} + \begin{tablenotes}[flushleft] + \item\hspace{-.25em}\input{./balancetable_note.tex} + \end{tablenotes} + \end{threeparttable} + \end{adjustbox} +\end{table} +``` + +## Example 6 + +``` +sysuse census +iebaltab pop medage, groupvar(region) +local rnum = rownumb(r(iebtab_rmat),"medage") +local cnum = colnumb(r(iebtab_rmat),"p_2_4") +local p_medage_2_4 = el(r(iebtab_rmat),`rnum',`cnum') +di "The p-value in the test for medage between region 2 and 4 is: `p_medage_2_4'" +``` + +In this example none of the export options (`browse`, `savecsv()` etc.) are used +and the only place where the results are stored +is in the `r(iebtab_rmat)` matrix. +The `rownumb()` and the `colnumb()` functions can be used to get +the row and column number from the row and column names. +These row and column numbers can be used to get the individual value in the function `el()`. +If you know the row and column number you can use the `el()` function directly. + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit iebaltab" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group diff --git a/src/mdhlp/ieboilstart.md b/src/mdhlp/ieboilstart.md new file mode 100644 index 00000000..f1b7c966 --- /dev/null +++ b/src/mdhlp/ieboilstart.md @@ -0,0 +1,165 @@ +# Title + +__ieboilstart__ - applies best practices for collaboration and reproducibility within a project. + +For a more descriptive discussion on the intended usage and workflow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/wiki/Ieboilstart). + +__DISCLAIMER__ - One objective of this command is to harmonize settings across users. However, it is impossible to guarantee that different types of Stata (version number, Small/IC/SE/MP or PC/Mac/Linux) will work exactly the same in every possible context. This command does not guarantee against any version discrepancies in Stata or in user-contributed commands. This command is solely a collection of common practices to reduce the risk that the same code generates different outputs when running on different computers. See more details below. + +# Syntax + +__ieboilstart__ , __**v**ersionnumber__( _Stata_version_ ) [__**ado**path__(_"path/to/folder"_, {_strict_ | _nostrict_}) __noclear__ __**q**uietly__ __veryquietly__ _memory_options_ ] + +Note that one important feature of this command requires that __r(version)__ is written on the first do-file after __ieboilstart__. This setting cannot be specified within a user command and ensures that the Stata version is set correctly. For example: + +``` +ieboilstart , options +`r(version)' +``` + +| _options_ | Description | +|-----------|-------------| +| __**v**ersionnumber__(_Stata_version_) | Sets the Stata version for all subsequent code execution (required) | +| __**ado**path__(_"path/to/folder"_, {_strict_/_nostrict_}) | Sets the folder where this project's ado-files or user-written commands are stored (required for standalone reproducibility packages) | +| __noclear__ | Makes the command not start by clearing all data | +| __**q**uietly__ | Suppresses most of the command's output | +| __veryquietly__ | Suppresses all of the command's output | + +## Memory options + +| _options_ | Description | +|-----------|-------------| +| __maxvar__(_numlist_) | Manually specify maximum number of variables allowed | +| __matsize__(_numlist_) | Manually specify maximum number of variables allowed in estimation commands | +| __**noperm**anently__ | Disable the default to permanently set some best practice memory settings | + +# Description + +__ieboilstart__ applies best practices for collaboration and reproducibility within a research project. Making the same Stata code consistently generate the same results when run on other people's computers is harder than what it first might seem. This is especially true in order to ensure that Stata code will function identically in the future, even if new versions of Stata and user-written commands (such as those on SSC) have been released. The objective of this command is to reduce the risk that a research project's code changes its results when running the same code on different computers or in different points in the future. However, note that it is not technically possible to fully eliminate this risk. + +The best practice settings this command applies can be categorized into the following types: version control of built-in commands, version control of user-written commands, _other_ settings. + +## Version control: Stata and built-in commands + +Research projects often span over several years, and are required to be reproducible for anyone in the future reviewing the results. After several years have passed, it is likely that a new version of Stata has been released. When Stata releases a new version they add new built-in commands, but they might also make changes to already published commands. + +For you to make sure that old code in your project behaves the same way even after you update your Stata installation you need to version control the built-in commands in Stata. You also need to version control the built-in commands in Stata when you are collaborating as you cannot be sure what version of Stata everyone else are using at all points in time. Finally, this becomes particularly important when preparing a reproducibility package that should stand the test of time, as you definitely do not know what version of Stata someone in the future will use. + +One example where this becomes important is reproducible randomization. Sometimes Stata updates the random number generator between versions. Unless the built-in commands that use randomization are version controlled, then the results of the randomization can vary between versions of Stata. This is true even if other requirements for reproducible randomization is used, such as setting the seed (see `help seed`). Each time Stata updates the random number generator it gets marginally better. However, for the vast majority of research projects, this improvement is so marginal it is most definitely negligible. + +This command uses the Stata command __version__ (see `help version`) to version control all built-in commands. For some good technical reasons, it is not possible for __ieboilstart__ to set the version for the rest of the project's code from inside the command. This means that all __ieboilstart__ start is preparing the line of code you need to run to version control all built-in commands. You need to run this line of code on the immediate subsequent line after __ieboilstart__. Like this: + +``` +ieboilstart , options +`r(version)' +``` + +The version setting has the scope of a local, meaning that it expires when a do-file and all sub-dofiles it is calling are completed. If [main/master do-files](https://dimewiki.worldbank.org/Master_Do-files) are used, then the version should be set in the main file, and only results generated when running all code from the main file should be considered reproducible. + +It is just as important, if not more important, to version control the user-written commands as well. See next section for how to version control user-written commands, such as commands installed from _SSC_ (see `help ssc`). + +## Version control: User-written commands + +The option __adopath()__ makes one key reproducibility component easy to use in Stata. Many projects in Stata relies on user-written commands, such as commands installed from SSC. With user-written commands there is always a risk that the project code does not reproduce correctly if a different version of any user-written command is used. This applies when team members collaborate in real team on a project, but it is especially a risk if someone would try to reproduce the project results in the future. User-written commands updates frequently, and depending on when a user installed a command or when it was last updated, the version of a command that user use will inevitable eventually be different. The option __adopath()__ provides an easy to use tool to completely eliminate this risk. + +When a project use the __adopath()__ option with the sub-option _strict_, __adopath__(_"path"_, _strict_), it is guaranteed that no one running that project's code will ever use any other version of user-written commands than what was intended for that project. When using the sub-option __strict__ it is referred to as using __adopath()__ in _strict mode_. The intention is that this option should almost always be used in strict mode. + +The folder that _path_ in __adopath__(_"path"_, _strict_) points to is referred to as the project's _ado-folder_. To make the project's code reproducible as promised above, then this folder needs to be shared with the rest of the project's code. Therefore it is recommended that each project has its own _ado-folder_ and that it is stored together with the rest of that project code. This makes it easy to include the _ado-folder_. when sharing the project code, no matter if it is shared over Git/GitHub, sync-software like DropBox, over a network drive, in a reproducibility archive etc. This folder should include all user-written commands this project uses. + +When using strict mode, the command __net install__ (including commands that builds on it such as __ssc install__) will install the commands in the project's _ado-folder_. Therefore, the intended workflow is that whenever a project needs another user-written command, then in strict mode, the user simply installs the command using __ssc install__ as usual but the command will be installed in the project _ado-folder_ instead of in that user's individual Stata installation. After this, then all users will be guaranteed to use that exact version of that command as long as strict mode is still used. + +In order to guarantee that no user use any command other than the commands in the project's _ado-folder_, the option _adopath()_ in strict mode, makes all commands the user have installed in their Stata installation unavailable. This setting is restored when the user restarts Stata so nothing is uninstalled or made permanently unavailable. The purpose of this functionality is to make sure that no-one forgets to include any user-written command that the project needs in the _ado-folder_. + +The __nostrict__ sub-option, as in __adopath__(_"path"_, _nostrict_), exists to temporarily disable the functionality in strict mode. For example, if someone wants to test using a command installed in their Stata installation before installing it in the project _ado-folder_ then this option can be used. When __nostrict__ is used, when the commands installed in the user's Stata installation, are available in addition to the commands in the project's _ado-folder_. If a user has a command installed in their Stata installation with the same name as a command installed in the _ado-folder_, then the version installed in the _ado-folder_* will always be used. While using the __nostrict__ option can perhaps be seen as more convenient, it would defy the purpose of __adopath()__ to use _nostrict_ as a projects standard mode. + +A in-depth technical presentation on how this feature works can be found in a recording found [here](https://osf.io/6tg3b). The slides used in that presentation can be found [here](https://osf.io/wa3tr). Note that in this presentation __nostrict__ was called _default mode_. While the option __adopath()__ makes one component needed for a gold-standard level reproducibility easy to use, it is not the only thing needed for reproducibility. Other practices such as setting the seed if using randomization is still as important. + +## Other settings + +It is rare that any of the settings in this category is anything a typical user ever needs to worry about. These settings mostly prevents that some unusual and outlier memory setting is the reason some computer is not able to run the code the same way as other computers. One example use case where it can be relevant for a user to modify these settings is if the code is developed to run on a computer or server with unusual (for example very small) specifications. + +This command also standardize some settings that could, in some cases, could otherwise cause the code to run differently or with interruptions. For example, set more off (see `help set more`), set varabbrev off (`help set varabbrev`), set type float (`help set type`), etc. + +See the tables below for a discussion of which settings used and why certain default values were used. + +## Basic Memory Settings + +| _Other Settings_ | Explanation | +|------------------|-------------| +| __set maxvar__ | sets the maximum number of variables allowed. The default value is the maximum allowed in the version of Stata. A lower maximum number can manually be set by the option __maxvar()__. This value is fixed in Stata Small or IC, so this setting is ignored when any of those versions of Stata is used. See set maxvar (`help set maxvar`). | +| __set matsize__ | sets the maximum number of variables that can be included in estimation commands such as __regress__. The default value used in this command is 400 which is the default value for Stata. A higher value is often allowed but it slows down Stata and is only needed when running very complex analysis. This option can be used to set a higher value, as long as the value does not violate the limitations in the versions of Stata this code will be used in. See set matsize (`help set matsize`). | + +## Dynamic Memory Settings + +See memory (`help memory`) for default values. + +| _Other Settings_ | Explanation | +|------------------|-------------| +| __set min_memory__ | sets a lower bound for the amount of memory assigned to Stata. The default value is no lower bound. | +| __set max_memory__ | sets an upper bound for the amount of memory assigned to Stata. The default is as much as the hardware of the computer allows. | +| __set niceness__ | defines how quickly Stata releases unused memory back to the computer | +| __set segmentsize__ | defines how large bundles of data is assigned each time Stata request more memory. Too large bundles make Stata occupy an unnecessary large part of the computer's memory (that otherwise could have been used by other applications), and too small bundles makes Stata have to interrupt itself to request more bundles of memory too frequently | + +## Code Flow Settings + +| _Other Settings_ | Explanation | +|------------------|-------------| +| __set more off__ | disables the default setting that Stata stops and waits for the user to press any key each time the output window is full. Long dofiles would take a very long time to run and require constant attention from the user without this setting. Most Stata users always disable the default which is __set more on__. See set more (`help set more`).| +| __pause on__ | allows the usage of the command __pause__ which can be very useful during debugging. See pause (`help pause`). | + +## Variable Settings: + +| _Other Settings_ | Explanation | +|------------------|-------------| +| __set varabbrev off__ | allows users to abbreviate variable names. Somewhat similarly to command names abbreviation such as __gen__ for __generate__ and __reg__ for __regress__. However, command name abbreviations are set up to make sure there is no name conflicts that makes the abbreviations ambiguous. This is not true for variable name abbreviation and code that relies on variable name abbreviations tend to be error prone. See set varabbrev (`help set varabbrev`) for more details and carefully consider these words of caution before enabling variable name abbreviation in a collaborative dofile. | +| __set type float__ | sets the default variable type to _float_ when creating a new variable and no type is specified. Different default types can lead to differences in randomization as this setting affects the precision in the randomization. For extremely large dataset the type _double_ might be required, when generating random numbers that is expected to be unique. But since that type is twice as storage intensive, this command use _float_ as default, and users need to specify _double_ in the rare cases it makes a difference. | + +# Options + +__**v**ersionnumber__(_string_) sets a stable version of Stata for all users. Stata does not (for good reasons) allow a user-written command to alter the version setting from inside a command. Therefore, this option does _nothing_ unless __r(version)__ is included as described in the Syntax section. While the version number cannot be set inside the command code, __ieboilstart__ does two things. First it reminds the user to set the version since it is a required command. Second, it makes sure that the version number used is not too old. A too old version might risk that there are far too big a difference in many commands. Best practice is therefore to keep the same version number throughout a project, unless there is something specific to a newer version that is required for any dofile. Only major and recent versions are allowed in order to reduce errors and complexity. All versions of Stata can be set to run any older version of Stata but not a newer. + +__**ado**path__(_"path/to/folder"_ [, _strict_]) adds the folder specified in this option to the ado-file paths (see `help sysdir`). When _strict_ is not used this option sets the _PERSONAL_ path to the path specified in this command. When _strict_ is used then this option instead sets that path to the _PLUS_ path. Read more in `help sysdir` about the _PERSONAL_ and _PLUS_ paths. When _strict_ is used the all other ado-paths are removed apart from the _BASE_ path where the built-in Stata commands are stored. When preparing a reproducibility package one should use the _strict_ to make sure that all user-written commands are saved in the project ado-folder. If a project should eventually be turned into a reproducibility package, then it is easier to use _strict_ from the beginning and continuously add user-written commands as they are introduced to the project's code. This is easier compared to, in the very end making sure that the correct versions of all user-written commands are installed in the project ado-folder. + +__noclear__ prevents the command from clearing any data set currently loaded into Stata's working memory. The default is to clear data as the working memory needs to be empty in order to modify settings for maxvar, min_memory, max_memory and segmentsize. Nothing saved to hard drive memory will ever be deleted by this command. This command is intended to be placed at the very top of a dofile, before any data is loaded into working memory. For these reasons, __noclear__ and __maxvar()__ cannot be used together. + +__**q**uietly__ suppresses the most verbose outputs from this command, but not the most important outputs. + +__veryquietly__ suppresses all the output from this command. Including the important reminder to set the version number using __r(version)__ after running the command. + +__maxvar__(_numlist_) manually sets the maximum number of variables allowed in a data set. The default is to set the number to the highest allowed in the user's version of Stata. Reducing this number can occasionally improve performance, but it is unlikely to make a difference to a modern computer. This option can be used if a project wants to make sure that the code can run on smaller versions of Stata or small computers. Then the project can use this option to restrict all computers to those limitations, so no one write codes exceeding them. + +__matsize__(_numlist_) manually sets the maximum number of variables allowed in estimation commands, for example regress. The default is to set the number to the highest allowed in the user's version of Stata. Reducing this number can occasionally improve performance, but it is unlikely to make a difference to a modern computer. This option can be used if a project wants to make sure that the code can run on smaller versions of Stata or small computers. Then the project can use this option to restrict all computers to those limitations, so no one write codes exceeding them. + +__**noperm**anently__ is used to disable that this command updates any default settings in a user's installation of Stata. For extensively used best practices, this command updates the default settings such that they apply even after the user has restarted their Stata session. See option permanently in memory (`help memory`) for more details. The setting __set more off__ is always set permanently, regardless of if this option used, as it universally agreed within the Stata community to be better. + +# Examples + +## Example 1 + +``` +ieboilstart, versionnumber(12.1) +`r(version)' +``` + +After running the two lines of code above all users will run their version of Stata as if the version was 12.1. That means that anyone who bought or upgraded their Stata to version 12.1 or a more recent version can run this code and will behave as identical as possible. + +## Example 2 + +``` +local proj_ado "/path/to/project/code/ado" +ieboilstart, opt versionnumber(15.1) adopath_("`proj_ado'", strict) +`r(version)' + +``` + +In this example the Stata version is set to 15.1 and the ado-folders are updated. Let's say a project folder is located at _"/path/to/project"_ and inside it there is a folder called _code_ where all code files are located. This would be a great location for a folder called _ado_ that would be the project specific ado-folder. Since the sub-option _strict_ is used this is the only place where Stata would look for commands that are not built-in commands. Any commands installed by SSC before updating this ado-path is no longer available. Any such commands that is needed in the code for this project needs to be installed again in the project specific ado-folder. Which can be done using __ssc install ...__ the regular way after __ieboilstart__ was run like this. + +# Author + +All commands in ietoolkit is developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group + +Please send bug-reports, suggestions and requests for clarifications writing "ietoolkit ieboilstart" in the subject line to: [dimeanalytics\@worldbank.org](mailto:dimeanalytics@worldbank.org) + +You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through [the GitHub repository of ietoolkit](https://github.com/worldbank/ietoolkit). diff --git a/src/mdhlp/ieddtab.md b/src/mdhlp/ieddtab.md new file mode 100644 index 00000000..39c80118 --- /dev/null +++ b/src/mdhlp/ieddtab.md @@ -0,0 +1,226 @@ +# Title + +__ieddtab__ - This command runs a Diff-in-Diff regression and displays the baseline values, the two 1st differences and the 2nd difference. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Ieddtab) + + +# Syntax + +__ieddtab__ _varlist_ [if] [in] [weight], __**t**ime__(_varname_) __**treat**ment__(_varname_) [ __**covar**iates__(_varlist_) __**vce**__(_vce_types_) __**star**levels__(_numlist_) __stardrop__ __**err**ortype__(_string_) __**rowl**abtype__(_string_) __rowlabtext__(_label_string_) __format__(_%fmt_) __replace__ __**savet**ex__(_filepath_) __onerow__ __nonumbers__ __nonotes__ __**addn**otes__(_string_) __**texdoc**ument__ __**texc**aption__(_string_) __**texl**abel__(_string_) __**texn**otewidth__(_numlist_) __texvspace__(_string_) ] + + +Where varlist is a list of numeric continuous outcome variables (also called dependent variables or left hand side variables) to be used in the difference-in-difference regression(s) this command runs and presents the results from. + + +## Required options: + +| Options | Description | +|-----------------------|-------------| +| __**t**ime__(_varname_) | Time dummy to use in diff-in-diff regression | +| __**treat**ment__(_varname_) | Treatment dummy to use in diff-in-diff regression | + +## Statistics options: + +| Options | Description | +|-----------------------|-------------| +| __**covar**iates__(_varlist_) | Covariates to use in diff-in-diff regression | +| __**vce**__(_vce_types_) | Options for variance estimation. __Robust__, __cluster__ _clustervar_ or __bootstrap__ | +| __**star**levels__(_numlist_) | Significance levels used for significance stars, default values are .1, .05, and .01 | +| __stardrop__ | Suppresses all significance stars in all tables. | +| __**err**ortype__(_string_) | Type of errors to display, default is standard errors. | + + +## Output options: + +| Options | Description | +|-----------------------|-------------| +| __**rowl**abtype__(_string_) | Indicate what to use as row titles, default is variable name. | +| __rowlabtext__(_label_string_) | Manually enter the row titles using label strings (see below). | +| __nonotes__ | Disable that the automatically generated note is displayed below the table. | +| __**addn**otes__(_string_) | Manually add a note to be displayed below the regression result table. | +| __onerow__| Display the number of observations on one row at the last row of the table. | +| __format__(_%fmt_) | Set the rounding format of the calculated statistics in the table. | +| __replace__ | Replace the file on disk if it already exist. Has no effect if no option with file path is used. | + + +## LaTeX options: + +| Options | Description | +|-----------------------|-------------| +| __**savet**ex__(_filepath_) | Generate a LaTeX table of the result and save to the location of the file path. | +| __**texdoc**ument__ | Creates a stand-alone TeX document. | +| __**texc**aption__(_string_) | Specify table's caption on TeX file. | +| __**texl**abel__(_string_) | Specify table's label, used for meta-reference across TeX file. | +| __**texn**otewidth__(_numlist_) | Manually enter the width of the note on the TeX file. | +| __texvspace__(_string_) | Manually set size of the line space between two rows on TeX output. | +| __nonumbers__ | Omit column numbers from table header in LaTeX output. | + + +# Description + +__ieddtab__ is a command that makes it easy to run and display results of differences-in-differences (diff-in-diff) regressions. The table that presents the results from the diff-in-diff regression also presents the mean when the variable in __time()__ is 0 (i.e., baseline) for the two groups defined by the variable __treatment()__ is 0 and 1 (i.e., control and treatment), and the table also presents the coefficient of the first difference regression in control and treatment. + +The sample for each row in the table is defined by the sample included in the second difference regression shown below, where _outcome_var_ is a variable the varlist (one per row) for __ieddtab__, __interaction__ is the interaction dummy listed in __time()__ and the dummy listed in __treatment()__, and where __covariates__ is the list of covariates included in __covariates()__ if any. This means that any observation that has any missing value in either of the two or in any of the covariates will be omitted from all statistics presented in the table. The coefficient presented in the table for the diff-in-diff regression is the interaction of the time and treatment variable. + +``` +tempvar interaction +generate `interaction' = `time' * `treatment' +regress outcome_var `time' `treatment' `interaction' `covariates' +``` + +The baseline means are then calculated using the following code where the first line is control and the second line is treatment, and the variable __regsample__ is dummy indicating if the observation was included in the second difference on. + +``` +mean outcome_var if `treatment' == 0 & `time' == 0 & regsample == 1 +mean outcome_var if `treatment' == 1 & `time' == 0 & regsample == 1 +``` + +The first difference coefficients are then calculated using the following code where the first line is control and the second line is treatment. The coefficient displayed in the table is the coefficient of the variable __time__ which is the variable listed in __t()__. + + +``` +regress outcome_var `time' `covariates' if `treatment' == 0 & regsample == 1 +regress outcome_var `time' `covariates' if `treatment' == 1 & regsample == 1 +``` + +# Options + +## Required options: + +__t__(_varname_) indicates which variable should be used as the time dummy to use in diff-in-diff regression. This must be a dummy variable, i.e., only have 0, 1, or missing as values, where 0 is baseline and 1 is follow-up. + +__treatment__(_varname_) indicates which variable should be used as the treatment dummy to use in diff-in-diff regression. This must be a dummy variable, i.e., only have 0, 1, or missing as values. + +__**Statistics options:**__ + +__**covar**iates__(_varlist_) lists the variables that should be included as covariates (independent variables not reported in the table) in the two first difference regressions and the second difference regression. Unless the option __nonotes__ is used a list of covariate variables is included below the table. + +__**vce**__(_vce_types_) sets the type of variance estimator to be used in all regressions for this command. See __vce_types__ (`help vce_types`) for more details. The only vce types allowed in this command are robust, cluster clustervar, or bootstrap. Option robust only applied to first and second difference estimators, not to baseline means. + +__**star**levels__(_numlist_) sets the significance levels used for significance stars. Exactly three values must be listed if this option is used, all three values must be in descending order, and must be between 0 and 1. The default values are .1, .05, and .01. The levels specified in this option are ignored if __stardrop__ is used. + +__stardrop__ suppresses all significance stars in all tables and removes the note on significance levels from the table note. + +__**err**ortype__(_string_) sets the type of error to display. Allowed values for this option are __se__ for standard errors, __sd__ for standard deviation, and __errhide__ for not displaying any errors in the table. The default is to display standard errors. + +## Output options: + +__**rowl**abtype__(_string_) indicates what to use as row titles. The allowed values are __varname__ using the variable name as row titles, __varlab__ using the variable labels as row titles (varname will still be used if the variable does not have a variable label). The default is to use the variable name. + +__rowlabtext__(_label_string_) manually specifies the row titles using label strings. A label string is a list of variable names followed by the row title for that variable separated by "@@". For example _varA Row title variable A @@ varB Row title variable B_, where _varA_ and _varB_ are outcome variables used in this command. For variables not listed in __rowlabtext()__ row titles will be determined by the input value or default value in __rowlabtype()__. + +__nonotes__ disables that the command automatically generates and displays a note below the table describing the output in the table. The note includes a description on how the number of calculations are calculated, the significance levels used for stars and which covariates were used if any were used. + +__**addn**otes__(_string_) is used to manually add a note to be displayed below the regression result table. This note is put before the automatically generated note, unless option __nonotes__ is specified, in which case only the manually added note is displayed. + +__onerow__ indicates that the number of observations should be displayed on one row at the last row of the table instead of on each row. This requires that the number of observations are the same across all rows for each column. + +__format__(_%fmt_) sets the number formatting/rounding rule for all calculated statistics in the table, that is, all numbers in the table apart from the number of observations. Only valid Stata number formats (see `help format`) are allowed. The default is _%9.2f_. + +__replace__ if an option is used that outputs a file and a file with that name already exists at that location, then Stata will throw an error unless this option is used. If this option is used then Stata overwrites the file on disk with the new output. This option has no effect if no option with file path is used. + +## LaTeX options: + +__**savet**ex__(_filepath_) saves the table in TeX format to the location of the file path. + +__**texdoc**ument__ creates a stand-alone TeX document that can be readily compiled, without the need to import it to a different file. As default, __savetex()__ creates a fragmented TeX file consisting only of a tabular environment. + +__**texc**aption__(_string_) writes table's caption in TeX file. Can only be used with option texdocument. + +__**texl**abel__(_string_) specifies table's label, used for meta-reference across TeX file. Can only be used with option texdocument. + +__**texn**otewidth__(_numlist_) manually adjusts the width of the note to fit the size of the table. The note width is a multiple of text width. If not specified, default is one, which makes the table width equal to text width. + +__texvspace__(_string_) sets the size of the line space between two variable rows. _string_ must consist of a numeric value and one of the following units: "cm", "mm", "pt", "in", "ex" or "em". Note that the resulting line space displayed will be equal to the specified value minus the height of one line of text. Default is "3ex". For more information on units, check [LaTeX lengths manual](https://en.wikibooks.org/wiki/LaTeX/Lengths). + +__nonumbers__ omits column numbers from table header in LaTeX output. Default is to display column numbers. + +# Examples + +All the examples below can be run on Stata's built-in census data set, by first running this code: + +* Open the built-in data set + +``` +sysuse census +``` + +* Calculate rates from absolute numbers + +``` +replace death = 100 * death / pop +replace marriage = 100 * marriage / pop +replace divorce = 100 * divorce / pop +``` + +* Randomly assign time and treatment dummies + +``` +gen t = (runiform()<.5) +gen treatment = (runiform()<.5) +``` + +## Example 1. + +``` +ieddtab death marriage divorce , t(time) treatment(treatment) +``` + +This is the most basic way to run this command with three variables. This will output a table with the baseline means for treatment = 0 and treatment = 1, the first difference regression coefficient for treatment = 0 and treatment = 1 as well as the 2nd difference regression coefficient for treatment = 0 and treatment = 1. + +## Example 2. + +``` +ieddtab death marriage divorce , t(time) treatment(treatment) rowlabtext("death Death Rate @@ divorce Divorce Rate") rowlabtype("varlab") +``` + +The table generated by example 2 will have the same statistics as in example 1 but the row title for the variables death and divorce are entered manually and the row title for marriage will be its variable label instead of its variable name. + +## Example 3. + +``` +ieddtab death marriage divorce , t(time) treatment(treatment) rowlabtype("varlab") savetex("DID table.tex") replace +``` + +The table will be saved in the current directory under the name "DID table.tex". It will have the same statistics as in examples 1 and 2, and the row titles will be its variable labels. + +# Acknowledgements + +This command was initially suggested by Esteban J. Quinones, University of Wisconsin-Madison. + +We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetical order): + +Benjamin Daniels + +Jonas Guthoff + +Nausheen Khan + +Varnitha Kurli + +Saori Iwamoto + +Meyhar Mohammed + +Michael Orevba + +Matteo Ruzzante + +Sakina Shibuya + +Leonardo Viotti + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit ieddtab" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iedropone.md b/src/mdhlp/iedropone.md new file mode 100644 index 00000000..0b305e45 --- /dev/null +++ b/src/mdhlp/iedropone.md @@ -0,0 +1,132 @@ +# Title + +__iedropone__ - an extension of the command `drop` with features preventing additional observations are unintentionally dropped. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Iedropone). + +# Syntax + +__iedropone__ [__if__] , [ __**n**umobs__(_integer_) __mvar__(_varname_) __mval__(_list of values_) __zerook__ ] + +| _options_ | Description | +|-----------|-------------| +| __**n**umobs__(_integer_) | Number of observations that is allowed to be dropped - default is 1 | +| __mvar__(_varname_) | Allows that no observation is dropped | +| __mval__(_list of values_) | Variable for which multiple values should be dropped - must be used together with `mval()` | +| __zerook__ | The list of values in `mvar()` that should be dropped - must be used together with `mvar()` | + +# Description + + + +This commands might be easier to understand by following the examples below before reading the description or the explanations of the options. + +`iedropone` has the same purpose as the Stata built-in command `drop` when dropping observations. +However, `iedropone` safeguards that no additional observations are unintentionally dropped, +or that changes are made to the data so that the observations that are supposed to be dropped are no longer dropped. + +`iedropone` checks that no more or fewer observations than intended are dropped. +For example, in the case that one observation has been identified to be dropped, +then we want to make sure that when re-running the do-file no other observations are dropped +even if more observations are added to that data set or changed in any other way. + +While the default is 1, +`iedropone` allows the user to set any another number of observation that should be dropped. +If the number of observations that fit the drop condition is different, +then the command will throw an error. + +# Options + +__**n**umobs__(_integer_) this allows the user to set the number of observation that should be dropped. +The default is 1 but any positive integer can be used. +The command throws an error if any other number of observations match the drop condition. + +__mvar__(_varname_) and __mval__(_list of values_) allows that multiple values in one variable are dropped. +These two options must be used together. +If the variable in `mvar()` is a string variable +and some of the values in `mval()` includes spaces, +then the list of values in mval() must be listed exactly as in example 4 below. +The command loops over the values in `mval()` +and drops the observations that satisfy the if condition and each of the value in `mval()`. +For example: + +``` +iedropone if village == 100 , mvar(household_id) mval(21 22 23) +``` + +is identical to: + +``` +iedropone if village == 100 & household_id == 21 +iedropone if village == 100 & household_id == 22 +iedropone if village == 100 & household_id == 23 +``` + +The default is that exactly one observation should be dropped for each value in `mval()` +unless `numobs()` or `zerook` is used. +If those options are used then, then they apply to all values in `mval()` separately. + +__mval__(_list of values_) - see __mvar__(_varname_) above. + +__zerook__ allows that no observations are dropped. +The default is that an error is thrown if no observations are dropped. + +# Stored results + + +# Examples + + +## Example 1. + +Let's say that we have identified the household with the ID 712047 to be incorrect and it should be dropped. +Identical to `drop if household_id == 712047` but it will test that +exactly one observation is dropped each time the do-file runs. +This guarantees that we will get an error message that +no observation is dropped if someone makes a change to the ID. +Otherwise we would unknowingly keep this incorrect observation in our data set. + +Similarly, if a new observation is added that is the correct household with ID 712047, +then both observation would be dropped without warning if we would have used `drop if household_id == 712047`. +`iedropone` can be used as below to make sure that only that one observations is dropped. +And if the data changes such that two observations are dropped, +then the command will throw and error. + +``` +iedropone if household_id == 712047 +``` + +## Example 2. + +Let's say we have added a new household with the ID 712047. +In order to drop only one of those observations we must expand +the if-condition to indicate which one of them we want to drop. + +``` +iedropone if household_id == 712047 & household_head == "Bob Smith" +``` + +## Example 3. + +Let's say we added a new household with the ID 712047 but we want to drop exactly both of them, +then we can use the option `numobs()`. +The command will now throw an error if not exactly +two observations have the household ID 712047. + +``` +iedropone if household_id == 712047, numobs(2) +``` + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit iedropone" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iefolder.md b/src/mdhlp/iefolder.md new file mode 100644 index 00000000..5dd97593 --- /dev/null +++ b/src/mdhlp/iefolder.md @@ -0,0 +1,273 @@ +# Title + +__iefolder__ - sets up project folders and master do-files according to World Bank DIME's standards. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Iefolder) + +# Syntax + +_When initially setting up the `DataWork` folder in a new project_: + +__iefolder__ new _project_name_ , __**proj**ectfolder__(_directory_) + +_When adding folders to and already existing `DataWork` folder_: + +__iefolder__ new _item_type_ _item_name_ , __**proj**ectfolder__(_directory_) [__abbreviation__(_string_) __subfolder__(_folder_)] + +where _item_type_ is either _round_, _unitofobs_ or _subfolder_. See details on _item_type_ and _item_name_ below. + +| _options_ | Description | +|-----------|-------------| +| __**proj**ectfolder__(_directory_) | The location of the project folder where the _DataWork_ folder should be created (new projects), or where it is located (new rounds, unitofobs and subfolders). | +| __abbreviation__(_string_) | Optional abbreviation of round name to be used to make globals shorter. Can only be used with `iefolder new round`. | +| __subfolder__(_folder_) | Creates the round folders inside a subfolder to _DataWork_. Only works with new rounds and only after the subfolder has been created with `iefolder new subfolder`. | + +# Description + +`iefolder` automates the process of setting up the folders and +master do-files where all the data work will take place in a project folder. +The folder structure set up by `iefolder` follows DIME's best practices. + +In addition to setting up the _DataWork_ folder and its folder structure, +the command creates master do-files linking to +all main folders in the folder structure. +These master do-files are updated whenever more rounds, +units of observations, and subfolders are added to +the project folder using this command. + +## Item types + +This command can create either a new _DataWork_ folder or add folders +to an existing _DataWork_ folder. +The existing _DataWork_ folder must have been created with +`iefolder` for the additions to work. +A new _DataWork_ folder is created using specifying project. +There are three types of folders that can be added to an existing folder +by specifying _round_, _unitofobs_ or _subfolder_. +See the next paragraphs for descriptions. + +__project__ sets up a new _DataWork_ folder and its initial folder structure. +You must always do this before you can do anything else. +It also sets up the main master do-file for this _DataWork_ folder. +`iefolder` is implemented so that you can keep working for years +with your project in between adding folders. +The command reads and preserves changes made manually to the _DataWork_ folder +and master do-file before adding more folders using `iefolder`. + +__round__ folders are folders specific to a data collection round, +for example, Baseline, Endline, Follow Up etc. +(See subfolder below if your project is more complex than that.) +When adding a new round, a round folder is added to the _DataWork_ folder, +and inside it the round folder structure described +[here](https://dimewik/wiki/DataWork_Survey_Round) is created. +`iefolder` also creates a master do-file specific for this round with +globals referencing the main folders in the folder structure +specific to this round. +Folders are created in two places, both in the _DataWork_ folder, +and in the Encrypted folder. + +__unitofobs__ folders are folders specific to a unit of observation, +for example the master data set folder. +Read more about master data sets and the folder structure +this commands sets up for you at here. +A master data folder for each new unit of observation is created in two places. +Both in the MasterData folder in the _DataWork_ folder, +and in the Encrypted folder. + +__subfolder__ can be used to organize project folders with +a lot of data collections. +For examples, instead of having only one baseline data collection, +a project might have a student, a teacher, +and a school data collections during baseline. +You can then first create a baseline folder in the project folder using +_subfolder_ and then creating round-folders for student, teacher, school, etc., +inside the sub-folder suing _round_ with the option __subfolder__(_baseeline_). +When creating a subfolder, +only a single folder is created in the _DataWork_ folder which is empty. +The main master do-file is however updated with a global to this folder. + +# Options + +__**proj**ectfolder__(_directory_) should point to the same folder +regardless of which _item_type_ is created. +If new project is specified, +the file path should point to where _DataWork_ should be created, +and if new round or new project is specified, +it should point to where _DataWork_ was already created. +See how the file path is the same both time when `iefolder` +is called twice in Example 1 below. + +__abbreviation__(_string_) can be used to shorten the globals created +in the master do-files that point to the sub-folders to round folders. +For example, if you create a new round called Baseline, +as in Example 1, then a global to the _DataSet_ folder called Baseline_dt +will be created in the master do-file. +If the abbreviation option would have been used, +like in Example 2, then the global would have been called BL_dt. + +__subfolder__(_folder_) creates a round folder inside +the folder specified in this option. +This option can only be used when creating a new round. +The folder specified must have been created using `iefolder`. See example 3. + +# Examples + +## Example 1 + +``` +global projectFolder "C:/Users/Documents/DropBox/ProjectABC" + +iefolder new project , projectfolder("$projectFolder") +iefolder new round baseline , projectfolder("$projectFolder") +``` + +In the example above, in the line the first time `iefolder` is used, +a folder called _DataWork_ is created at the location of +`C:/Users/Documents/DropBox/ProjectABC`. +In the line where `iefolder` used a second time, +a folder for the baseline round is created inside the _DataWork_ folder. +Note that the folder provided in `projectfolder()` is the same both times. + +Both the _DataWork_ folder and the baseline folder created have +sub-folders and master do-files creating globals pointing to these. + +## Example 2 + +``` +global projectFolder "C:/Users/Documents/DropBox/ProjectABC" + +iefolder new project , projectfolder("$projectFolder") +iefolder new round baseline , projectfolder("$projectFolder") abbreviation("BL") +``` + +The example above creates the same folder structure as in Example 1, +but in the globals in the master do-files the abbreviation BL +is used instead of baseline. +But the folders created on disk will still be called baseline. + +## Example 3 + +This example shows how to use subfolders. + +``` +global projectFolder "C:/Users/Documents/DropBox/ProjectABC" + +iefolder new project , projectfolder("$projectFolder") + +iefolder new subfolder baseline , projectfolder("$projectFolder") +iefolder new round studentBL , projectfolder("$projectFolder") subfolder("baseline") +iefolder new round teacherBL , projectfolder("$projectFolder") subfolder("baseline") +``` + +The code above creates a new _DataWork_ folder inside the folder ProjectABC. +Then subfolder is used to create a folder called baseline. +Then the two baseline rounds, student and teacher, +are created inside the folder baseline. + +The code below shows how the endline folder can be created in the same folder. +Note that the rounds need to have unique names even across subfolders, +and that is why the student and teacher round have the suffix EL. + +``` +global projectFolder "C:/Users/Documents/DropBox/ProjectABC" + +iefolder new subfolder endline , projectfolder("$projectFolder") +iefolder new round studentEL , projectfolder("$projectFolder") subfolder("endline") +iefolder new round teacherEL , projectfolder("$projectFolder") subfolder("endline") +``` + +## Example 4 + +The example below is meant to describe an intended workflow +for a full life cycle of an impact evaluation. +First we need to set up the _DataWork_ folder. +We do that using `iefolder new project`. Like this: + +``` +iefolder new project , projectfolder("C:/DropBox/ProjectABC") +``` + +Our first data collection will be a baseline +where the unit of observation is households. +We therefore need to set up folders for the unit of observation "households". +In the encrypted master folder for "households" +you can create your list over households and you have a subfolder called Sampling +where you can keep do files and data with identifying information. +We create all of that by using `iefolder new unitofobs household`. Like this: + +``` +iefolder new unitofobs household , projectfolder("C:/DropBox/ProjectABC") abbreviation("BL") +``` + +When we are ready to start preparing for the baseline +we want to create the baseline folder. +We do that using `iefolder new round baseline`. Like this: + +``` +iefolder new round baseline , projectfolder("C:/DropBox/ProjectABC") abbreviation("BL") +``` + +At this point we can collect the baseline data, +save the data in the folders we created and write the report. +Then long stretches of time might pass before we need to use the command. + +Let's say that when we plan for midline +we also want to collect data about the villages +that the households we interview in baseline live in. +Then we need to create a new master folder for the unit of observation villages. +We do that using `iefolder new unitofobs village`. Like this: + +``` +iefolder new unitofobs village , projectfolder("C:/DropBox/ProjectABC") +``` + +Then we need to create the rounds used for the midline round +for both households and for villages. +Since this is separate data collection +(although they might happen at the same time). +We create those folders like this: + +``` +iefolder new round midline , projectfolder("C:/DropBox/ProjectABC") abbreviation("ML") +iefolder new round midlineVillage, projectfolder("C:/DropBox/ProjectABC") abbreviation("MLvill") +``` + +Finally, in the last round of data collection, +we are only collecting data on households again. +Since we are not collecting data on any new unit of observation, +we do not need to create any new master folder. + +``` +iefolder new round endline , projectfolder("C:/DropBox/ProjectABC") abbreviation("EL") +``` + +# Acknowledgements + +This command was initially suggested by Esteban J. Quinones, University of Wisconsin-Madison. + +We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetical order): + +Guadalupe Bedoya + +Laura Costica + +Mrijan Rimal + +Sakina Shibuya + +Seungmin Lee + + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit iefolder" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iegitaddmd.md b/src/mdhlp/iegitaddmd.md new file mode 100644 index 00000000..d1ce1726 --- /dev/null +++ b/src/mdhlp/iegitaddmd.md @@ -0,0 +1,173 @@ +# Title + +__iegitaddmd__ - Creates a placeholder file in subfolders of a GitHub repository folder, which allows committing folder structures with empty folders. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Iegitaddmd). + +# Syntax + +__iegitaddmd__ , __folder__(_full_file_path_) [ __comparefolder__(_full_file_path_) __customfile__(_filename_) __all__ __skip__ __replace__ __skipfolders__(_folder_name_) __**auto**matic__ __**dry**run__ ] + +| _options_ | Description | +|-----------|-------------| +| __folder__(_full_file_path_) | Specifies the folder path to the project folder clone where placeholder files will be created | +| __comparefolder__(_full_file_path_) | Specifies the top folder of a folder tree to be compared with `folder()` | +| __customfile__(_filename_) | Specifies a file saved on disk that is used instead of the default file as placeholder | +| __all__ | Creates the placeholder file in every subfolder of `folder()`, whether empty or not | +| __skip__ | If option `all` is used and a folder has a file with same name as placeholder file, then nothing is done | +| __replace__ | If option `all` is used and a folder has a file with same name as placeholder file, then the file is overwritten | +| __skipfolders__(_folder_name_) | List of folders to be skipped. The hidden folder _.git_ is always added to this list, even when option `skip` is not used | +| __**auto**matic__ | Makes the command create placeholder files without prompting the user for each file | +| __**dry**run__ | Makes the command list all the files that would have been created without this option | + +# Description + +Git/GitHub does not "_sync_" empty folders, or folder that only contain ignored files. +However, it is common in research projects that these types of folders needs to be shared anyways. +`iegitaddmd` provides a solution to this by creating placeholder files in in these folders. +This placeholder file can then be shared to GitHub and that way the folder is also shared. +`iegitaddmd` is developed with two use cases in mind described below. + + +`Use case 1.` It is common in the beginning of a research project that +a standardized folder structure is set up (for example with `iefolder`) +where some folders that are created are not yet needed. +A common example, is output folders. +If these folders are not shared at the time they are created, +different team members will create them ad-hoc when needed. +That typically leads to them being named differently +which is confusing and could in turn lead to errors. +`iegitaddmd` can solve this by scanning a project folder for all sub-folders +that are completely empty, and create a placeholder file in those folder. + +The solution to this use case in `iegitaddmd` is a Stata adaptation of Solution B in +[this post](https://bytefreaks.net/gnulinux/bash/how-to-add-automatically-all-empty-folders-in-git-repository). + +`Use case 2.` The second use case is when an already ongoing project is transferred to Git/GitHub. +Then, many files and folders are copied from wherever +they were stored before (for example DropBox) to a clone of the repository. +Files not meant to be shared on GitHub can (and should) be ignored using the _.gitignore_ file. +However, this is likely to create empty folders that are not shared on GitHub. +A clone of this repo would then miss those folder but they might be required folders like + output folder or folders for intermediate data. +`iegitaddmd` can solve this by scanning the project folder in the old location +and for each sub-folder that exist in the old location but not in the clone +create that folder and put a place holder file in it. +In this use case the option `comparefolder()` is used to indicate that +the clone should be compared to another folder. + +The default placeholder file used is named `README.md` and its content explains that it is a placeholder file. +That file name is a special name on GitHub, +and whenever one navigate to a folder on GitHub.com with a `README.md` file, +the content of that file is displayed on that web page. +The placeholder file may be removed as soon as files have been added to the folder. +Or perhaps even better is to keep the file, but edit the content of it such that +it documents the content of that folder for all other team members. + +# Options + +__folder__(_full_file_path_) is the folder path to the project folder clone where the placeholder files will be created. + +__comparefolder__(_full_file_path_) is used to compare a file tree in a different location +and create folders with placeholder files in all folders that exist in +`comparefolder()` but not in `folder()`. +If a folder that does no exist in `folder()` has a subfolder, +then both the folder and the subfolder will be created, + but the placeholder file is only crated in the sub-folder. + This is sufficient for sharing both the folder and the subfolder in GitHub. + If the `comparefolder()` and `folder()` ends with folders with different names, + for example `folder(${project}/datawork/baseline)` and `comparefolder(${project}/datawork)`, + then the command will throw an error as it is likely that + the paths do not point to corresponding folders in the two folder trees. + +__customfile__(_filename_) allows the user to specify a file saved on the computer +to be used as the placeholder file instead of the default `README.md` file. +This allows anyone to write their own template placeholder files according to their own preferences. +We recommend that a file of type .md (markdown) +and name README.md is used such that the content is displayed when someone navigate to that folder on GitHub.com. +But this is not a technical requirement, any file type and name can be used as placeholder file. + +__all__ creates the placeholder file in `folder()` and in every subfolder, regardless if they are empty or not. +This allows the user to create a placeholder file in every folder that can be +edited with documentation and instructions to the purpose and usage of each subfolder. +This option can also be important when _.gitignore_ is used, +as `iegitaddmd` will not create files to subfolders that +only has ignored file -- in which case the folder will not be synced by GitHub. + +__skip__ and __replace__ tells `iegitaddmd` what to do if the option `all` is used +and if any of the folders contain a file with the exact same name as the file the command is trying to create. +If a file with the same name as the placeholder file exist and neither of these options are used, +then the command will throw an error. +If `skip` is used, then nothing is done in the folder where the file with the same name exists +and the command proceeds to the next folder. +If `replace` is used then the file with the same name is overwritten with +the new placeholder file before the command proceeds to the next folder. + +__skipfolders__(_folder_names_) is used to list folders in which a placeholder file should never be created. +You should not list the full folder path in this option, just the folder name. +All folders with that name will be skipped regardless of their location in the project folder. +Any sub-folder of these folders will also be skipped. +A folder name may be listed with or without quotation marks as long as there are no spaces in the names. +If any of the folder names has spaces, then quotation marks must be used for all folder names. + +__**auto**matic__ can be used to speed up the creation of placeholders by +telling the command to not prompt the users for confirmation for each file before it is created. +The default is that the command is asking the user before creating each place holder file. +This option should only be used when you are confident you have specified the correct folder paths. +We recommend that you use the `dryrun` with this option to make sure that the folder paths are correct. + +__**dry**run__ can be used to safely test that the folder paths are +specified correctly before any placeholder files are created. +When this option it used the command simply lists the file +that would have been created if this option were not used. +Once you are confident that list is correct, +you can remove this option and re-run the command and the files will be created. + +# Stored results + + +# Examples + +## Example 1 + + +In this example, there is a GitHub repository in the folder _ProjectA_. +This repository has a folder structure where +some folders are still empty but will later be populated with files. +In order to have all folders, even the empty ones, +synced on all collaborators' cloned local copies of the repository, +the folders need to contain at least one file, +which is being created by the command. + +``` +global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectA" +iegitaddmd , folder("$github_folder") +``` + + +## Example 2 + +In this example, there is a GitHub repository in the folder _ProjectB_. +This is a project similar to _ProjectA_ above but it has two folders, +called foo and bar in which no placeholder files should ever be created in. +Any subfolders in foo or bar will be skipped as well. +The folder _.git_ is a system folder in git repositories and will always be skipped. + +``` +global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectB" +iegitaddmd , folder("$github_folder") skipfolders("foo" "bar") +``` + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit iegitaddmd" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iegraph.md b/src/mdhlp/iegraph.md new file mode 100644 index 00000000..d3baffb7 --- /dev/null +++ b/src/mdhlp/iegraph.md @@ -0,0 +1,247 @@ +# Title + +__iegraph__ - Generates graphs based on regressions with treatment dummies common in impact evaluations. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Ietoolkit). + +# Syntax + +__iegraph__ , _varlist_ , [ __**basicti**tle__(_string_) __**varl**abels__ __save__(_string_) __**gray**scale__ __yzero__ __**barl**abel__ __**mlabc**olor__(_colorname_) __**mlabp**osition__(_clockpos_) __**mlabs**ize__(_size_) __barlabelformat__ __noconfbars__ __confbarsnone__(_varlist_) __confintval__(_numlist_) __norestore__ __**baropt**ions__(_string_) __ignoredummytest__ _twoway_scatter_options_ ] + + +| _options_ | Description | +|-----------|-------------| +| __**basicti**tle__(_string_) | Manually sets the title of the graph | +| __**varl**abels__ | Uses variable labels for legends instead of variable names | +| __save__(_string_) | Sets the filename and the directory to which the graph will be set/exported | +| __**gray**scale__ | Uses grayscales for the bars instead of colors | +| __yzero__ | Forces y-axis on the graph to start at 0 | +| __**barl**abel__ | Adds a label on top of the bars with their respective values | +| __**mlabc**olor__(_colorname_) | Manually set the colors of the bars | +| __**mlabp**osition__(_clockposstyle_) | Set color of bar label | +| __**mlabs**ize__(_size_) | Set position of bar label | +| __barlabelformat__ | Set font size of bar label | +| __noconfbars__ | Customizes format of bar label. Must be used with `barlabel` | +| __confbarsnone__(_varlist_) | Removes the confidence interval bars from graphs for all treatments | +| __confintval__(_numlist_) | Sets the confidence interval for the confidence interval bars. Default is .95 | +| __norestore__ | Allows you to debug your two way graph settings on the data set prepared by iegraph. To be used with `r(cmd)` | +| __**baropt**ions__(_string_) | Allows you to add formatting to the bars | +| __ignoredummytest__ | Ignores the tests that tests if the dummies fits one of the two models below | + +Any _twoway graph scatter_ options that can be used with +regular _twoway graph scatter_ commands can also be used. +If any of these commands conflict with any of the built in options, +then the user specified settings have precedence. +See example 2 for details. + +# Description + +`iegraph` is a command creates bar graphs based on +coefficients of treatment dummies in regression results. +This command is developed for reading stored results from +two types of common impact evaluation regression models, +but there are countless of other examples where the command also can be used. +`iegraph` must be used immediately after running the regression +or after the regression result is restored using Stata's _ereturn results_. + +## Model 1: OLS with Treatment Dummies +The most typical impact evaluation regression is to have the outcome variable +as the dependent variable and one dummy for each treatment arm +where control is the omitted category. +These regressions can also include covariates, fixed effects etc., +but as long as the treatment status is defined by mutually exclusive dummy variables. +See especially examples 1 and 2 below. +This command works with any number of treatment arms +but works best from two arms (treatment and control) +to five treatment arms (4 different treatments and control). +More arms than that may result in a still correct but perhaps cluttered graph. + +## Model 2: Difference-in-Differences +Another typical regression model in impact evaluations +are difference-in-difference (Diff-in-Diff) +models with two treatment arms (treatment and control) and two time periods. +If the Diff-in-Diff regression is specified as having the outcome variable +as the dependent variable and three dummy variables (time, treatment and time*treatment) +as the independent variables, +then this command will produce a nice graph. +Controls, treatment effects etc. may be added to the regression model. +See especially example 3. + +## Graph Output +The graph generated by this command is created using the following values. +The control bar is the mean of the outcome variable for the control group. +It is not the constant from the regression as those are not identical if, +for example, fixed effects and covariates were used. +For each treatment group the bar is the sum of the value of the control bar +and the beta coefficient in the regression of the corresponding treatment dummy. +The confidence intervals are calculated from the variance in +the beta coefficients in the regression. + +The graph also includes the N for each treatment arm in the regression +and uses that value as labels on the x-axis. +Stars are added to this value if the corresponding +coefficient is statistically different from zero in the regression + +# Options + +__**basicti**tle__(_string_) manually sets the title of the graph. +To apply formatting like title size, position, etc., +use Stata's built in `title()` option instead. + + __**varl**abels__ sets the legends to the variable labels for the variables + instead of the variable names. + + __save__(_string_) sets the legends to the variable labels + for the variables instead of the variable names. + + __**gray**scale__ uses grayscale for the bars instead of colors. + The color of the control bar will be black and the treatment bar will + run in equal shade differences from light grey to dark grey. + + __yzero__ manually sets the y-axis of the graph to start at zero instead of the Stata default. + In many cases, we expect that neither + the default settings nor this option will make the axes look perfect, + but you may use Stata's built in axis options + that allow you to set the axes to perfectly fit your data. + The command will ignore the `yzero` option in cases where the graph cannot + be forced to zero i.e. where the values in the graph extend beyond zero, + both positively or negatively. + A warning will be displayed telling the user that the option has been ignored. + Despite the warning, the graph will be produced correctly. + + __**barl**abel__ adds a label on top of the bars with their respective values. + Equivalent to specifying option `blabel(bar)` in a _bar graph_ (see `help graph_bar`). + + __**mlabc**olor__(_colorname_) sets color of bar label. + May only be used with the `barlabel` option. + See `help colorname` for valid values. + + __**mlabp**osition__(_clockpos_) sets position of bar label. + May only be used with the `barlabel` option. + See `help clockposstyle` for valid values. + + __**mlabs**ize__(_size_) sets size of bar label. + May only be used with the `barlabel` option. + See `help textsizestyle` for valid values. + + __barlabelformat__ customizes `barlabel` format. + May only be used with the `barlabel` option. + Options allowed have the formats _%#.#f_ or _%#.#e_. + Default if _%9.1f_. See `help format` for valid formats. + + __noconfbars__ removes the confidence interval bars from graphs for all treatments. + The default value for the confidence interval bars is 95%. + + __confbarsnone__(_varlist_) removes confidence interval bars + from only the _varlist_ listed. + The remaining variables in the graphs which have not been specified + in option `confbarsnone` will still have the confidence interval bars. + + __confintval__(_numlist_) sets the confidence interval for the confidence interval bars. + Default is .95. Values between 0 and 1 are allowed. + + __norestore__ returns the data set that `iegraph` prepares to create the graph. + This is helpful when de-bugging how one of Stata's many graph options + can be applied to an `iegraph` graph. + This option is meant to be used in combination with + the returned result in `r(cmd)`. + `r(cmd)` gives you the line of code `iegraph` prepares to create the graph + and `norestore` gives you access to the data that code is meant to be used on. + This approach will help you de-bug how to apply + Stata's built in graph options to an `iegraph` graph. + Note that this option deletes any unsaved changes made to your data in memory. + + __**baropt**ions__(_string_) allows you to add formatting options + that are applied to each bar and not the graph itself. + Example of such option are _twoway_bar_ options and _axis_options_ options. + It is not possible to use this option to add formatting to individual bars. + Everything added in this option is added to all bars. + Formatting added in this option takes precedence over + any default formatting or formatting set in any other option. + + __ignoredummytest__ ignores the tests that test if the dummies + fits one of the two models this command is intended for. + The two models are described in detail above. + There might be models we have not thought of for which this command is helpful as well. + Use this option to lift the restrictions of those two models. + But be careful, this command has not been tested for other models than the two described. + +# Stored results + + +# Examples + +## Example 1 + +``` +regress outcomevar treatment_dummy +iegraph treatment_dummy , basictitle("Treatment Effect on Outcome") +``` + +In the example above, there are only two treatment arms (treatment and control). +_treatment_dummy_ has a 1 for all treatment observations and a 0 for all control observations. +The graph will have one bar for control and it shows +the mean for _outcomevar_ for all observations in control. +The second bar in the graph will be the sum of that mean +and the coefficient for _treatment_dummy_ in the regression. +The graph will also have the title: _Treatment Effect on Outcome_. + +## Example 2 + +``` +regress income tmt_1 tmt_2 age education, cluster(district) +iegraph tmt_1 tmt_2, noconfbars yzero basictitle("Treatment effect on income") +``` + +In the example above, the treatment effect on income in researched. +There are three treatment arms; control, treatment 1 (_tmt_1_) and treatment 2 (_tmt_2_). +It is important that no observation has the value 1 in both _tmt_1_ and _tmt_2_ +(i.e. no observation is in more than one treatment) +and some observations must have the value 0 in both _tmt_1_ and _tmt_2_ +(i.e. control observations). +The variables age and education are covariates (control variables) +and are not included in `iegraph`. +The option `noconfbars` omits the confidence interval bars, +and `yzero` sets the y-axis to start at 0. + +## Example 3 + +``` +regress chld_wght time treat timeXtreat +iegraph time treat timeXtreat , basictitle("Treatment effect on Child Weight (Diff-in-Diff)") +``` + +In the example above, the data set is a panel data set +with two time periods and the regression estimates the treatment effect +on child weight using a _Difference-in-Differences_ model. +The dummy variable time indicates if it is time period 0 or 1. +The dummy variable treat indicates if the observation is treatment or control. +_timeXtreat_ is the interaction term of time and treat. +This the standard way to set up a _Difference-in-Differences_ regression model. + +## Example 4 + +``` +regress harvest T1 T2 T3 +iegraph T1 T2 T3 , basictitle("Treatment effect on harvest") xlabel(,angle(45)) yzero ylabel(minmax) save("Graph1.gph")} +``` + +The example above shows how to save a graph to disk. +It also shows that most two-way graph options can be used. +In this example, +the `iegraph` option `yzero` conflicts with the two-way option `ylabel(minmax)`. +In such a case the user specified option takes precedence over `iegraph` options like `yzero`. + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications +writing "ietoolkit iegraph" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Author + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iekdensity.md b/src/mdhlp/iekdensity.md new file mode 100644 index 00000000..f54354aa --- /dev/null +++ b/src/mdhlp/iekdensity.md @@ -0,0 +1,191 @@ +# Title + +__iekdensity__ - This command plots univariate kernel density estimates by treatment assignment. + +# Syntax + +__iekdensity__ _yvar_ [if] [in] [weight] , __by__(_treatmentvar_) + [ __stat__(_string_) __statstyle__(_string_) __effect__ __control__(_numlist_) __effectformat__(_%fmt_) __**abs**orb__(_varname_) __**reg**ressionoptions__(_string_) __**kdensity**options__(_string_) __color__(_string_) + _twoway_options_ ] + +Where _yvar_ is a numeric continuous outcome variable, whose distribution is to be plotted by treatment assignment. + +| _options_ | Description | +|-----------|-------------| +| __by__(_treatmentvar_) | Treatment (dummy or factor) variable. | + +## Content options: + +| _options_ | Description | +|-----------|-------------| +| __stat__(_string_) | Add vertical lines for each treatment group with statistic specified. | +| __statstyle__(_string_) | Specify graphic style of statistic lines. | +| __effect__ | Add note with treatment effect, containing point estimate, standard error, and p-value. | +| __control__(_numlist_) | Specify value of variable for control group. | +| __effectformat__(_%fmt_) | Specify format of point estimate and standard error of the treatment effect. | + +## Estimation options: +| _options_ | Description | +|-----------|-------------| +| __**abs**orb__(_varname_) | Specify fixed effects variable, if any. | +| __**reg**ressionoptions__(_string_) | Specify regression options. | +| __**kdensity**options__(_string_) | Specify kernel estimation options. | + +## Graphic options: +| _options_ | Description | +|-----------|-------------| +| __color__(_string_) | Specify colors for each group. | +| _twoway_options_ | Specify graph options. | + + +# Description + +__iekdensity__ is a command that allows to easily plot the distribution of a variable by treatment group. It also allows to include additional information, such as descriptive statistics and treatment effect(s). + +# Options + +## Required options: + +__by__(treatmentvar) indicates which variable should be used to idenfity the treatment assignment. This can be a dummy variable (0/1) or a factor variable, when there are multiple treatments. + +## Content options + +__stat__(_string_) specifies a descriptive statitistic to be plotted over the kernel density graph. In particular, vertical lines for each treatment group are added. Accepted statistics are: _mean, p1, p5, p50, p75, p90, p95, p99, min_ and _max_. + +__statstyle__(_string_) specifies the graphic style to be used for the statistic lines. Namely, you will be able to use __lpattern__(linepatternstyle) and __lwidth__(linewidthstyle) opt ad controlled by option __color__(_string_). + +__effect__ adds a note with treatment effect, containing point estimate, standard error, and p-value, to the graph. + +__control__(_numlist_) indicates which value the variable __by__(_treatmentvar_) takes for the control group. This is usually equal to 0 when the treatment is binary, but may vary when dealing wi arms. + +__effectformat__(_%fmt_) specify the format in which treatment effect point estimate and standard error should be displayed in the graph note. + +## Estimation options: + +__**abs**orb__(_varname_) indicates the fixed effects variable (for example, the experimental strata when the treatment was stratified) to be included in the estimation. This variable must be numerical. + +__**reg**ressionoptions__(_string_) indicates other options to be employed for the treatment effect estimations, for example suppress constant term (__**nocons**tant__) or clustered standard errors (__**cl**uster__(_varname_)). Al regress (or areg when option __absorb()__ is specified) are accepted. + +__**kdensity**options__(_string_) specifies kernel estimation options, such as kernel function and half-width of kernel. The default kernel function is __kernel__(_epanechnikov_). Many options accepted by kdensity are : __kernel__(_kernel_), __bwidth__(_#_), __n__(_#_), and all the _cline_options_ (see `help cline_options`) for univariate kernel density estimation. + +## Graphic options: + +__color__(_string_) indicates the colors to be used for each treatment arm. The colors should come in the order of the values in __by__(_treatmentvar_). For instance, if the treatment is binary, you can set the line colors (color1 color2). See _colorstyle_ (`help colorstyle`). + +_twoway_options_ indicates other options to be applied to the graph, such as additional text and lines, changes axes, titles, and legend, etc. (See `help twoway_options`) + +# Examples +All the examples below can be run on the Stata's built in automobile data set, by first running this code: + +* Open the built in data set + +``` +sysuse auto +``` + +* Randomly assign time and treatment dummies + +``` +gen treatment = (runiform() < .5) +``` + +## Example 1 + +``` +iekdensity auto , by(treatment) +``` + +This is the most basic way to run this command. This will output a graph with the distributions of of the variable of interests (price in this case) by treatment assignment. + +## Example 2 + +``` +iekdensity auto , by((treatment) stat(p50) +``` + +This is an easy way to add descriptive information to the graph. This will output the same graph as above with the addition of two vertical lines for the medians of the control and treatment groups. + +## Example 2.1 + +``` +iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) +``` + +This changes the style of the median vertical lines. + +## Example 2.2 + +``` +iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) color(eltblue edkblue) +``` + +This sets the colors of the control and treatment lines to different shades of blue. + +## Example 2.3 + +``` +iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) title(auto distribution) subtitle(By Treatment Assignment) +graphregion(color(white)) plotregion(color(white)) +``` + +This changes some of the graphical options. + +## Example 3 + +``` +iekdensity auto , by(treatment) stat(p50) effect +``` + +This adds a note to the graph, displaying the treatment effect in terms of point estimate, standard error and statistical significance. + +## Example 3.1 + +``` +iekdensity auto , by(treatment) stat(p50) effect effectformat(%9.0fc) +``` + +This changes the format of the treatment effect in the note. The point estimate and the standard error now do not include any decimal points. + + +## Example 4 + +``` +iekdensity auto , by(treatment) effect absorb(foreign) +``` + +The treatment effect is now derived from a regression controlling for the variable _foreign_ fixed effects. + +## Example 4.1 + +``` +iekdensity auto , by(treatment) effect absorb(foreign) regressionoptions(cluster(foreign)) +``` + +The treatment effect is now derived from a regression controlling for the variable foreign fixed effects and clustering standard errors at _foreign_ level. + +## Example 5 + +``` +iekdensity auto , by(treatment) kdensityoptions(epan2 bwidth(5)) +``` + +The kernel density is estimated through the alternative Epanechnikov kernel function and half-width of the kernel is specified to be equal to 5. + +# Acknowledgements + +We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order): +Luiza Andrade + + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications writing "ietoolkit iekdensity" in the subject line to: dimeanalytics@worldbank.org + + +You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + +# Authors + +All commands in `ietoolkit` are developed by DIME Analytics at DIME, The World Bank's department for Development Impact Evaluations. + +Main author: Matteo Ruzzante, DIME, The World Bank Group. diff --git a/src/mdhlp/iematch.md b/src/mdhlp/iematch.md new file mode 100644 index 00000000..14a71eaa --- /dev/null +++ b/src/mdhlp/iematch.md @@ -0,0 +1,149 @@ +# Title + +__iematch__ - Matching base observations towards target observations using on a single continous variable. + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Iematch). + +# Syntax + +__iematch__ [if] [in] , __**grp**dummy__(_varname_) __**match**var__(_varname_) [ __**id**var__(_varname_) __m1__ __maxdiff__(_numlist_) __maxmatch__(_integer_) __seedok__ __**matchid**name__(_string_) __**matchdi**ffname__(_string_) __**matchre**sultname__(_string_) __**matchco**untname__(_string_) __replace__ ] + +| _options_ | Description | +|-----------|-------------| +| __**grp**dummy__(_varname_) | The group dummy variable where 1 indicates base observations and 0 target observations | +| __**match**var__(_varname_) | The variable with a continous value to match on | +| __**id**var__(_varname_) | The uniquely and fully identifying ID variable. Used to indicate which target observation a base observation is match with. If omitted an ID variable will be created. See below if you have multiple ID vars. | +| __maxdiff__(_numlist_) | Set a maximum difference allowed in __matchvar()__. If a base observation has no match within this difference then it will remain unmatched | +| __m1__ | Allows many-to-one matches. The default is to allow only one-to-one matches. See the description section. | +| __maxmatch__(_integer_) | Sets the maximum number of base observations that each target observation is allowed to match with in a __m1__ (many-to-one) match. | +| __seedok__ | Supresses the error message thrown when there are duplicates in __matchvar()__. When there are duplicates, the seed needs to be set in order to have a replicable match. The __seed__ (see `help set seed`) should be set before this command. | +| __**matchre**sultname__(_string_) | Manually sets the name of the variable that indicates if an observation was matched, or provide a reason why it was not. The default is _matchResult | +| __**matchid**name__(_string_) | Manually sets the name of the variable that indicates which target observation each base observation is matched with. The default is _matchID | +| __**matchdi**ffname__(_string_) | Manually sets the name of the variable that indicates the differnece in __matchvar()__ in each match pair/group. The default is _matchDiff | +| __**matchco**untname__(_string_) | Manually sets the name of the variable that indicates how many observations a target observation is matched with in a many-to-one matches. The default is _matchCount | +| __replace__ | Replaces variables in memory if there are name conflicts when generating the output variables. | + + +# Description + +__iematch__ matches base observations towards target observations in terms of nearest value in __matchvar()__. Base observations are observations with value 1 in __grpdummy()__ and target observations are observations with value 0. For example, in a typical p-score match, base observations are treatment and target is control, however, there are many other examples of matching where it could be different. + +__iematch__ bases its matching algorithm on the Stable Marriage algorithm. This algorithm was chosen because it always provides a solution and allows stable matching even if multiple observations have identical match values (see __seed()__ option for more details). One disadvantage of this algorithm is that it takes into account local efficiency only, and not global efficiency. This means that it is possible that other matching algorithms might generate a more efficient match in terms of the sum of the difference of all matched pairs/groups. + +## One-to-one matching algorithm + +The algorithm used in a one-to-one match starts by evaluating which target observation each base observation is closest to and vice versa for each target observations. If a base and target observation pair mutually prefer each other, then these two observations are matched. The algorithm then repeats the initial two evaluation steps, and excludes observations after they are matched, until all base observations are either matched or excluded due to the option __maxdiff()__. Matched observations ends up in pairs of exactly one base observation and one target observation. + +In a one-to-one match, there has to be at least as many target observations as there are base observations. A one-to-one match returns three variables. One variable indicates the result of the matching for each observation, such as, matched, not matched, no match within the max difference, etc. The other two variables hold information on the matched pair. One variable is the ID of the target observation in the matched pair, and the other variable is the difference in __matchvar()__ between the two observations in the match pair. See the below in this section for more details on the variables generated. + +## Many-to-one matching algorithm + +The algorithm used for many-to-one matching is the same as in a one-to-one match. But instead of matching only when there is a mutual preference, all base observations are matched towards their preferred target observation in the first step, as long as the match is within the max-value if __maxdff()__ is used. Matched observations end up in groups in which there is exactly one target observation but where there are either one or several base observations. + +In a many-to-one match, there is no restriction in terms of the number of base observations in relation to target observations. The many-to-one matching yields four variables. Three of the variables are the same as in one-to-one matching, and only the variable listing the difference The fourth variable indicates how many base observations that were matched towards each target observation. See the below in this section for more details on the variables generated. + +## Variables generated + +This section explains the variables that are generated by this command. All variables will be referred to by their default names, but those names can be manually set to something else (see the options for this command). + + +`_matchResult`: This variable indicates the result of the match for all observations. Observations that ended up in a match pair/group has the value 1. Target observations not matched have the value 0. Base observations without a valid match due to __maxdff()__ are assigned the value .d. Observations excluded from the match using if/in are assigned the value .i. Observations excluded from the match due to missing value in __grpdummy()__ are assigned the value .g. Observations excluded from the match due to missing value in __matchvar()__ are assigned the value .m. All values have descriptive value labels. + +`_matchID`: This variable indicates the ID of the target observations in each match pair/group. For matched target observations, the value in _matchID will be +equal to the value in the ID variable. Since the values in the ID variable are unique and there is exactly one target observation in each matched +pair/group, this variable functions as a unique pair/group ID. In addition to indicating which observations are included in the same pair/group, +this variable can be used to include a pair/group fixed effect in a regression. + +`_matchDiff`: This variable indicates the difference in __matchvar()__ between matched base observations and target observations. In a one-to-one match this value is the identical for both the base observation and the target observation in each matched pair. In a many-to-one match, this value is only indicated for base observations. It is missing for target observations as there are potentially multiple matches, and subsequently multiple differences. + +`_matchCount`: In a many-to-one match, this variable indicates how many base observations were matched towards each matched target observation. This variable can be used as regression weights when controlling for the fact that some observations are matched towards multiple observations. + + + +# Options + +__**grp**dummy__(_varname_) is used for xyz. Longer description (paragraph length) of all options, their intended use case and best practices related to them. + +__**matc**hvar__(_varname_) is the variable used to compare observations when matching. This must be a numeric variable, and it is typically a continuous variable. Observations with a missing value will be excluded from the matching. + +__**id**var__(_varname_) indicates the variable that uniquely and fully identifies the data set. The values in this variable is the values that will be used in the variable that indicates which target observation each base observations matched against. If this option is omitted, a variable called _ID will be generated. The observation in the first row is given the value 1, the second row value 2 and so fourth. + +This command assumes only one ID variable as that is the best practice this command follows (see next paragraph for the exception of panel data sets). Here follows two suggested solutions if a data set this command will be used on has more than one ID variable. 1. Do not use the idvar() option and after the matching copy the multiple ID variables yourself. 2. Combine your ID variables into one ID variable. Here are two examples on how that can be done (the examples below work just as well when combining more than two ID variables to one.): + +``` +egen new_ID_var = group(old_ID_var1 old_ID_var2) + +gen new_ID_var = old_ID_var1 + "_" + old_ID_var2 //Works only with string vars + +``` + +Panel data sets are one of the few cases where multiple ID variables is good practice. However, in the case of matching it is unlikely that it is correct to include multiple time rounds for the same observation. That would lead to some base observations being matched to one target observation in the first round, and one another in the second. In impact evaluations, matchings are almost exclusively done only on the baseline data. + + +__maxdiff__(_numlist_) sets a maximum allowed difference between a base observation and a target observation for a match to be valid. Any base observation without a valid match within this difference will end up unmatched. + +__m1__ sets the match to a many-to-one match (see description). This allows multiple base observations to be matched towards a single target observation. The default is the one-to-one match where a maximum one base observation is matched towards each target observation. This option allows the number of base observations to be larger than the number of target observations. + +__maxmatch__(_integer_) sets the maximum number of base observations a target observation is allowed to match with in a __m1__ (many-to-one) match. The integer in __maxmatch()__ is the maximum number of base observations in group but there is also a always a target observation in the group, so in a maxed out match group it will be __maxmatch()__ plus one observations. + +__seedok__ supresses the error message thrown when there are duplicates among the base observations or the target observations in __matchvar()__. When there are duplicates a random variable is used to distinguish which variable to match. Setting the seed makes this randomization replicable and thereby making the matching also replicable. The seed (see `help set seed`) should be set before this command by the user. When the seed is set, or if replicable matching is not important, then the option __seedok__ can be used to suppress the error message. Duplicate pairs where one observation is a base observation and the other is a target observations are allowed. + +__**matchre**sultname__(_string_) manually sets the name of the variable that reports the matching result for each observation. If omitted, the default name is `_matchResult`. The names `_ID`, `_matchID`, `_matchDiff` and `_matchCount` are not allowed. + +__**matchid**name__(_string_) manually sets the name of the variable that list the ID of the target observations in each match pair/group. If omitted, the default name is `_matchID`. The names `_ID`, `_matchDiff`, `_matchResult` and `_matchCount` are not allowed. + +__**matchdi**ffname__(_string_) manually sets the name of the variable that indicates the difference between the matched base observations and target observations. If omitted, the default name is `_matchDiff`. The names `_ID`, `_matchID`, `_matchResult` and `_matchCount` are not allowed. + +__**matchco**untname__(_string_) manually sets the name of the variable that indicates the number of base observations that has been matched towards each matched matched target observation. This option may only be used in combination with option m1. If omitted, the default name is `_matchCount`. The names `_ID`, `_matchID`, `_matchDiff` and `_matchResult` are not allowed. + +__replace__ allows __iematch__ to replace variables in memory when encountering name conflicts while creating the variables with the results of the matching. + +# Examples + +## Example 1 + +``` +iematch , grpdummy(tmt) matchvar(p_hat) +``` + +In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p_hat, observations with value 0 in tmt. + +## Example 2 + +``` + iematch if baseline == 1 , grpdummy(tmt) matchvar(p_hat) maxdiff(.001) +``` + +In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p_hat, observations with value 0 in tmt as long as the difference in p_hat is less than .001. Only observations that has the value 1 in variable baseline will be included in the match. + +## Example 3 + +``` + iematch , grpdummy(tmt) m1 maxmatch(5) matchvar(p_hat) maxdiff(.001) +``` + +In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p_hat, observations with value 0 in tmt as long as the difference in p_hat is less than .001. So far this example is identical to example 2. However, in this example each target observation is allowed to match with up to 5 base observations. Hence, instead of a result with only pairs of exactly one target observation and one base observation in each pair, the result is instead match groups with one target observation and up to 5 base observations. If __maxmatch()__ is omitted any number of base observations may match with each target observation. + +# Acknowledgements + +I would like to acknowledge the help in testing and proofreading I received in relation to this command and help file from (in alphabetic order): + +Luiza Cardoso De Andrade + +Seungmin Lee + +Mrijan Rimal + + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications writing "ietoolkit iematch" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + + +# Authors + +All commands in ietoolkit is developed by DIME Analytics at DIME, The World Bank's unit for Development Impact Evaluations. + +Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group diff --git a/src/mdhlp/iesave.md b/src/mdhlp/iesave.md new file mode 100644 index 00000000..0bd43fde --- /dev/null +++ b/src/mdhlp/iesave.md @@ -0,0 +1,118 @@ +# Title + +__iesave__ - applies best practices before saving data, with option to save meta data report about the data saved. + + +# Syntax + +__iesave__ filename, __**id**vars__(_varlist_) __**v**ersion__(_version_number_) [ __replace__ __userinfo__ __report__(_report_options_) ] + +## Save options: + +| _options_ | Description | +|-----------|-------------| +| __**id**vars__(_varlist_)| The variable(s) that should identify the data set | +| __**v**ersion__(_version_number_) | Specify which __.dta__ version to use when saving | +| __replace__ | Replace the data file if it already exits | +| __userinfo__ | Include user info in meta data | +| __report__(_report_options_) | Save a report with meta data about the data to disk. See below for opt | + +## Report options: + +These options are only to be used inside __report()__ + +| _options_ | Description | +|-----------|-------------| +| __path__(_"/path/to/report.md"_) | Save the report using another name and location than the data file | +| __replace__ | Replace report file if it already exists | +| __csv__ | Create the report in csv format instead of markdown | +| __noalpha__ | Order the variables in the report as in the data set and not alphabetically | + +# Description + +The command __iesave__ is an enhanced way of saving data sets to disk, intended to be used instead of the built in command save (see `help save`) when working with research data. In addition to saving the data set to disk, the command applies some best practices steps before saving it and it compiles meta data about the data set and about each variable. The meta data about the data set is always saved in char (see `help char`) characteristics to the data file.Both the data set and the variables meta data can be exported in a separate file that can be tracked using Git. When the data points in the data set changes, then the variable meta data also changes. Therefore, tracking this report in Git allows you to know which changes to your code made changes to the data points. + +Before saving the data __iesave__ uses compress (see `help compress`) to minimize the storage space the files takes when saved to disk, and it throws and error if isid (see `help isid`) fails to confirm that the ID variable(s) are uniquely and fully identifying the data. This means testing that the ID variable(s) have no duplicated values and no missing values. + +The command requires the user to explicitly set the __.dta__ version that should be used when saving the data set.This prevents that a team members with a more recent version of Stata accidently saves the data in a file format that team members with an older version of Stata cannot open. + +The data set meta data contains information on the ID variable(s), the number of observations, the number of variables, the datasignature, the time and date the file was saved as well as the .dta version the data set was last saved in using iesave. If the option __userinfo__ is used, then the data set meta data also includes the username and the computer ID of the user that most recently used iesave to save the data. + +If the option __report__ is used, then the same data set meta data is also saved to a report in a separate file. In addition to the meta data about the data set, in this report, meta data on all variables are also included. This meta data is descriptive statistics on the data in each variable. The descriptive statistics is different depending on the variable being a string, date, categorical or continuous variable. It is often not feasible or desirable to track a .dta file on GitHub so changes to the data set are usually not be tracked together with changes in the code. This is solved by this report, as the variable meta data will change if the data changes (rare corner case exceptions may exist) and this report is suitable to be tracked on Git. + + +# Options + +## Save options: + +__**id**vars__(_varlist_) is used to specify the variable(s) that uniquely and fully should identify the observations in the data set. This command is intended for research data where data should always be properly identified. The command will, before saving, throw an error if the variables specified in this option have missing values or duplicated values (duplicated combinations of values if more than one ID variable). + +__**v**ersion__(_stata_version_) is used to specify which __.dta__ version should be used when saving the data set. This allows a team that works in different versions of Stata to always save in the same __.dta__ format no matter which Stata version any team member have installed on their computer. This avoids the issue of a team member saving the data in a format that another team member with an older version cannot read.The recommendation is to set the highest version number allowed in the oldest version of Stata any team member has installed. Not every Stata version include a new __.dta__ version. The only the __.dta__ versions used in this command is 12, 13 and 14. If a Stata version higher than those versions or a version in-between is specified, then the highest .dta version lower than the specified version is used. For example, if 13.1 is specified, then 13 will be used. + +__replace__ overwrites the data file if it already exits. If applicable and unless __reportpath()__ is used, this also applies to the report file. + +__userinfo__ includes user information - user name __c(username)__ and computer name __c(hostname)__ - in the meta data.By default, this information is omitted for privacy reasons. This applies both to meta data saved to char values and, when applicable, meta data saved in the report. + +__report__(_report_options_) is used to create a report with meta data. The default is to save the report in markdown format in the same location as the data file using the same name as the data file but with __.md__ as the file extension. See below for report_options that can be used to change any of the default behavior. Either __report()__ or __report__ can be used when keeping all default behavior. + +## Report options: + +These options are only to be used inside __report()__ + +__path__(_"/path/to/report.md"_) is used to specify a different file location and file name than the default. The file extension must be __.md__ or __.csv__.If this option is used then the replace option used for the data file does not apply to the report file. + +__replace__ is used to replace the report file if it already exists.This option only applies of the report option __path()__ is used, as otherwise the replace option for the .dta file also applies to the report file. + +__csv__ is used to specify that the report should be created in CSV format instead of markdown. This option is superseded and has no effect if the option __path()__ is also used. + +__noalpha__ is used to list the variables in the tables in the report in the same order as the sort order of the data set.The default is to sort the variables alphabetically. + + +# Examples + +## Example 1 + +This is the most basic usage of __iesave__. Specified like this, it saves the data set after it has checked that the variable __make__ is uniquely and fully identifying the data and have used __compress__ (see `help compress`) to make sure the data points are stored in the most memory efficient format. + +``` +sysuse auto, clear +local myfolder "/path/to/folder" +iesave "`myfolder'/data1.dta", replace /// + idvars(make) version(15) +``` + +## Example 2 + +This example is similar to example 1, but it also saves a report with the meta data about the data set and the variables to __data2.md__ + +``` +sysuse auto, clear +local myfolder "/path/to/folder" +iesave "`myfolder'/data2.dta", replace /// + idvars(make) version(15) report +``` + +## Example 3 + +This example is similar to example 2, but it saves the report in csv format and saves it in the custom location specified inside __path()__ + +``` +sysuse auto, clear +local myfolder "/path/to/folder" +iesave "`myfolder'/data2.dta", replace /// + idvars(make) version(15) /// + report(path("`myfolder'/reports/data-report.csv") replace) +``` + + +# Feedback, bug reports and contributions + +Please send bug-reports, suggestions and requests for clarifications writing "iefieldkit iesave" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through [GitHub repository](https://github.com/worldbank/ietoolkit) for `ietoolkit`. + + +# Author + +All commands in iefieldkit are developed by DIME Analytics at the World Bank's Development Impact Evaluations department. diff --git a/src/mdhlp/ietoolkit.md b/src/mdhlp/ietoolkit.md new file mode 100644 index 00000000..bc885fb2 --- /dev/null +++ b/src/mdhlp/ietoolkit.md @@ -0,0 +1,51 @@ +# Title + +__ietoolkit__ - Returns information on the version of `ietoolkit` installed + +For a more descriptive discussion on the intended usage and work flow of this command please see the [DIME Wiki](https://dimewiki.worldbank.org/Ietoolkit). + +# Syntax + +__ietoolkit__ + +Note that this command takes no arguments at all. + +# Description + +`ietoolkit` This command returns the version of `ietoolkit` installed. It can be used to programmatically test if `ietoolkit` is already installed. + +# Options + +This command does not take any options. + +# Examples + +The code below is an example code that can be added to the top of any do-file. The example code first tests if the command is installed, and install it if not. If it is installed, it tests if the version is less than version 5.0. If it is, it replaces the `ietoolkit` file with the latest version. In your code you can skip the second part if you are not sure which version is required. But you should always have the first part testing that `r(version)` has a value before using it in less than or greater than expressions. + +``` +cap ietoolkit +if "`r(version)'" == "" { + *ietoolkit not installed, install it + ssc install ietoolkit +} +else if `r(version)' < 5.0 { + *ietoolkit version too old, install the latest version + ssc install ietoolkit , replace +} +``` + +# Acknowledgements + +We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order): + + Luiza Cardoso De Andrade, Seungmin Lee + +# Author + +All commands in `ietoolkit` is developed by DIME Analytics at DIME, the World Bank's department for Development Impact. + +Main author: DIME Analytics, The World Bank + +Please send bug-reports, suggestions and requests for clarifications writing "ietoolkit ietoolkit" in the subject line to: dimeanalytics@worldbank.org + +You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through the GitHub repository of `ietoolkit`. diff --git a/src/stata.toc b/src/stata.toc index 2f2cb775..a1061222 100644 --- a/src/stata.toc +++ b/src/stata.toc @@ -1,3 +1,6 @@ -v 7.3 -d DIME Analytics, World Bank Group, Development Economics Research -p ietoolkit DIME Analytics +* This package file is generated in the adodown workflow. Do not edit directly. +*** version +v 0.0 +*** packages +p ietoolkit + diff --git a/src/sthlp/README.md b/src/sthlp/README.md new file mode 100644 index 00000000..6ec9a53e --- /dev/null +++ b/src/sthlp/README.md @@ -0,0 +1,6 @@ +# Stata help files + +In the `adodown` workflow you should not edit these files directly. +In the `adodown` workflow the help files should be written in `markdown` syntax in the files in the folder `mdhlp`. + +The files in this folder is expected to be created and modified only by the commands `ad_publish` or `ad_sthlp`. diff --git a/src/sthlp/iebaltab.sthlp b/src/sthlp/iebaltab.sthlp new file mode 100644 index 00000000..876a8afc --- /dev/null +++ b/src/sthlp/iebaltab.sthlp @@ -0,0 +1,837 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iebaltab}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iebaltab} - produces balance tables with multiple groups or treatment arms +{p_end} + +{title:Syntax} + +{phang}{bf:iebaltab} {it:balance_varlist} [if] [in] [weight], {bf:{ul:group}var}({it:varname}) [ {it:column/row_options} {it:estimation_options} {it:stat_display_options} {it:labe/notel_options} {it:export_options} {it:latex_options} ] +{p_end} + +{phang}where {it:balance_varlist} is one or several continuous or binary variables (from here on called balance variables) for which the command +will test for differences across the categories in {bf:groupvar}({it:varname}). +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Iebaltab":DIME Wiki}. +{p_end} + +{dlgtab:Required options} + +{synoptset 17}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:group}var}({it:varname})}Variable indicating the groups (ex. treatment arms) to test across{p_end} +{synoptline} + +{dlgtab:Column and row option} + +{synoptset 22}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:co}ntrol}({it:group_code})}Indicate a single group that all other groups are tested against. Default is all groups are tested against each other{p_end} +{synopt: {bf:{ul:or}der}({it:group_code_list})}Manually set the order the groups appear in the table. Default is ascending. See details on {it:group_code_list} below{p_end} +{synopt: {bf:{ul:tot}al}}Include descriptive stats on all observations included in the table{p_end} +{synopt: {bf:onerow}}Write number of observations (and number of clusters if applicable) in one row at the bottom of the table{p_end} +{synoptline} + +{dlgtab:Estimation options} + +{synoptset 20}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:vce}({it:vce_types})}Options for estimating variance. See below and {inp:help vce_options} for supported options{p_end} +{synopt: {bf:{ul:fix}edeffect}({it:varname})}Include fixed effects in the pair-wise regressions (and for F-tests if applicable){p_end} +{synopt: {bf:{ul:cov}ariates}({it:varlist})}Include covariates (control variables) in the pair-wise regressions (and for F-tests if applicable){p_end} +{synopt: {bf:{ul:ft}est}}Include a row with the F-test for joint significance across all balance variables for each test pair{p_end} +{synopt: {bf:{ul:feqt}est}}Include a column with the F-test for joint significance across all groups for each variable{p_end} +{synoptline} + +{dlgtab:Statistics display options} + +{synoptset 19}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:stats}({it:stats_string})}Specify which statistics to display in the tables. See options for {it:stats_string} below{p_end} +{synopt: {bf:{ul:star}levels}({it:numlist})}Manually set the three significance levels used for significance stars{p_end} +{synopt: {bf:{ul:nostar}s}}Do not add any stars to the table{p_end} +{synopt: {bf:{ul:form}at}({it:%fmt})}Apply Stata formats to the non-integer values outputted in the table. See {inp:help format} for format options.{p_end} +{synoptline} + +{dlgtab:Label/notes option} + +{synoptset 24}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:groupc}odes}}Use the values in the {inp:groupvar()} variable as column titles. Default is to use value labels if any{p_end} +{synopt: {bf:{ul:groupl}abels}({it:code_titles})}Manually set the group column titles. See details on {it:code_titles} below{p_end} +{synopt: {bf:{ul:totall}abel}({it:string})}Manually set the title of the total column{p_end} +{synopt: {bf:{ul:rowv}arlabels}}Use the variable labels instead of variable name as row titles{p_end} +{synopt: {bf:{ul:rowl}abels}({it:name_titles})}Manually set the row titles. See details on {it:name_titles} below{p_end} +{synopt: {bf:nonote}}Suppress the default not at the bottom of the table{p_end} +{synopt: {bf:addnote}({it:string})}Add a manual note to the bottom of the table{p_end} +{synoptline} + +{dlgtab:Export options} + +{synoptset 21}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:browse}}View table in the data browser{p_end} +{synopt: {bf:{ul:savex}lsx}({it:filename})}Save table to Excel file on disk{p_end} +{synopt: {bf:{ul:savec}sv}({it:filename})}Save table to csv-file on disk{p_end} +{synopt: {bf:{ul:savet}ex}({it:filename})}Save table to LaTeX file on disk{p_end} +{synopt: {bf:texnotefile}({it:filename})}Save table note in a separate LaTeX file on disk{p_end} +{synopt: {bf:replace}}Replace file on disk if the file already exists{p_end} +{synoptline} + +{dlgtab:LaTeX options} + +{synoptset 21}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:texn}otewidth}({it:numlist})}Manually adjust width of note{p_end} +{synopt: {bf:{ul:texc}aption}({it:string})}Specify LaTeX table caption{p_end} +{synopt: {bf:{ul:texl}abel}({it:string})}Specify LaTeX label{p_end} +{synopt: {bf:{ul:texdoc}ument}}Create a stand-alone LaTeX document{p_end} +{synopt: {bf:texcolwidth}({it:string})}Limit width of the first column on LaTeX output{p_end} +{synoptline} + +{title:Description} + +{pstd}{inp:iebaltab} is a command that generates balance tables (difference-in-means tables). +The command tests for statistically significant difference in the balance variables between +the categories defined in the {inp:groupvar()}. The command can either test one control group +against all other groups, using the {inp:control()} option, +or test all groups against each other (the default). The command also allows for +fixed effects, covariates and different types of variance estimators. +{p_end} + +{pstd}The balance variables are expected to be continuous or binary variables. +Categorical variables (for example 1=single, 2=married, 3=divorced) will not +generate an error but will be treated like a continuous variable +which is most likely statistically invalid. +Consider converting each category to binary variables. +{p_end} + +{pstd}The command can also add a note to the bottom of the table. +The default note is not meant to be included in the final publication. +It includes technical information about how the command was specified. +This is helpful in the early stage of research where several specifications +are often explored, but should be replace with a more human readable note +in the final version. +{p_end} + +{pstd}See the {it:Estimation/Statistics Definitions_ +section below for a detailed documentation of what statistics this command +calculates and how they are calculated. +{p_end} + +{title:Options} + +{dlgtab:Required options} + +{pstd}{bf:{ul:group}var}({it:varname}) specifies the variable indicating groups +(for example treatment arms) across which the command will +test for difference in mean of the balance variable. +The group variable can only be one variable and +it must be numeric and may only hold integers. +See {inp:group()} in {inp:help egen} for help on creating a single variable where +each integer represents a category from string variables and/or multiple variables. +Observations with missing values in this variable will be excluded when running this command. +{p_end} + +{dlgtab:Column and row options} + +{pstd}{bf:{ul:co}ntrol}({it:group_code}) specifies one group that is the control group +that all other groups are tested against for difference in means and +where {it:group_code} is an integer used in {inp:groupvar()}. +The default is that all groups are tested against each other. +The control group will be listed first (leftmost) in the table +unless another order is specified in {inp:order()}. +When using {inp:control()} the order of the groups in the pair is (non-control)-(control) +so that a positive statistic (in for example {it:diff} or {it:beta}) indicates that +the mean for the non-control is larger than for the control. +{p_end} + +{pstd}{bf:{ul:or}der}({it:group_code_list}) manually sets the column order of the groups in the table. {it:group_code_list} may +be any or all of the values in the group variable specified in {inp:groupvar()}. +The default order if this option is omitted is ascending order of the values in the group variable. +If any values in {inp:groupvar()} are omitted when using this option, +they will be sorted in ascending order after the values included. +{p_end} + +{pstd}{bf:{ul:tot}al} includes a column with descriptive statistics on the full sample. +This column still exclude observations with missing values in {inp:groupvar()}. +{p_end} + +{pstd}{bf:onerow} displays the number of observations in an additional row +at the bottom of the table. If the number of observations are not identical +across all rows within a column, then this option throws an error. +This also applies to number of clusters. +If not specified, the number of observations (and clusters) per variable per group +is displayed on the same row in an additional column +next to the descriptive statistics. +{p_end} + +{dlgtab:Estimation options} + +{pstd}{bf:vce}({it:vce_types}) sets the type of variance estimator +to be used in all regressions for this command. +See {inp:help vce_option} for more details. +However, the types allowed in this command are only +{inp:robust}, {inp:cluster} {it:cluster_var} or {inp:bootstrap}. +See the estimation definition section +for exact definitions on how these vce types are included in the regressions. +{p_end} + +{pstd} {bf:{ul:fix}edeffect}({it:varname}) specifies a single variable to be used as fixed effects in all regressions +part from descriptive stats regressions. +The variable specified must be a numeric variable. +If more than one variable is needed as fixed effects, and it is not desirable to combine multiple variables into one +(using for example {inp:group()} in {inp:egen} - see {inp:help egen}), +then they can be included using the {c -(}opt i.{c )-} notation in the {inp:covariates()} option. +See the estimation definition section for exact definitions on how the fixed effects are included in the regressions. +{p_end} + +{pstd}{bf:{ul:cov}ariates}({it:varlist}) includes the variables specified in the regressions for t-tests (and for +F-tests if applicable) as covariate variables (control variables). See the description section above for details on how the covariates +are included in the estimation regressions. The covariate variables must be numeric variables. +See the estimation definition section for exact definitions on how the covariates are included in the regressions. +{p_end} + +{pstd}{bf:{ul:ft}est} adds a single row at the bottom of the table with +one F-test for each test pair, testing for joint significance across all balance variables. +See the estimation definition section for exact definitions on how these tests are estimated. +{p_end} + +{pstd}{bf:{ul:feqt}est} adds a single column in the table with an F-test for each balance variable, +testing for joint significance across all groups in {inp:groupvar()}. +See the estimation definition section for exact definitions on how these tests are estimated. +{p_end} + +{dlgtab:Statistics display options} + +{pstd}{bf:stats}({it:stats_string}) +indicates which statistics to be displayed in the table. +The {it:stats_string} is expected to be on this format (where at least one of the sub-arguments {inp:desc}, {inp:pair}, {inp:f} and {inp:feq} are required): +{p_end} + +{input}{space 8}stats(desc(desc_stats) pair(pair_stats) f(f_stats) feq(feq_stats)) +{text} +{pstd}The table below lists the valid values for +{it:desc_stats}, {it:pair_stats}, {it:f_stats} and {it:feq_stats}. +See the estimation definition section +for exact definitions of these values and how they are estimated/calculated. +{p_end} + +{synoptset 10}{...} +{p2coldent:Type}Options{p_end} +{synoptline} +{synopt: {it:desc_stats}}{inp:se} {inp:var} {inp:sd}{p_end} +{synopt: {it:pair_stats}}{inp:diff} {inp:beta} {inp:t} {inp:p} {inp:nrmd} {inp:nrmb} {inp:se} {inp:sd} {inp:none}{p_end} +{synopt: {it:f_stats}}{inp:f} {inp:p}{p_end} +{synopt: {it:feq_stats}}{inp:f} {inp:p}{p_end} +{synoptline} + +{pstd}{bf:{ul:star}levels}({it:numlist}) manually sets the +three significance levels used for significance stars. +Expected input is decimals (between the value 0 and 1) in descending order. +The default is (.1 .05 .01) where .1 corresponds +to one star, .05 to two stars and .01 to three stars. +{p_end} + +{pstd} {bf:{ul:nostar}s} makes the command not add any stars to the table +regardless of significance levels. +{p_end} + +{pstd}{bf:{ul:form}at}({it:%fmt}) applies the Stata formats specified to all values outputted +in the table apart from values that always are integers. +See {inp:help format} for format options +Example of values that always are integers is number of observations. +For these integer values the format is always %9.0f. +The default for all other values when this option is not used is %9.3f. +{p_end} + +{dlgtab:Label/notes option} + +{pstd}{bf:{ul:groupc}odes} makes the integer values used for the group codes in +{inp:groupvar()} the group column titles. +The default is to use the value labels used in {inp:groupvar()}. +If no value labels are used for the variable in {inp:groupvar()}, +then this option does not make a difference. +{p_end} + +{pstd} {bf:{ul:groupl}abels}({it:code_titles}) manually sets the group column titles. +{it:code_titles} is a string on the following format: +{p_end} + +{input}{space 8}grouplabels("code1 title1 @ code2 title2 @ code3 title3") +{text} +{pstd}Where code1, code2 etc. must correspond to the integer values used for each +group used in the variable {inp:groupvar()}, +and title1, title2 etc. are the titles to be used for the corresponding integer value. +The character {inp:@} may not be used in any title. +Codes omitted from this option will be assigned a column title +as if this option was not used. +This option takes precedence over {it:group_codes} when used together, +meaning that group codes are only used for groups +that are not included in the {it:code_title_string}. +The title can consist of several words. +Everything that follows the code until the end of a string +or a {inp:@} will be included in the title. +{p_end} + +{pstd}{bf:{ul:totall}abel}({it:string}) manually sets the column title for the total column. +{p_end} + +{pstd}{bf:{ul:rowv}arlabels} use the variable labels instead of variable name as row titles. +The default is to use the variable name. For variables with no variable label defined, +the variable name is used as row label even when this option is specified. +{p_end} + +{pstd}{bf:{ul:rowl}abels}({it:name_title_string}) manually sets the row titles for each +of the balance variables in the table. {it:name_title_string} is a string in the following format: +{p_end} + +{input}{space 8}rowlabels("name1 title1 @ name2 title2 @ name3 title3") +{text} +{pstd}Where name1, name2 etc. are variable names used as balance variables, +and title1, title2 etc. are the titles to be used for the corresponding variable. +The character {inp:@} may not be used in any of the titles. +Variables omitted from this option are assigned a row title as if this option was not used. +This option takes precedence over {inp:rowvarlabels} when used together, +meaning that default labels are only used for variables +that are not included in the {it:name_title_string}. +The title can consist of several words. +Everything that follows the variable name until +the end of a string or a {inp:@} will be included in the title. +{p_end} + +{pstd}{bf:nonote} suppresses the default note that the command adds to +the bottom of the table with technical information +on how the command was specified. +This note is great during explorative analysis as it documents how +{inp:iebaltab} was specified to generate exactly that table. +Eventually however, this note should probably be replaced with +a note more suitable for publication. +{p_end} + +{pstd}{bf:addnote}({it:string}) adds the string provided in this option +to the note at the bottom of table. +If {inp:nonote} is not used, then this manually provided note +is added to the end of the default note. +{p_end} + +{dlgtab:Export options} + +{pstd}{bf:browse} replaces the data in memory with the table +so it can be viewed using the command {inp:browse} instead of saving it to disk. +This is only meant to be used during explorative analysis +when figuring out how to specify the command. +Note that this overwrites data in memory. +{p_end} + +{pstd}{bf:{ul:savex}lsx}({it:filename}) exports the table to an Excel (.xsl/.xlsx) file and saves it on disk. +{p_end} + +{pstd}{bf:{ul:savec}sv}({it:filename}) exports the table to a comma separated (.csv) file and saves it on disk. +{p_end} + +{pstd}{bf:{ul:savet}ex}({it:filename}) exports the table to a LaTeX (.tex) file and saves it on disk. +{p_end} + +{pstd}{bf:texnotefile}({it:filename}) exports the table note in a separate LaTeX file on disk. +When this option is used, no note is included in the {inp:savetex()} file. +This allows importing the table using the {inp:threeparttable} LaTeX package which +is an easy way to make sure the note always has the same width as the table. +See example in the example section below. +{p_end} + +{pstd}{bf:replace} allows for the file in {inp:savexlsx()}, {inp:savexcsv()}, {inp:savetex()} or {inp:texnotefile()} +to be overwritten if the file already exist on disk. +{p_end} + +{dlgtab:LaTeX options} + +{pstd}{bf:{ul:texn}otewidth}({it:numlist}) manually adjusts the width of the note +to fit the size of the table. +The note width is a multiple of text width. +If not specified, default is one, which makes the table width equal to text width. +However, when the table is resized when rendered in LaTeX +this is not always the same as the table width. +Consider also using {inp:texnotefile()} and the LaTeX package {inp:threeparttable}. +{p_end} + +{pstd}{bf:{ul:texc}aption}({it:string}) writes the table{c 39}s caption in LaTeX file. +Can only be used with option {inp:texdocument}. +{p_end} + +{pstd}{bf:{ul:texl}abel}({it:string}) specifies table{c 39}s label, +used for meta-reference across LaTeX file. +Can only be used with option {inp:texdocument}. +{p_end} + +{pstd}{bf:{ul:texdoc}ument} creates a stand-alone LaTeX document ready to be compiled. +The default is that {inp:savetex()} creates a fragmented LaTeX file +consisting only of a tabular environment. +This fragment is then meant to be imported to a main LaTeX file +that holds text and may import other tables. +{p_end} + +{pstd}{bf:texcolwidth}({it:string}) limits the width of table{c 39}s first column +so that a line break is added when a variable{c 39}s name or label is too long. +{c -(}it:string{c )-} must consist of a numeric value with one of the following units: +{c 34}cm{c 34}, {c 34}mm{c 34}, {c 34}pt{c 34}, {c 34}in{c 34}, {c 34}ex{c 34} or {c 34}em{c 34}. +For more information on these units, +{browse "https://en.wikibooks.org/wiki/LaTeX/Lengths":check LaTeX length{c 39}s manual}. +{p_end} + +{title:Estimation/statistics definitions} + +{pstd}This section details the regressions that are used to estimate +the statistics displayed in the balance tables generated by this command. +For each test there is a {c 34}basic form{c 34} example to highlight the core of the test, +and an {c 34}all options{c 34} example that shows exactly how all options are applied. +Here is a glossary for the terms used in this section: +{p_end} + +{synoptset 16}{...} +{p2coldent:Term}Definition{p_end} +{synoptline} +{synopt: {it:balance variable}}The variables listed as {it:balance_varlist}{p_end} +{synopt: {it:groupvar}}The variable specified in {inp:groupvar()}{p_end} +{synopt: {it:group_code}}Each value in {it:groupvar}{p_end} +{synopt: {it:test_pair}}Combination of {it:group codes} to be used in pair wise tests{p_end} +{synopt: {it:tp_dummy}}A dummy variable where 1 means that the obs{c 39} value in {inp:groupvar()} equals the first value in {it:test_pair}, 0 means it equals the second value, and missing means is matches neither{p_end} +{synoptline} + +{pstd}Each section below has a table that shows how the stats are estimated/calculated for each type of statistics. This is what each column means. +A star (*) in the {it:Stat} column indicate that is the optional statistics displayed by default if the {inp:stats()} option is not used. +The {it:Display option} column shows what sub-option to use in {inp:stats()} to display this statistic. +The {it:Mat col} column shows what the column name in the result matrix for the column that stores this stat. See more about the result matrices in the {it:Result matrices} section. +{p_end} + +{dlgtab:Group descriptive statistics} + +{pstd}Descriptive statistics for all groups are always displayed in the table. +If option {inp:total} is used then these statistics are also calculated on the full sample. +For each balance variable and for each value group code, +the descriptive statistics is calculated using the following code: +{p_end} + +{pstd}Basic form: +{p_end} + +{input}{space 8}reg balancevar if groupvar = groupcode +{text} +{pstd}All options: +{p_end} + +{input}{space 8}reg balancevar if groupvar = groupcode weights, vce(vce_option) +{text} +{pstd}See above for description of each column in this table. +{it:gc} stands for {it:group_code} (see definition of {it:group_code} above). +If the option {inp:total} is used, +then {it:gc} will also include {it:t} for stats on the full sample. +The last column shows how the command obtains the statistic in the Stata code. +These statistics are stored in +a the result matrix called {inp:r(iebtab_rmat)}. +{p_end} + +{col 4}{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 33}{c TRC} +{col 4}{c |} Stat{col 14}{c |} Display option{col 34}{c |} Mat col{col 44}{c |} Estimation/calculation{col 78}{c |} +{col 4}{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 33}{c RT} +{col 4}{c |} # obs{col 14}{c |} Always displayed{col 34}{c |} {inp:n_gc}{col 44}{c |} {inp:e(N)} after {inp:reg}{col 78}{c |} +{col 4}{c |} cluster{col 14}{c |} Displayed if used{col 34}{c |} {inp:cl_gc}{col 44}{c |} {inp:e(N_clust)} after {inp:reg}{col 78}{c |} +{col 4}{c |} mean{col 14}{c |} Always displayed{col 34}{c |} {inp:mean_gc}{col 44}{c |} {inp:_b[cons]} after {inp:reg}{col 78}{c |} +{col 4}{c |} se *{col 14}{c |} {inp:stats(desc(se))}{col 34}{c |} {inp:se_gc}{col 44}{c |} {inp:_se[cons]} after {inp:reg}{col 78}{c |} +{col 4}{c |} var{col 14}{c |} {inp:stats(desc(var))}{col 34}{c |} {inp:var_gc}{col 44}{c |} {inp:e(rss)/e(df_r)} after {inp:reg}{col 78}{c |} +{col 4}{c |} sd{col 14}{c |} {inp:stats(desc(sd))}{col 34}{c |} {inp:sd_gc}{col 44}{c |} {inp:_se[_cons]*sqrt(e(N))} after {inp:reg}{col 78}{c |} +{col 4}{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 33}{c BRC} + +{dlgtab:Pair-wise test statistics} + +{pstd}Pair-wise test statistics is always displayed in the table +unless {inp:stats(pair(none))} is used. +For each balance variable and for each test pair, this code is used. +Since observations not included in the test pair have missing values in the test pair dummy, +they are excluded from the regression without using an if-statement. +{p_end} + +{pstd}Basic form: +{p_end} + +{input}{space 8}reg balancevar tp_dummy +{space 8}test tp_dummy +{text} +{pstd}All options: +{p_end} + +{input}{space 8}reg balancevar tp_dummy covariates i.fixedeffect weights, vce(vce_option) +{space 8}test tp_dummy +{text} +{pstd}See above for description of each column in this table. +{it:tp} stands for {it:test_pair}, see definition above. +The last column shows how the command obtains the stat in the Stata code. +See the group descriptive statistics above for definitions on +{it:mean_1}, {it:mean_2}, {it:var_1} and {it:var_2_ +also used in the table below. +These statistics are stored in +a the result matrix called {inp:r(iebtab_rmat)}. +{p_end} + +{col 4}{c TLC}{hline 8}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 45}{c TRC} +{col 4}{c |} Stat{col 13}{c |} Display option{col 33}{c |} Mat col{col 43}{c |} Estimation/calculation{col 89}{c |} +{col 4}{c LT}{hline 8}{c +}{hline 19}{c +}{hline 9}{c +}{hline 45}{c RT} +{col 4}{c |} diff *{col 13}{c |} {inp:stats(pair(diff))}{col 33}{c |} {inp:diff_tp}{col 43}{c |} If pair {it:1_2}: {inp:mean_1}-{inp:mean_2}{col 89}{c |} +{col 4}{c |} beta{col 13}{c |} {inp:stats(pair(beta))}{col 33}{c |} {inp:beta_tp}{col 43}{c |} {inp:e(b)[1,1]} after {inp:reg}{col 89}{c |} +{col 4}{c |} t{col 13}{c |} {inp:stats(pair(t))}{col 33}{c |} {inp:t_tp}{col 43}{c |} {inp:_b[tp_dummy]/_se[tp_dummy]} after {inp:reg}{col 89}{c |} +{col 4}{c |} p{col 13}{c |} {inp:stats(pair(p))}{col 33}{c |} {inp:p_tp}{col 43}{c |} {inp:e(p)} after {inp:test}{col 89}{c |} +{col 4}{c |} nrmd{col 13}{c |} {inp:stats(pair(nrmd))}{col 33}{c |} {inp:nrmd_tp}{col 43}{c |} If pair {it:1_2}: {inp:diff_tp/sqrt(.5*(var_1+var_2))}{col 89}{c |} +{col 4}{c |} nrmb{col 13}{c |} {inp:stats(pair(nrmb))}{col 33}{c |} {inp:nrmb_tp}{col 43}{c |} If pair {it:1_2}: {inp:beta_tp/sqrt(.5*(var_1+var_2))}{col 89}{c |} +{col 4}{c |} se{col 13}{c |} {inp:stats(pair(se))}{col 33}{c |} {inp:se_tp}{col 43}{c |} {inp:_se[tp_dummy]} after {inp:reg}{col 89}{c |} +{col 4}{c |} sd{col 13}{c |} {inp:stats(pair(sd))}{col 33}{c |} {inp:sd_tp}{col 43}{c |} {inp:_se[tp_dummy] * sqrt(e(N))} after {inp:reg}{col 89}{c |} +{col 4}{c BLC}{hline 8}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 45}{c BRC} + +{dlgtab:F-test statistics for balance across all balance variables} + +{pstd}Displayed in the balance table if the option {inp:ftest} is used. +For each test pair the following code is used. +{p_end} + +{pstd}Basic form: +{p_end} + +{input}{space 8}reg tp_dummy balancevars +{space 8}testparm balancevars +{text} +{pstd}All options: +{p_end} + +{input}{space 8}reg tp_dummy balancevars covariates i.fixedeffect weights, vce(vce_option) +{space 8}testparm balancevars +{text} +{pstd}See above for description of each column in this table. +{it:tp} stands for {it:test_pair}, see definition above. +These statistics are stored in +a the result matrix called {inp:r(iebtab_fmat)}. +{p_end} + +{col 4}{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 24}{c TRC} +{col 4}{c |} Stat{col 14}{c |} Display option{col 34}{c |} Mat col{col 44}{c |} Estimation/calculation{col 69}{c |} +{col 4}{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 24}{c RT} +{col 4}{c |} # obs{col 14}{c |} Always displayed{col 34}{c |} {inp:fn_tp}{col 44}{c |} {inp:e(N)} after {inp:reg}{col 69}{c |} +{col 4}{c |} cluster{col 14}{c |} Displayed if used{col 34}{c |} {inp:fcl_tp}{col 44}{c |} {inp:e(N_clust)} after {inp:reg}{col 69}{c |} +{col 4}{c |} f *{col 14}{c |} {inp:stats(f(f))}{col 34}{c |} {inp:ff_tp}{col 44}{c |} {inp:r(F)} after {inp:testparm}{col 69}{c |} +{col 4}{c |} p{col 14}{c |} {inp:stats(f(p))}{col 34}{c |} {inp:fp_tp}{col 44}{c |} {inp:r(p)} after {inp:testparm}{col 69}{c |} +{col 4}{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 24}{c BRC} + +{dlgtab:F-test statistics for balance across all groups} + +{pstd}Displayed in the balance table if the option {inp:feqtest} is used. +For each balance variable the below code is used where +{inp:feqtestinput} is a list on the format +{inp:x2.groupvar = x3.groupvar ... xn.groupvar = 0}, +and where {it:x2}, {it:x3} ... {it:xn}, +represents all group codes apart from the first code. +{p_end} + +{pstd}Basic form: +{p_end} + +{input}{space 8}reg balancevar i.groupvar +{space 8}test feqtestinput +{text} +{pstd}All options: +{p_end} + +{input}{space 8}reg balancevar i.groupvar covariates i.fixedeffect weights, vce(vce_option) +{space 8}test feqtestinput +{text} +{pstd}See above for description of each column in this table. +These statistics are stored in +a the result matrix called {inp:r(iebtab_fmat)}. +{p_end} + +{col 4}{c TLC}{hline 9}{c TT}{hline 19}{c TT}{hline 9}{c TT}{hline 24}{c TRC} +{col 4}{c |} Stat{col 14}{c |} Display option{col 34}{c |} Mat col{col 44}{c |} Estimation/calculation{col 69}{c |} +{col 4}{c LT}{hline 9}{c +}{hline 19}{c +}{hline 9}{c +}{hline 24}{c RT} +{col 4}{c |} # obs{col 14}{c |} Always displayed{col 34}{c |} {inp:feq_n}{col 44}{c |} {inp:e(N)} after {inp:reg}{col 69}{c |} +{col 4}{c |} cluster{col 14}{c |} Displayed if used{col 34}{c |} {inp:feq_cl}{col 44}{c |} {inp:e(N_clust)} after {inp:reg}{col 69}{c |} +{col 4}{c |} f *{col 14}{c |} {inp:stats(feq(f))}{col 34}{c |} {inp:feq_f}{col 44}{c |} {inp:r(F)} after {inp:test}{col 69}{c |} +{col 4}{c |} p{col 14}{c |} {inp:stats(feq(p))}{col 34}{c |} {inp:feq_p}{col 44}{c |} {inp:r(p)} after {inp:test}{col 69}{c |} +{col 4}{c BLC}{hline 9}{c BT}{hline 19}{c BT}{hline 9}{c BT}{hline 24}{c BRC} + +{title:Result matrices} + +{pstd}There is an unlimited variation in preferences for +how a balance table should be structured or look. +A single command like {inp:iebaltab} simply cannot satisfy them all. +To still enable infinite customization this commands return two matrices +with all the stats calculated by this command. +From these matrices all values can be extracted and +put into any output of your liking. +{p_end} + +{pstd}The two returned matrices are called {inp:iebtab_rmat} and {inp:iebtab_fmat}. +All stats related to the F-test across all balance variables (option {inp:ftest}) +are stored in the {inp:iebtab_fmat} matrix, +all other stats are stored in the {inp:iebtab_rmat} matrix. +The {inp:iebtab_fmat} matrix always has exactly one row with the row name {inp:fstats}. +The {inp:iebtab_rmat} matrix has one row per balance variable +and each row is named after each balance var. +In both matrices the column names corresponds to a statistics. +The column name for each statistics and its definition can be found +in the {it:Estimation/statistics definitions} section above. +{p_end} + +{pstd}See examples in the end of this help file for how to access the values. +{p_end} + +{title:Missing values} + +{pstd}When statistics are estimated/calculated they can be missing for multiple reasons. +This section explain what each ({inp:.c},{inp:.v} etc.) represents. +See {inp:help missing} if you are not familiar with extended missing values. +The exported tables or the result matrices should never include +the standard missing value ({inp:.}). +If you ever encounter the standard missing value in any of them, +please report that using the contact information at the bottom of this help file. +{p_end} + +{dlgtab:Missing value: .b} + +{pstd}Missing value {inp:.b} means that the statistics +could not be estimated/calculated as bootstrapping was set +to be used as the variance estimator in {inp:vce(bootstrap)}. +When bootstrap is used there is no single value for variance +to be reported in stat {inp:desc(var)}. +As a result of that, the stats {inp:pair(nrmd)} and {inp:pair(nrmb)} +are not reported either as they use the variance as input. +{p_end} + +{dlgtab:Missing value: .c} + +{pstd}Missing value {inp:.c} are only used when there is +no number of clusters to report as the errors estimations were not cluster. +A value for number of clusters are only reported if the +variance estimator option is set to {inp:vce(cluster clustervar)}. +{p_end} + +{dlgtab:Missing value: .f} + +{pstd}Missing value {inp:.f} is used to indicate that F-test option for +that statistics (either {inp:fstat} or {inp:feqstat}) was not used, +and the value was therefore not calculated. +{p_end} + +{dlgtab:Missing value: .m} + +{pstd}Missing value {inp:.m} is used to indicate that an option to skip +a full section was used. For example, {inp:stats(pair(none))} where all +pair-wise statistics are skipped. +{p_end} + +{dlgtab:Missing value: .n} + +{pstd}Missing value {inp:.n} is used to indicate that the R-squared value +was not defined in the pair-wise regression for this test pair. +This is most likely caused by no variance in the balance variable. +Here is an example: +{p_end} + +{input}{space 8}sysuse census +{space 8}gen constant = 1 +{space 8}iebaltab medage constant, groupvar(region) browse +{text} +{pstd}In this example the variable {it:constant} has no variance. +This variable has the mean 1 and 0 variance in the descriptive statistics +and statistics can be reported in the descriptive statistics section. +However, the R-square value is not defined for any test pair +in the pair-wise regression, +and no pair-wise stats are reported for the {it:constant} variable. +{p_end} + +{dlgtab:Missing value: .o} +{pstd}Missing value {inp:.o} is used to indicate that in the F-test regression +for joint significance across all balance variables (see option {inp:ftest}) +for this test pair and at least one balance variable was omitted. +This is most likely caused by no variance in that balance variable. +Here is an example: +{p_end} + +{input}{space 8}sysuse census +{space 8}replace pop = 0 if (region == 1) | (region == 2) +{space 8}iebaltab medage pop, groupvar(region) ftest browse +{text} +{pstd}In this example the variable {it:pop} has no variance in test pair 1{it:2, +and that variable will be omitted from the F-test regression and +no stats are reported for this F-test for this test pair. +{p_end} + +{dlgtab:Missing value: .t} + +{pstd}Missing value {inp:.t} is used to indicate that no descriptive statistics +were calculated for the full sample since the option {inp:total} was not used. +{p_end} + +{dlgtab:Missing value: .v} + +{pstd}Missing value {inp:.v} is used to indicate that +all variance in the balance variable can be explained by one or several +other variables included in the regression. +This is defined as the R-squared value is 1. +Here are a few examples: +{p_end} + +{input}{space 8}gen region2 = region +{space 8}gen pop_neg = 0 +{space 8}replace pop_neg = pop * -1 if (region == 1) | (region == 2) +{space 8}iebaltab medage pop region2, groupvar(region) covar(pop_neg) browse +{text} +{pstd}The variance in variable {it:region2} is perfectly explained +by the group variable {it:region} for each test pair +and the R-squared is 1 in all pair-wise regressions and no statistics are reported. +Similarly, {it:pop_neg} that is included as a covariate control variable +has prefect negative correlation with the balance variable {it:pop} in test pair 1{it:2. +The R-squared is 1 in the regression for pair 1{it:2 and no pair-wise statistics are reported for that pair. +{p_end} + +{title:Examples} + +{dlgtab:Example 1} + +{input}{space 8}sysuse census +{space 8}gen group = runiform() < .5 +{space 8}iebaltab pop medage, groupvar(group) browse +{space 8}browse +{text} +{pstd}In the example above, Stata{c 39}s built in census data is used. +First a dummy variable is created at random. +Using this random group variable a balance table is created testing for +differences in {it:pop} and {it:medage}. +By using {inp:browse} the data in memory is replaced with the table so that +the table can be used in the browse window. +You most likely never should use the {inp:browse} option in your final code +but it is convenient in examples like this and when first testing the command. +See examples on how to save the table to a file on disk below. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8}sysuse census +{space 8}iebaltab pop medage, groupvar(region) browse +{space 8}browse +{text} +{pstd}In this example we use the variable region as group variable that has four categories. +All groups are tested against each other. +{p_end} + +{dlgtab:Example 3} + +{input}{space 8}sysuse census +{space 8}iebaltab pop medage, groupvar(region) browse control(4) +{space 8}browse +{text} +{pstd}Comparing all groups against each other becomes unfeasible when the number of +categories in the group variable grows. +The option {inp:control()} overrides this behavior so that the category indicated +in this options are tested against all other groups, +but the other groups are not tested against each other. +For statistics where the direction matters (for example {it:diff} or {it:beta}) +the order is changed so that the test is ({it:other_group} - {it:control}) +such that a positive value indicates that the other group has a higher +mean in the balance variable. +{p_end} + +{dlgtab:Example 4} + +{input}{space 8}sysuse census +{space 8}iebaltab pop medage, groupvar(region) browse control(4) stats(desc(var) pair(p)) +{space 8}browse +{text} +{pstd}You can control which statistics to output in using the {inp:stats()} option. +In this example, the sub-option {inp:desc(var)} indicates that +the variance should be displayed in the descriptive statistics section +instead of standard error which is the default. +The sub-option {inp:pair(p)} indicates that +the p-value in from the t-tests in the pairwise test section should be displayed +instead of the difference in mean between the groups which is the default. +See above in this help file for full details on the sub-options you may use. +{p_end} + +{dlgtab:Example 5} + +{input}{space 8}sysuse census +{space 8}local outfld "path/to/folder" +{space 8}iebaltab pop medage, groupvar(region) control(4) /// +{space 8} stats(desc(var) pair(p)) replace /// +{space 8} savecsv("`outfld'/iebtb.csv") savexlsx("`outfld'/iebtb.xlsx") /// +{space 8} savetex("`outfld'/iebtb.tex") texnotefile("`outfld'/iebtb_note.tex") +{text} +{pstd}This example shows how to export the tables to the three formats supported. +CSV, Excel and LaTeX. +To run this code you must update the path {it:{c 34}path/to/folder{c 34}} to point +to a folder on your computer where the tables can be exported to. +This is what we recommend over using the {inp:browse} options for final code. +When exporting to LaTeX we recommend exporting the note to a separate file +using the option {inp:texnotefile()} and then import it in LaTeX using the +package {inp:threeparttable} like the code below. +It makes it easier to align the note with the table when LaTeX adjust the size +of the table to fit a page. +{p_end} + +{input}{space 8}\begin{table} +{space 8} \centering +{space 8} \caption{Balance table} +{space 8} \begin{adjustbox}{max width=\textwidth} +{space 8} \begin{threeparttable}[!h] +{space 8} \input{./balancetable.tex} +{space 8} \begin{tablenotes}[flushleft] +{space 8} \item\hspace{-.25em}\input{./balancetable_note.tex} +{space 8} \end{tablenotes} +{space 8} \end{threeparttable} +{space 8} \end{adjustbox} +{space 8}\end{table} +{text} +{dlgtab:Example 6} + +{input}{space 8}sysuse census +{space 8}iebaltab pop medage, groupvar(region) +{space 8}local rnum = rownumb(r(iebtab_rmat),"medage") +{space 8}local cnum = colnumb(r(iebtab_rmat),"p_2_4") +{space 8}local p_medage_2_4 = el(r(iebtab_rmat),`rnum',`cnum') +{space 8}di "The p-value in the test for medage between region 2 and 4 is: `p_medage_2_4'" +{text} +{pstd}In this example none of the export options ({inp:browse}, {inp:savecsv()} etc.) are used +and the only place where the results are stored +is in the {inp:r(iebtab_rmat)} matrix. +The {inp:rownumb()} and the {inp:colnumb()} functions can be used to get +the row and column number from the row and column names. +These row and column numbers can be used to get the individual value in the function {inp:el()}. +If you know the row and column number you can use the {inp:el()} function directly. +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit iebaltab{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/ieboilstart.sthlp b/src/sthlp/ieboilstart.sthlp new file mode 100644 index 00000000..344f286c --- /dev/null +++ b/src/sthlp/ieboilstart.sthlp @@ -0,0 +1,213 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:ieboilstart}{p_end} +{hline} + +{title:Title} + +{phang}{bf:ieboilstart} - applies best practices for collaboration and reproducibility within a project. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and workflow of this command please see the {browse "https://dimewiki.worldbank.org/wiki/Ieboilstart":DIME Wiki}. +{p_end} + +{phang}{bf:DISCLAIMER} - One objective of this command is to harmonize settings across users. However, it is impossible to guarantee that different types of Stata (version number, Small/IC/SE/MP or PC/Mac/Linux) will work exactly the same in every possible context. This command does not guarantee against any version discrepancies in Stata or in user-contributed commands. This command is solely a collection of common practices to reduce the risk that the same code generates different outputs when running on different computers. See more details below. +{p_end} + +{title:Syntax} + +{phang}{bf:ieboilstart} , {bf:{ul:v}ersionnumber}( {it:Stata_version} ) [{bf:{ul:ado}path}({it:{c 34}path/to/folder{c 34}}, {c -(}{it:strict} | {it:nostrict}{c )-}) {bf:noclear} {bf:{ul:q}uietly} {bf:veryquietly} {it:memory_options} ] +{p_end} + +{phang}Note that one important feature of this command requires that {bf:r(version)} is written on the first do-file after {bf:ieboilstart}. This setting cannot be specified within a user command and ensures that the Stata version is set correctly. For example: +{p_end} + +{input}{space 8}ieboilstart , options +{space 8}`r(version)' +{text} +{synoptset 44}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:v}ersionnumber}({it:Stata_version})}Sets the Stata version for all subsequent code execution (required){p_end} +{synopt: {bf:{ul:ado}path}({it:{c 34}path/to/folder{c 34}}, {c -(}{it:strict}/{it:nostrict}{c )-})}Sets the folder where this project{c 39}s ado-files or user-written commands are stored (required for standalone reproducibility packages){p_end} +{synopt: {bf:noclear}}Makes the command not start by clearing all data{p_end} +{synopt: {bf:{ul:q}uietly}}Suppresses most of the command{c 39}s output{p_end} +{synopt: {bf:veryquietly}}Suppresses all of the command{c 39}s output{p_end} +{synoptline} + +{dlgtab:Memory options} + +{synoptset 16}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:maxvar}({it:numlist})}Manually specify maximum number of variables allowed{p_end} +{synopt: {bf:matsize}({it:numlist})}Manually specify maximum number of variables allowed in estimation commands{p_end} +{synopt: {bf:{ul:noperm}anently}}Disable the default to permanently set some best practice memory settings{p_end} +{synoptline} + +{title:Description} + +{pstd}{bf:ieboilstart} applies best practices for collaboration and reproducibility within a research project. Making the same Stata code consistently generate the same results when run on other people{c 39}s computers is harder than what it first might seem. This is especially true in order to ensure that Stata code will function identically in the future, even if new versions of Stata and user-written commands (such as those on SSC) have been released. The objective of this command is to reduce the risk that a research project{c 39}s code changes its results when running the same code on different computers or in different points in the future. However, note that it is not technically possible to fully eliminate this risk. +{p_end} + +{pstd}The best practice settings this command applies can be categorized into the following types: version control of built-in commands, version control of user-written commands, {it:other} settings. +{p_end} + +{dlgtab:Version control: Stata and built-in commands} + +{pstd}Research projects often span over several years, and are required to be reproducible for anyone in the future reviewing the results. After several years have passed, it is likely that a new version of Stata has been released. When Stata releases a new version they add new built-in commands, but they might also make changes to already published commands. +{p_end} + +{pstd}For you to make sure that old code in your project behaves the same way even after you update your Stata installation you need to version control the built-in commands in Stata. You also need to version control the built-in commands in Stata when you are collaborating as you cannot be sure what version of Stata everyone else are using at all points in time. Finally, this becomes particularly important when preparing a reproducibility package that should stand the test of time, as you definitely do not know what version of Stata someone in the future will use. +{p_end} + +{pstd}One example where this becomes important is reproducible randomization. Sometimes Stata updates the random number generator between versions. Unless the built-in commands that use randomization are version controlled, then the results of the randomization can vary between versions of Stata. This is true even if other requirements for reproducible randomization is used, such as setting the seed (see {inp:help seed}). Each time Stata updates the random number generator it gets marginally better. However, for the vast majority of research projects, this improvement is so marginal it is most definitely negligible. +{p_end} + +{pstd}This command uses the Stata command {bf:version} (see {inp:help version}) to version control all built-in commands. For some good technical reasons, it is not possible for {bf:ieboilstart} to set the version for the rest of the project{c 39}s code from inside the command. This means that all {bf:ieboilstart} start is preparing the line of code you need to run to version control all built-in commands. You need to run this line of code on the immediate subsequent line after {bf:ieboilstart}. Like this: +{p_end} + +{input}{space 8}ieboilstart , options +{space 8}`r(version)' +{text} +{pstd}The version setting has the scope of a local, meaning that it expires when a do-file and all sub-dofiles it is calling are completed. If {browse "https://dimewiki.worldbank.org/Master_Do-files":main/master do-files} are used, then the version should be set in the main file, and only results generated when running all code from the main file should be considered reproducible. +{p_end} + +{pstd}It is just as important, if not more important, to version control the user-written commands as well. See next section for how to version control user-written commands, such as commands installed from {it:SSC} (see {inp:help ssc}). +{p_end} + +{dlgtab:Version control: User-written commands} + +{pstd}The option {bf:adopath()} makes one key reproducibility component easy to use in Stata. Many projects in Stata relies on user-written commands, such as commands installed from SSC. With user-written commands there is always a risk that the project code does not reproduce correctly if a different version of any user-written command is used. This applies when team members collaborate in real team on a project, but it is especially a risk if someone would try to reproduce the project results in the future. User-written commands updates frequently, and depending on when a user installed a command or when it was last updated, the version of a command that user use will inevitable eventually be different. The option {bf:adopath()} provides an easy to use tool to completely eliminate this risk. +{p_end} + +{pstd}When a project use the {bf:adopath()} option with the sub-option {it:strict}, {bf:adopath}({it:{c 34}path{c 34}}, {it:strict}), it is guaranteed that no one running that project{c 39}s code will ever use any other version of user-written commands than what was intended for that project. When using the sub-option {bf:strict} it is referred to as using {bf:adopath()} in {it:strict mode}. The intention is that this option should almost always be used in strict mode. +{p_end} + +{pstd}The folder that {it:path} in {bf:adopath}({it:{c 34}path{c 34}}, {it:strict}) points to is referred to as the project{c 39}s {it:ado-folder}. To make the project{c 39}s code reproducible as promised above, then this folder needs to be shared with the rest of the project{c 39}s code. Therefore it is recommended that each project has its own {it:ado-folder} and that it is stored together with the rest of that project code. This makes it easy to include the {it:ado-folder}. when sharing the project code, no matter if it is shared over Git/GitHub, sync-software like DropBox, over a network drive, in a reproducibility archive etc. This folder should include all user-written commands this project uses. +{p_end} + +{pstd}When using strict mode, the command {bf:net install} (including commands that builds on it such as {bf:ssc install}) will install the commands in the project{c 39}s {it:ado-folder}. Therefore, the intended workflow is that whenever a project needs another user-written command, then in strict mode, the user simply installs the command using {bf:ssc install} as usual but the command will be installed in the project {it:ado-folder} instead of in that user{c 39}s individual Stata installation. After this, then all users will be guaranteed to use that exact version of that command as long as strict mode is still used. +{p_end} + +{pstd}In order to guarantee that no user use any command other than the commands in the project{c 39}s {it:ado-folder}, the option {it:adopath()} in strict mode, makes all commands the user have installed in their Stata installation unavailable. This setting is restored when the user restarts Stata so nothing is uninstalled or made permanently unavailable. The purpose of this functionality is to make sure that no-one forgets to include any user-written command that the project needs in the {it:ado-folder}. +{p_end} + +{pstd}The {bf:nostrict} sub-option, as in {bf:adopath}({it:{c 34}path{c 34}}, {it:nostrict}), exists to temporarily disable the functionality in strict mode. For example, if someone wants to test using a command installed in their Stata installation before installing it in the project {it:ado-folder} then this option can be used. When {bf:nostrict} is used, when the commands installed in the user{c 39}s Stata installation, are available in addition to the commands in the project{c 39}s {it:ado-folder}. If a user has a command installed in their Stata installation with the same name as a command installed in the {it:ado-folder}, then the version installed in the {it:ado-folder_* will always be used. While using the {bf:nostrict} option can perhaps be seen as more convenient, it would defy the purpose of {bf:adopath()} to use _nostrict} as a projects standard mode. +{p_end} + +{pstd}A in-depth technical presentation on how this feature works can be found in a recording found {browse "https://osf.io/6tg3b":here}. The slides used in that presentation can be found {browse "https://osf.io/wa3tr":here}. Note that in this presentation {bf:nostrict} was called {it:default mode}. While the option {bf:adopath()} makes one component needed for a gold-standard level reproducibility easy to use, it is not the only thing needed for reproducibility. Other practices such as setting the seed if using randomization is still as important. +{p_end} + +{dlgtab:Other settings} + +{pstd}It is rare that any of the settings in this category is anything a typical user ever needs to worry about. These settings mostly prevents that some unusual and outlier memory setting is the reason some computer is not able to run the code the same way as other computers. One example use case where it can be relevant for a user to modify these settings is if the code is developed to run on a computer or server with unusual (for example very small) specifications. +{p_end} + +{pstd}This command also standardize some settings that could, in some cases, could otherwise cause the code to run differently or with interruptions. For example, set more off (see {inp:help set more}), set varabbrev off ({inp:help set varabbrev}), set type float ({inp:help set type}), etc. +{p_end} + +{pstd}See the tables below for a discussion of which settings used and why certain default values were used. +{p_end} + +{dlgtab:Basic Memory Settings} + +{synoptset 11}{...} +{p2coldent:{it:Other Settings}}Explanation{p_end} +{synoptline} +{synopt: {bf:set maxvar}}sets the maximum number of variables allowed. The default value is the maximum allowed in the version of Stata. A lower maximum number can manually be set by the option {bf:maxvar()}. This value is fixed in Stata Small or IC, so this setting is ignored when any of those versions of Stata is used. See set maxvar ({inp:help set maxvar}).{p_end} +{synopt: {bf:set matsize}}sets the maximum number of variables that can be included in estimation commands such as {bf:regress}. The default value used in this command is 400 which is the default value for Stata. A higher value is often allowed but it slows down Stata and is only needed when running very complex analysis. This option can be used to set a higher value, as long as the value does not violate the limitations in the versions of Stata this code will be used in. See set matsize ({inp:help set matsize}).{p_end} +{synoptline} + +{dlgtab:Dynamic Memory Settings} + +{pstd}See memory ({inp:help memory}) for default values. +{p_end} + +{synoptset 15}{...} +{p2coldent:{it:Other Settings}}Explanation{p_end} +{synoptline} +{synopt: {bf:set min_memory}}sets a lower bound for the amount of memory assigned to Stata. The default value is no lower bound.{p_end} +{synopt: {bf:set max_memory}}sets an upper bound for the amount of memory assigned to Stata. The default is as much as the hardware of the computer allows.{p_end} +{synopt: {bf:set niceness}}defines how quickly Stata releases unused memory back to the computer{p_end} +{synopt: {bf:set segmentsize}}defines how large bundles of data is assigned each time Stata request more memory. Too large bundles make Stata occupy an unnecessary large part of the computer{c 39}s memory (that otherwise could have been used by other applications), and too small bundles makes Stata have to interrupt itself to request more bundles of memory too frequently{p_end} +{synoptline} + +{dlgtab:Code Flow Settings} + +{synoptset 12}{...} +{p2coldent:{it:Other Settings}}Explanation{p_end} +{synoptline} +{synopt: {bf:set more off}}disables the default setting that Stata stops and waits for the user to press any key each time the output window is full. Long dofiles would take a very long time to run and require constant attention from the user without this setting. Most Stata users always disable the default which is {bf:set more on}. See set more ({inp:help set more}).{p_end} +{synopt: {bf:pause on}}allows the usage of the command {bf:pause} which can be very useful during debugging. See pause ({inp:help pause}).{p_end} +{synoptline} + +{dlgtab:Variable Settings:} + +{synoptset 17}{...} +{p2coldent:{it:Other Settings}}Explanation{p_end} +{synoptline} +{synopt: {bf:set varabbrev off}}allows users to abbreviate variable names. Somewhat similarly to command names abbreviation such as {bf:gen} for {bf:generate} and {bf:reg} for {bf:regress}. However, command name abbreviations are set up to make sure there is no name conflicts that makes the abbreviations ambiguous. This is not true for variable name abbreviation and code that relies on variable name abbreviations tend to be error prone. See set varabbrev ({inp:help set varabbrev}) for more details and carefully consider these words of caution before enabling variable name abbreviation in a collaborative dofile.{p_end} +{synopt: {bf:set type float}}sets the default variable type to {it:float} when creating a new variable and no type is specified. Different default types can lead to differences in randomization as this setting affects the precision in the randomization. For extremely large dataset the type {it:double} might be required, when generating random numbers that is expected to be unique. But since that type is twice as storage intensive, this command use {it:float} as default, and users need to specify {it:double} in the rare cases it makes a difference.{p_end} +{synoptline} + +{title:Options} + +{pstd}{bf:{ul:v}ersionnumber}({it:string}) sets a stable version of Stata for all users. Stata does not (for good reasons) allow a user-written command to alter the version setting from inside a command. Therefore, this option does {it:nothing} unless {bf:r(version)} is included as described in the Syntax section. While the version number cannot be set inside the command code, {bf:ieboilstart} does two things. First it reminds the user to set the version since it is a required command. Second, it makes sure that the version number used is not too old. A too old version might risk that there are far too big a difference in many commands. Best practice is therefore to keep the same version number throughout a project, unless there is something specific to a newer version that is required for any dofile. Only major and recent versions are allowed in order to reduce errors and complexity. All versions of Stata can be set to run any older version of Stata but not a newer. +{p_end} + +{pstd}{bf:{ul:ado}path}({it:{c 34}path/to/folder{c 34}} [, {it:strict}]) adds the folder specified in this option to the ado-file paths (see {inp:help sysdir}). When {it:strict} is not used this option sets the {it:PERSONAL} path to the path specified in this command. When {it:strict} is used then this option instead sets that path to the {it:PLUS} path. Read more in {inp:help sysdir} about the {it:PERSONAL} and {it:PLUS} paths. When {it:strict} is used the all other ado-paths are removed apart from the {it:BASE} path where the built-in Stata commands are stored. When preparing a reproducibility package one should use the {it:strict} to make sure that all user-written commands are saved in the project ado-folder. If a project should eventually be turned into a reproducibility package, then it is easier to use {it:strict} from the beginning and continuously add user-written commands as they are introduced to the project{c 39}s code. This is easier compared to, in the very end making sure that the correct versions of all user-written commands are installed in the project ado-folder. +{p_end} + +{pstd}{bf:noclear} prevents the command from clearing any data set currently loaded into Stata{c 39}s working memory. The default is to clear data as the working memory needs to be empty in order to modify settings for maxvar, min{it:memory, max_memory and segmentsize. Nothing saved to hard drive memory will ever be deleted by this command. This command is intended to be placed at the very top of a dofile, before any data is loaded into working memory. For these reasons, {bf:noclear} and {bf:maxvar()} cannot be used together. +{p_end} + +{pstd}{bf:{ul:q}uietly} suppresses the most verbose outputs from this command, but not the most important outputs. +{p_end} + +{pstd}{bf:veryquietly} suppresses all the output from this command. Including the important reminder to set the version number using {bf:r(version)} after running the command. +{p_end} + +{pstd}{bf:maxvar}({it:numlist}) manually sets the maximum number of variables allowed in a data set. The default is to set the number to the highest allowed in the user{c 39}s version of Stata. Reducing this number can occasionally improve performance, but it is unlikely to make a difference to a modern computer. This option can be used if a project wants to make sure that the code can run on smaller versions of Stata or small computers. Then the project can use this option to restrict all computers to those limitations, so no one write codes exceeding them. +{p_end} + +{pstd}{bf:matsize}({it:numlist}) manually sets the maximum number of variables allowed in estimation commands, for example regress. The default is to set the number to the highest allowed in the user{c 39}s version of Stata. Reducing this number can occasionally improve performance, but it is unlikely to make a difference to a modern computer. This option can be used if a project wants to make sure that the code can run on smaller versions of Stata or small computers. Then the project can use this option to restrict all computers to those limitations, so no one write codes exceeding them. +{p_end} + +{pstd}{bf:{ul:noperm}anently} is used to disable that this command updates any default settings in a user{c 39}s installation of Stata. For extensively used best practices, this command updates the default settings such that they apply even after the user has restarted their Stata session. See option permanently in memory ({inp:help memory}) for more details. The setting {bf:set more off} is always set permanently, regardless of if this option used, as it universally agreed within the Stata community to be better. +{p_end} + +{title:Examples} + +{dlgtab:Example 1} + +{input}{space 8}ieboilstart, versionnumber(12.1) +{space 8}`r(version)' +{text} +{pstd}After running the two lines of code above all users will run their version of Stata as if the version was 12.1. That means that anyone who bought or upgraded their Stata to version 12.1 or a more recent version can run this code and will behave as identical as possible. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8}local proj_ado "/path/to/project/code/ado" +{space 8}ieboilstart, opt versionnumber(15.1) adopath_("`proj_ado'", strict) +{space 8}`r(version)' +{space 8} +{text} +{pstd}In this example the Stata version is set to 15.1 and the ado-folders are updated. Let{c 39}s say a project folder is located at {it:{c 34}/path/to/project{c 34}} and inside it there is a folder called {it:code} where all code files are located. This would be a great location for a folder called {it:ado} that would be the project specific ado-folder. Since the sub-option {it:strict} is used this is the only place where Stata would look for commands that are not built-in commands. Any commands installed by SSC before updating this ado-path is no longer available. Any such commands that is needed in the code for this project needs to be installed again in the project specific ado-folder. Which can be done using {bf:ssc install ...} the regular way after {bf:ieboilstart} was run like this. +{p_end} + +{title:Author} + +{pstd}All commands in ietoolkit is developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group +{p_end} + +{pstd}Please send bug-reports, suggestions and requests for clarifications writing {c 34}ietoolkit ieboilstart{c 34} in the subject line to: {browse "mailto:dimeanalytics@worldbank.org":dimeanalyticswworldbank.org} +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":the GitHub repository of ietoolkit}. +{p_end} diff --git a/src/sthlp/ieddtab.sthlp b/src/sthlp/ieddtab.sthlp new file mode 100644 index 00000000..9b83b8fa --- /dev/null +++ b/src/sthlp/ieddtab.sthlp @@ -0,0 +1,268 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:ieddtab}{p_end} +{hline} + +{title:Title} + +{phang}{bf:ieddtab} - This command runs a Diff-in-Diff regression and displays the baseline values, the two 1st differences and the 2nd difference. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Ieddtab":DIME Wiki} +{p_end} + +{title:Syntax} + +{phang}{bf:ieddtab} {it:varlist} [if] [in] [weight], {bf:{ul:t}ime}({it:varname}) {bf:{ul:treat}ment}({it:varname}) [ {bf:{ul:covar}iates}({it:varlist}) {bf:{ul:vce}}({it:vce_types}) {bf:{ul:star}levels}({it:numlist}) {bf:stardrop} {bf:{ul:err}ortype}({it:string}) {bf:{ul:rowl}abtype}({it:string}) {bf:rowlabtext}({it:label_string}) {bf:format}({it:%fmt}) {bf:replace} {bf:{ul:savet}ex}({it:filepath}) {bf:onerow} {bf:nonumbers} {bf:nonotes} {bf:{ul:addn}otes}({it:string}) {bf:{ul:texdoc}ument} {bf:{ul:texc}aption}({it:string}) {bf:{ul:texl}abel}({it:string}) {bf:{ul:texn}otewidth}({it:numlist}) {bf:texvspace}({it:string}) ] +{p_end} + +{phang}Where varlist is a list of numeric continuous outcome variables (also called dependent variables or left hand side variables) to be used in the difference-in-difference regression(s) this command runs and presents the results from. +{p_end} + +{dlgtab:Required options:} + +{synoptset 18}{...} +{p2coldent:{it:Options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:t}ime}({it:varname})}Time dummy to use in diff-in-diff regression{p_end} +{synopt: {bf:{ul:treat}ment}({it:varname})}Treatment dummy to use in diff-in-diff regression{p_end} +{synoptline} + +{dlgtab:Statistics options:} + +{synoptset 19}{...} +{p2coldent:{it:Options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:covar}iates}({it:varlist})}Covariates to use in diff-in-diff regression{p_end} +{synopt: {bf:{ul:vce}}({it:vce_types})}Options for variance estimation. {bf:Robust}, {bf:cluster} {it:clustervar} or {bf:bootstrap}{p_end} +{synopt: {bf:{ul:star}levels}({it:numlist})}Significance levels used for significance stars, default values are .1, .05, and .01{p_end} +{synopt: {bf:stardrop}}Suppresses all significance stars in all tables.{p_end} +{synopt: {bf:{ul:err}ortype}({it:string})}Type of errors to display, default is standard errors.{p_end} +{synoptline} + +{dlgtab:Output options:} + +{synoptset 24}{...} +{p2coldent:{it:Options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:rowl}abtype}({it:string})}Indicate what to use as row titles, default is variable name.{p_end} +{synopt: {bf:rowlabtext}({it:label_string})}Manually enter the row titles using label strings (see below).{p_end} +{synopt: {bf:nonotes}}Disable that the automatically generated note is displayed below the table.{p_end} +{synopt: {bf:{ul:addn}otes}({it:string})}Manually add a note to be displayed below the regression result table.{p_end} +{synopt: {bf:onerow}}Display the number of observations on one row at the last row of the table.{p_end} +{synopt: {bf:format}({it:%fmt})}Set the rounding format of the calculated statistics in the table.{p_end} +{synopt: {bf:replace}}Replace the file on disk if it already exist. Has no effect if no option with file path is used.{p_end} +{synoptline} + +{dlgtab:LaTeX options:} + +{synoptset 21}{...} +{p2coldent:{it:Options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:savet}ex}({it:filepath})}Generate a LaTeX table of the result and save to the location of the file path.{p_end} +{synopt: {bf:{ul:texdoc}ument}}Creates a stand-alone TeX document.{p_end} +{synopt: {bf:{ul:texc}aption}({it:string})}Specify table{c 39}s caption on TeX file.{p_end} +{synopt: {bf:{ul:texl}abel}({it:string})}Specify table{c 39}s label, used for meta-reference across TeX file.{p_end} +{synopt: {bf:{ul:texn}otewidth}({it:numlist})}Manually enter the width of the note on the TeX file.{p_end} +{synopt: {bf:texvspace}({it:string})}Manually set size of the line space between two rows on TeX output.{p_end} +{synopt: {bf:nonumbers}}Omit column numbers from table header in LaTeX output.{p_end} +{synoptline} + +{title:Description} + +{pstd}{bf:ieddtab} is a command that makes it easy to run and display results of differences-in-differences (diff-in-diff) regressions. The table that presents the results from the diff-in-diff regression also presents the mean when the variable in {bf:time()} is 0 (i.e., baseline) for the two groups defined by the variable {bf:treatment()} is 0 and 1 (i.e., control and treatment), and the table also presents the coefficient of the first difference regression in control and treatment. +{p_end} + +{pstd}The sample for each row in the table is defined by the sample included in the second difference regression shown below, where {it:outcome_var} is a variable the varlist (one per row) for {bf:ieddtab}, {bf:interaction} is the interaction dummy listed in {bf:time()} and the dummy listed in {bf:treatment()}, and where {bf:covariates} is the list of covariates included in {bf:covariates()} if any. This means that any observation that has any missing value in either of the two or in any of the covariates will be omitted from all statistics presented in the table. The coefficient presented in the table for the diff-in-diff regression is the interaction of the time and treatment variable. +{p_end} + +{input}{space 8}tempvar interaction +{space 8}generate `interaction' = `time' * `treatment' +{space 8}regress outcome_var `time' `treatment' `interaction' `covariates' +{text} +{pstd}The baseline means are then calculated using the following code where the first line is control and the second line is treatment, and the variable {bf:regsample} is dummy indicating if the observation was included in the second difference on. +{p_end} + +{input}{space 8}mean outcome_var if `treatment' == 0 & `time' == 0 & regsample == 1 +{space 8}mean outcome_var if `treatment' == 1 & `time' == 0 & regsample == 1 +{text} +{pstd}The first difference coefficients are then calculated using the following code where the first line is control and the second line is treatment. The coefficient displayed in the table is the coefficient of the variable {bf:time} which is the variable listed in {bf:t()}. +{p_end} + +{input}{space 8}regress outcome_var `time' `covariates' if `treatment' == 0 & regsample == 1 +{space 8}regress outcome_var `time' `covariates' if `treatment' == 1 & regsample == 1 +{text} +{title:Options} + +{dlgtab:Required options:} + +{pstd}{bf:t}({it:varname}) indicates which variable should be used as the time dummy to use in diff-in-diff regression. This must be a dummy variable, i.e., only have 0, 1, or missing as values, where 0 is baseline and 1 is follow-up. +{p_end} + +{pstd}{bf:treatment}({it:varname}) indicates which variable should be used as the treatment dummy to use in diff-in-diff regression. This must be a dummy variable, i.e., only have 0, 1, or missing as values. +{p_end} + +{pstd}{bf:{ul:Statistics options:}} +{p_end} + +{pstd}{bf:{ul:covar}iates}({it:varlist}) lists the variables that should be included as covariates (independent variables not reported in the table) in the two first difference regressions and the second difference regression. Unless the option {bf:nonotes} is used a list of covariate variables is included below the table. +{p_end} + +{pstd}{bf:{ul:vce}}({it:vce_types}) sets the type of variance estimator to be used in all regressions for this command. See {bf:vce_types} ({inp:help vce_types}) for more details. The only vce types allowed in this command are robust, cluster clustervar, or bootstrap. Option robust only applied to first and second difference estimators, not to baseline means. +{p_end} + +{pstd}{bf:{ul:star}levels}({it:numlist}) sets the significance levels used for significance stars. Exactly three values must be listed if this option is used, all three values must be in descending order, and must be between 0 and 1. The default values are .1, .05, and .01. The levels specified in this option are ignored if {bf:stardrop} is used. +{p_end} + +{pstd}{bf:stardrop} suppresses all significance stars in all tables and removes the note on significance levels from the table note. +{p_end} + +{pstd}{bf:{ul:err}ortype}({it:string}) sets the type of error to display. Allowed values for this option are {bf:se} for standard errors, {bf:sd} for standard deviation, and {bf:errhide} for not displaying any errors in the table. The default is to display standard errors. +{p_end} + +{dlgtab:Output options:} + +{pstd}{bf:{ul:rowl}abtype}({it:string}) indicates what to use as row titles. The allowed values are {bf:varname} using the variable name as row titles, {bf:varlab} using the variable labels as row titles (varname will still be used if the variable does not have a variable label). The default is to use the variable name. +{p_end} + +{pstd}{bf:rowlabtext}({it:label_string}) manually specifies the row titles using label strings. A label string is a list of variable names followed by the row title for that variable separated by {c 34}@@{c 34}. For example {it:varA Row title variable A @@ varB Row title variable B}, where {it:varA} and {it:varB} are outcome variables used in this command. For variables not listed in {bf:rowlabtext()} row titles will be determined by the input value or default value in {bf:rowlabtype()}. +{p_end} + +{pstd}{bf:nonotes} disables that the command automatically generates and displays a note below the table describing the output in the table. The note includes a description on how the number of calculations are calculated, the significance levels used for stars and which covariates were used if any were used. +{p_end} + +{pstd}{bf:{ul:addn}otes}({it:string}) is used to manually add a note to be displayed below the regression result table. This note is put before the automatically generated note, unless option {bf:nonotes} is specified, in which case only the manually added note is displayed. +{p_end} + +{pstd}{bf:onerow} indicates that the number of observations should be displayed on one row at the last row of the table instead of on each row. This requires that the number of observations are the same across all rows for each column. +{p_end} + +{pstd}{bf:format}({it:%fmt}) sets the number formatting/rounding rule for all calculated statistics in the table, that is, all numbers in the table apart from the number of observations. Only valid Stata number formats (see {inp:help format}) are allowed. The default is {it:%9.2f}. +{p_end} + +{pstd}{bf:replace} if an option is used that outputs a file and a file with that name already exists at that location, then Stata will throw an error unless this option is used. If this option is used then Stata overwrites the file on disk with the new output. This option has no effect if no option with file path is used. +{p_end} + +{dlgtab:LaTeX options:} + +{pstd}{bf:{ul:savet}ex}({it:filepath}) saves the table in TeX format to the location of the file path. +{p_end} + +{pstd}{bf:{ul:texdoc}ument} creates a stand-alone TeX document that can be readily compiled, without the need to import it to a different file. As default, {bf:savetex()} creates a fragmented TeX file consisting only of a tabular environment. +{p_end} + +{pstd}{bf:{ul:texc}aption}({it:string}) writes table{c 39}s caption in TeX file. Can only be used with option texdocument. +{p_end} + +{pstd}{bf:{ul:texl}abel}({it:string}) specifies table{c 39}s label, used for meta-reference across TeX file. Can only be used with option texdocument. +{p_end} + +{pstd}{bf:{ul:texn}otewidth}({it:numlist}) manually adjusts the width of the note to fit the size of the table. The note width is a multiple of text width. If not specified, default is one, which makes the table width equal to text width. +{p_end} + +{pstd}{bf:texvspace}({it:string}) sets the size of the line space between two variable rows. {it:string} must consist of a numeric value and one of the following units: {c 34}cm{c 34}, {c 34}mm{c 34}, {c 34}pt{c 34}, {c 34}in{c 34}, {c 34}ex{c 34} or {c 34}em{c 34}. Note that the resulting line space displayed will be equal to the specified value minus the height of one line of text. Default is {c 34}3ex{c 34}. For more information on units, check {browse "https://en.wikibooks.org/wiki/LaTeX/Lengths":LaTeX lengths manual}. +{p_end} + +{pstd}{bf:nonumbers} omits column numbers from table header in LaTeX output. Default is to display column numbers. +{p_end} + +{title:Examples} + +{pstd}All the examples below can be run on Stata{c 39}s built-in census data set, by first running this code: +{p_end} + +{pstd}* Open the built-in data set +{p_end} + +{input}{space 8}sysuse census +{text} +{pstd}* Calculate rates from absolute numbers +{p_end} + +{input}{space 8}replace death = 100 * death / pop +{space 8}replace marriage = 100 * marriage / pop +{space 8}replace divorce = 100 * divorce / pop +{text} +{pstd}* Randomly assign time and treatment dummies +{p_end} + +{input}{space 8}gen t = (runiform()<.5) +{space 8}gen treatment = (runiform()<.5) +{text} +{dlgtab:Example 1.} + +{input}{space 8}ieddtab death marriage divorce , t(time) treatment(treatment) +{text} +{pstd}This is the most basic way to run this command with three variables. This will output a table with the baseline means for treatment = 0 and treatment = 1, the first difference regression coefficient for treatment = 0 and treatment = 1 as well as the 2nd difference regression coefficient for treatment = 0 and treatment = 1. +{p_end} + +{dlgtab:Example 2.} + +{input}{space 8}ieddtab death marriage divorce , t(time) treatment(treatment) rowlabtext("death Death Rate @@ divorce Divorce Rate") rowlabtype("varlab") +{text} +{pstd}The table generated by example 2 will have the same statistics as in example 1 but the row title for the variables death and divorce are entered manually and the row title for marriage will be its variable label instead of its variable name. +{p_end} + +{dlgtab:Example 3.} + +{input}{space 8}ieddtab death marriage divorce , t(time) treatment(treatment) rowlabtype("varlab") savetex("DID table.tex") replace +{text} +{pstd}The table will be saved in the current directory under the name {c 34}DID table.tex{c 34}. It will have the same statistics as in examples 1 and 2, and the row titles will be its variable labels. +{p_end} + +{title:Acknowledgements} + +{pstd}This command was initially suggested by Esteban J. Quinones, University of Wisconsin-Madison. +{p_end} + +{pstd}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetical order): +{p_end} + +{pstd}Benjamin Daniels +{p_end} + +{pstd}Jonas Guthoff +{p_end} + +{pstd}Nausheen Khan +{p_end} + +{pstd}Varnitha Kurli +{p_end} + +{pstd}Saori Iwamoto +{p_end} + +{pstd}Meyhar Mohammed +{p_end} + +{pstd}Michael Orevba +{p_end} + +{pstd}Matteo Ruzzante +{p_end} + +{pstd}Sakina Shibuya +{p_end} + +{pstd}Leonardo Viotti +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit ieddtab{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iedropone.sthlp b/src/sthlp/iedropone.sthlp new file mode 100644 index 00000000..ebbebd18 --- /dev/null +++ b/src/sthlp/iedropone.sthlp @@ -0,0 +1,147 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iedropone}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iedropone} - an extension of the command {inp:drop} with features preventing additional observations are unintentionally dropped. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Iedropone":DIME Wiki}. +{p_end} + +{title:Syntax} + +{phang}{bf:iedropone} [{bf:if}] , [ {bf:{ul:n}umobs}({it:integer}) {bf:mvar}({it:varname}) {bf:mval}({it:list of values}) {bf:zerook} ] +{p_end} + +{synoptset 20}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:n}umobs}({it:integer})}Number of observations that is allowed to be dropped - default is 1{p_end} +{synopt: {bf:mvar}({it:varname})}Allows that no observation is dropped{p_end} +{synopt: {bf:mval}({it:list of values})}Variable for which multiple values should be dropped - must be used together with {inp:mval()}{p_end} +{synopt: {bf:zerook}}The list of values in {inp:mvar()} that should be dropped - must be used together with {inp:mvar()}{p_end} +{synoptline} + +{title:Description} + +{pstd}This commands might be easier to understand by following the examples below before reading the description or the explanations of the options. +{p_end} + +{pstd}{inp:iedropone} has the same purpose as the Stata built-in command {inp:drop} when dropping observations. +However, {inp:iedropone} safeguards that no additional observations are unintentionally dropped, +or that changes are made to the data so that the observations that are supposed to be dropped are no longer dropped. +{p_end} + +{pstd}{inp:iedropone} checks that no more or fewer observations than intended are dropped. +For example, in the case that one observation has been identified to be dropped, +then we want to make sure that when re-running the do-file no other observations are dropped +even if more observations are added to that data set or changed in any other way. +{p_end} + +{pstd}While the default is 1, +{inp:iedropone} allows the user to set any another number of observation that should be dropped. +If the number of observations that fit the drop condition is different, +then the command will throw an error. +{p_end} + +{title:Options} + +{pstd}{bf:{ul:n}umobs}({it:integer}) this allows the user to set the number of observation that should be dropped. +The default is 1 but any positive integer can be used. +The command throws an error if any other number of observations match the drop condition. +{p_end} + +{pstd}{bf:mvar}({it:varname}) and {bf:mval}({it:list of values}) allows that multiple values in one variable are dropped. +These two options must be used together. +If the variable in {inp:mvar()} is a string variable +and some of the values in {inp:mval()} includes spaces, +then the list of values in mval() must be listed exactly as in example 4 below. +The command loops over the values in {inp:mval()} +and drops the observations that satisfy the if condition and each of the value in {inp:mval()}. +For example: +{p_end} + +{input}{space 8}iedropone if village == 100 , mvar(household_id) mval(21 22 23) +{text} +{pstd}is identical to: +{p_end} + +{input}{space 8}iedropone if village == 100 & household_id == 21 +{space 8}iedropone if village == 100 & household_id == 22 +{space 8}iedropone if village == 100 & household_id == 23 +{text} +{pstd}The default is that exactly one observation should be dropped for each value in {inp:mval()} +unless {inp:numobs()} or {inp:zerook} is used. +If those options are used then, then they apply to all values in {inp:mval()} separately. +{p_end} + +{pstd}{bf:mval}({it:list of values}) - see {bf:mvar}({it:varname}) above. +{p_end} + +{pstd}{bf:zerook} allows that no observations are dropped. +The default is that an error is thrown if no observations are dropped. +{p_end} + +{title:Stored results} + +{title:Examples} + +{dlgtab:Example 1.} + +{pstd}Let{c 39}s say that we have identified the household with the ID 712047 to be incorrect and it should be dropped. +Identical to {inp:drop if household_id == 712047} but it will test that +exactly one observation is dropped each time the do-file runs. +This guarantees that we will get an error message that +no observation is dropped if someone makes a change to the ID. +Otherwise we would unknowingly keep this incorrect observation in our data set. +{p_end} + +{pstd}Similarly, if a new observation is added that is the correct household with ID 712047, +then both observation would be dropped without warning if we would have used {inp:drop if household_id == 712047}. +{inp:iedropone} can be used as below to make sure that only that one observations is dropped. +And if the data changes such that two observations are dropped, +then the command will throw and error. +{p_end} + +{input}{space 8}iedropone if household_id == 712047 +{text} +{dlgtab:Example 2.} + +{pstd}Let{c 39}s say we have added a new household with the ID 712047. +In order to drop only one of those observations we must expand +the if-condition to indicate which one of them we want to drop. +{p_end} + +{input}{space 8}iedropone if household_id == 712047 & household_head == "Bob Smith" +{text} +{dlgtab:Example 3.} + +{pstd}Let{c 39}s say we added a new household with the ID 712047 but we want to drop exactly both of them, +then we can use the option {inp:numobs()}. +The command will now throw an error if not exactly +two observations have the household ID 712047. +{p_end} + +{input}{space 8}iedropone if household_id == 712047, numobs(2) +{text} +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit iedropone{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iefolder.sthlp b/src/sthlp/iefolder.sthlp new file mode 100644 index 00000000..fa4abe64 --- /dev/null +++ b/src/sthlp/iefolder.sthlp @@ -0,0 +1,301 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iefolder}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iefolder} - sets up project folders and master do-files according to World Bank DIME{c 39}s standards. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Iefolder":DIME Wiki} +{p_end} + +{title:Syntax} + +{phang}{it:When initially setting up the {inp:DataWork} folder in a new project}: +{p_end} + +{phang}{bf:iefolder} new {it:project_name} , {bf:{ul:proj}ectfolder}({it:directory}) +{p_end} + +{phang}{it:When adding folders to and already existing {inp:DataWork} folder}: +{p_end} + +{phang}{bf:iefolder} new {it:item_type} {it:item_name} , {bf:{ul:proj}ectfolder}({it:directory}) [{bf:abbreviation}({it:string}) {bf:subfolder}({it:folder})] +{p_end} + +{phang}where {it:item_type} is either {it:round}, {it:unitofobs} or {it:subfolder}. See details on {it:item_type} and {it:item_name} below. +{p_end} + +{synoptset 24}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:proj}ectfolder}({it:directory})}The location of the project folder where the {it:DataWork} folder should be created (new projects), or where it is located (new rounds, unitofobs and subfolders).{p_end} +{synopt: {bf:abbreviation}({it:string})}Optional abbreviation of round name to be used to make globals shorter. Can only be used with {inp:iefolder new round}.{p_end} +{synopt: {bf:subfolder}({it:folder})}Creates the round folders inside a subfolder to {it:DataWork}. Only works with new rounds and only after the subfolder has been created with {inp:iefolder new subfolder}.{p_end} +{synoptline} + +{title:Description} + +{pstd}{inp:iefolder} automates the process of setting up the folders and +master do-files where all the data work will take place in a project folder. +The folder structure set up by {inp:iefolder} follows DIME{c 39}s best practices. +{p_end} + +{pstd}In addition to setting up the {it:DataWork} folder and its folder structure, +the command creates master do-files linking to +all main folders in the folder structure. +These master do-files are updated whenever more rounds, +units of observations, and subfolders are added to +the project folder using this command. +{p_end} + +{dlgtab:Item types} + +{pstd}This command can create either a new {it:DataWork} folder or add folders +to an existing {it:DataWork} folder. +The existing {it:DataWork} folder must have been created with +{inp:iefolder} for the additions to work. +A new {it:DataWork} folder is created using specifying project. +There are three types of folders that can be added to an existing folder +by specifying {it:round}, {it:unitofobs} or {it:subfolder}. +See the next paragraphs for descriptions. +{p_end} + +{pstd}{bf:project} sets up a new {it:DataWork} folder and its initial folder structure. +You must always do this before you can do anything else. +It also sets up the main master do-file for this {it:DataWork} folder. +{inp:iefolder} is implemented so that you can keep working for years +with your project in between adding folders. +The command reads and preserves changes made manually to the {it:DataWork} folder +and master do-file before adding more folders using {inp:iefolder}. +{p_end} + +{pstd}{bf:round} folders are folders specific to a data collection round, +for example, Baseline, Endline, Follow Up etc. +(See subfolder below if your project is more complex than that.) +When adding a new round, a round folder is added to the {it:DataWork} folder, +and inside it the round folder structure described +{browse "https://dimewik/wiki/DataWork_Survey_Round":here} is created. +{inp:iefolder} also creates a master do-file specific for this round with +globals referencing the main folders in the folder structure +specific to this round. +Folders are created in two places, both in the {it:DataWork} folder, +and in the Encrypted folder. +{p_end} + +{pstd}{bf:unitofobs} folders are folders specific to a unit of observation, +for example the master data set folder. +Read more about master data sets and the folder structure +this commands sets up for you at here. +A master data folder for each new unit of observation is created in two places. +Both in the MasterData folder in the {it:DataWork} folder, +and in the Encrypted folder. +{p_end} + +{pstd}{bf:subfolder} can be used to organize project folders with +a lot of data collections. +For examples, instead of having only one baseline data collection, +a project might have a student, a teacher, +and a school data collections during baseline. +You can then first create a baseline folder in the project folder using +{it:subfolder} and then creating round-folders for student, teacher, school, etc., +inside the sub-folder suing {it:round} with the option {bf:subfolder}({it:baseeline}). +When creating a subfolder, +only a single folder is created in the {it:DataWork} folder which is empty. +The main master do-file is however updated with a global to this folder. +{p_end} + +{title:Options} + +{pstd}{bf:{ul:proj}ectfolder}({it:directory}) should point to the same folder +regardless of which {it:item_type} is created. +If new project is specified, +the file path should point to where {it:DataWork} should be created, +and if new round or new project is specified, +it should point to where {it:DataWork} was already created. +See how the file path is the same both time when {inp:iefolder} +is called twice in Example 1 below. +{p_end} + +{pstd}{bf:abbreviation}({it:string}) can be used to shorten the globals created +in the master do-files that point to the sub-folders to round folders. +For example, if you create a new round called Baseline, +as in Example 1, then a global to the {it:DataSet} folder called Baseline{it:dt +will be created in the master do-file. +If the abbreviation option would have been used, +like in Example 2, then the global would have been called BL{it:dt. +{p_end} + +{pstd}{bf:subfolder}({it:folder}) creates a round folder inside +the folder specified in this option. +This option can only be used when creating a new round. +The folder specified must have been created using {inp:iefolder}. See example 3. +{p_end} + +{title:Examples} + +{dlgtab:Example 1} + +{input}{space 8}global projectFolder "C:/Users/Documents/DropBox/ProjectABC" +{space 8} +{space 8}iefolder new project , projectfolder("$projectFolder") +{space 8}iefolder new round baseline , projectfolder("$projectFolder") +{text} +{pstd}In the example above, in the line the first time {inp:iefolder} is used, +a folder called {it:DataWork} is created at the location of +{inp:C:/Users/Documents/DropBox/ProjectABC}. +In the line where {inp:iefolder} used a second time, +a folder for the baseline round is created inside the {it:DataWork} folder. +Note that the folder provided in {inp:projectfolder()} is the same both times. +{p_end} + +{pstd}Both the {it:DataWork} folder and the baseline folder created have +sub-folders and master do-files creating globals pointing to these. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8}global projectFolder "C:/Users/Documents/DropBox/ProjectABC" +{space 8} +{space 8}iefolder new project , projectfolder("$projectFolder") +{space 8}iefolder new round baseline , projectfolder("$projectFolder") abbreviation("BL") +{text} +{pstd}The example above creates the same folder structure as in Example 1, +but in the globals in the master do-files the abbreviation BL +is used instead of baseline. +But the folders created on disk will still be called baseline. +{p_end} + +{dlgtab:Example 3} + +{pstd}This example shows how to use subfolders. +{p_end} + +{input}{space 8}global projectFolder "C:/Users/Documents/DropBox/ProjectABC" +{space 8} +{space 8}iefolder new project , projectfolder("$projectFolder") +{space 8} +{space 8}iefolder new subfolder baseline , projectfolder("$projectFolder") +{space 8}iefolder new round studentBL , projectfolder("$projectFolder") subfolder("baseline") +{space 8}iefolder new round teacherBL , projectfolder("$projectFolder") subfolder("baseline") +{text} +{pstd}The code above creates a new {it:DataWork} folder inside the folder ProjectABC. +Then subfolder is used to create a folder called baseline. +Then the two baseline rounds, student and teacher, +are created inside the folder baseline. +{p_end} + +{pstd}The code below shows how the endline folder can be created in the same folder. +Note that the rounds need to have unique names even across subfolders, +and that is why the student and teacher round have the suffix EL. +{p_end} + +{input}{space 8}global projectFolder "C:/Users/Documents/DropBox/ProjectABC" +{space 8} +{space 8}iefolder new subfolder endline , projectfolder("$projectFolder") +{space 8}iefolder new round studentEL , projectfolder("$projectFolder") subfolder("endline") +{space 8}iefolder new round teacherEL , projectfolder("$projectFolder") subfolder("endline") +{text} +{dlgtab:Example 4} + +{pstd}The example below is meant to describe an intended workflow +for a full life cycle of an impact evaluation. +First we need to set up the {it:DataWork} folder. +We do that using {inp:iefolder new project}. Like this: +{p_end} + +{input}{space 8}iefolder new project , projectfolder("C:/DropBox/ProjectABC") +{text} +{pstd}Our first data collection will be a baseline +where the unit of observation is households. +We therefore need to set up folders for the unit of observation {c 34}households{c 34}. +In the encrypted master folder for {c 34}households{c 34} +you can create your list over households and you have a subfolder called Sampling +where you can keep do files and data with identifying information. +We create all of that by using {inp:iefolder new unitofobs household}. Like this: +{p_end} + +{input}{space 8}iefolder new unitofobs household , projectfolder("C:/DropBox/ProjectABC") abbreviation("BL") +{text} +{pstd}When we are ready to start preparing for the baseline +we want to create the baseline folder. +We do that using {inp:iefolder new round baseline}. Like this: +{p_end} + +{input}{space 8}iefolder new round baseline , projectfolder("C:/DropBox/ProjectABC") abbreviation("BL") +{text} +{pstd}At this point we can collect the baseline data, +save the data in the folders we created and write the report. +Then long stretches of time might pass before we need to use the command. +{p_end} + +{pstd}Let{c 39}s say that when we plan for midline +we also want to collect data about the villages +that the households we interview in baseline live in. +Then we need to create a new master folder for the unit of observation villages. +We do that using {inp:iefolder new unitofobs village}. Like this: +{p_end} + +{input}{space 8}iefolder new unitofobs village , projectfolder("C:/DropBox/ProjectABC") +{text} +{pstd}Then we need to create the rounds used for the midline round +for both households and for villages. +Since this is separate data collection +(although they might happen at the same time). +We create those folders like this: +{p_end} + +{input}{space 8}iefolder new round midline , projectfolder("C:/DropBox/ProjectABC") abbreviation("ML") +{space 8}iefolder new round midlineVillage, projectfolder("C:/DropBox/ProjectABC") abbreviation("MLvill") +{text} +{pstd}Finally, in the last round of data collection, +we are only collecting data on households again. +Since we are not collecting data on any new unit of observation, +we do not need to create any new master folder. +{p_end} + +{input}{space 8}iefolder new round endline , projectfolder("C:/DropBox/ProjectABC") abbreviation("EL") +{text} +{title:Acknowledgements} + +{pstd}This command was initially suggested by Esteban J. Quinones, University of Wisconsin-Madison. +{p_end} + +{pstd}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetical order): +{p_end} + +{pstd}Guadalupe Bedoya +{p_end} + +{pstd}Laura Costica +{p_end} + +{pstd}Mrijan Rimal +{p_end} + +{pstd}Sakina Shibuya +{p_end} + +{pstd}Seungmin Lee +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit iefolder{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iegitaddmd.sthlp b/src/sthlp/iegitaddmd.sthlp new file mode 100644 index 00000000..ee019391 --- /dev/null +++ b/src/sthlp/iegitaddmd.sthlp @@ -0,0 +1,195 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iegitaddmd}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iegitaddmd} - Creates a placeholder file in subfolders of a GitHub repository folder, which allows committing folder structures with empty folders. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Iegitaddmd":DIME Wiki}. +{p_end} + +{title:Syntax} + +{phang}{bf:iegitaddmd} , {bf:folder}({it:full_file_path}) [ {bf:comparefolder}({it:full_file_path}) {bf:customfile}({it:filename}) {bf:all} {bf:skip} {bf:replace} {bf:skipfolders}({it:folder_name}) {bf:{ul:auto}matic} {bf:{ul:dry}run} ] +{p_end} + +{synoptset 29}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:folder}({it:full_file_path})}Specifies the folder path to the project folder clone where placeholder files will be created{p_end} +{synopt: {bf:comparefolder}({it:full_file_path})}Specifies the top folder of a folder tree to be compared with {inp:folder()}{p_end} +{synopt: {bf:customfile}({it:filename})}Specifies a file saved on disk that is used instead of the default file as placeholder{p_end} +{synopt: {bf:all}}Creates the placeholder file in every subfolder of {inp:folder()}, whether empty or not{p_end} +{synopt: {bf:skip}}If option {inp:all} is used and a folder has a file with same name as placeholder file, then nothing is done{p_end} +{synopt: {bf:replace}}If option {inp:all} is used and a folder has a file with same name as placeholder file, then the file is overwritten{p_end} +{synopt: {bf:skipfolders}({it:folder_name})}List of folders to be skipped. The hidden folder {it:.git} is always added to this list, even when option {inp:skip} is not used{p_end} +{synopt: {bf:{ul:auto}matic}}Makes the command create placeholder files without prompting the user for each file{p_end} +{synopt: {bf:{ul:dry}run}}Makes the command list all the files that would have been created without this option{p_end} +{synoptline} + +{title:Description} + +{pstd}Git/GitHub does not {c 34}{it:sync}{c 34} empty folders, or folder that only contain ignored files. +However, it is common in research projects that these types of folders needs to be shared anyways. +{inp:iegitaddmd} provides a solution to this by creating placeholder files in in these folders. +This placeholder file can then be shared to GitHub and that way the folder is also shared. +{inp:iegitaddmd} is developed with two use cases in mind described below. +{p_end} + +{pstd}{inp:Use case 1.} It is common in the beginning of a research project that +a standardized folder structure is set up (for example with {inp:iefolder}) +where some folders that are created are not yet needed. +A common example, is output folders. +If these folders are not shared at the time they are created, +different team members will create them ad-hoc when needed. +That typically leads to them being named differently +which is confusing and could in turn lead to errors. +{inp:iegitaddmd} can solve this by scanning a project folder for all sub-folders +that are completely empty, and create a placeholder file in those folder. +{p_end} + +{pstd}The solution to this use case in {inp:iegitaddmd} is a Stata adaptation of Solution B in +{browse "https://bytefreaks.net/gnulinux/bash/how-to-add-automatically-all-empty-folders-in-git-repository":this post}. +{p_end} + +{pstd}{inp:Use case 2.} The second use case is when an already ongoing project is transferred to Git/GitHub. +Then, many files and folders are copied from wherever +they were stored before (for example DropBox) to a clone of the repository. +Files not meant to be shared on GitHub can (and should) be ignored using the {it:.gitignore} file. +However, this is likely to create empty folders that are not shared on GitHub. +A clone of this repo would then miss those folder but they might be required folders like + output folder or folders for intermediate data. +{inp:iegitaddmd} can solve this by scanning the project folder in the old location +and for each sub-folder that exist in the old location but not in the clone +create that folder and put a place holder file in it. +In this use case the option {inp:comparefolder()} is used to indicate that +the clone should be compared to another folder. +{p_end} + +{pstd}The default placeholder file used is named {inp:README.md} and its content explains that it is a placeholder file. +That file name is a special name on GitHub, +and whenever one navigate to a folder on GitHub.com with a {inp:README.md} file, +the content of that file is displayed on that web page. +The placeholder file may be removed as soon as files have been added to the folder. +Or perhaps even better is to keep the file, but edit the content of it such that +it documents the content of that folder for all other team members. +{p_end} + +{title:Options} + +{pstd}{bf:folder}({it:full_file_path}) is the folder path to the project folder clone where the placeholder files will be created. +{p_end} + +{pstd}{bf:comparefolder}({it:full_file_path}) is used to compare a file tree in a different location +and create folders with placeholder files in all folders that exist in +{inp:comparefolder()} but not in {inp:folder()}. +If a folder that does no exist in {inp:folder()} has a subfolder, +then both the folder and the subfolder will be created, + but the placeholder file is only crated in the sub-folder. + This is sufficient for sharing both the folder and the subfolder in GitHub. + If the {inp:comparefolder()} and {inp:folder()} ends with folders with different names, + for example {inp:folder(/datawork/baseline)} and {inp:comparefolder(/datawork)}, + then the command will throw an error as it is likely that + the paths do not point to corresponding folders in the two folder trees. +{p_end} + +{pstd}{bf:customfile}({it:filename}) allows the user to specify a file saved on the computer +to be used as the placeholder file instead of the default {inp:README.md} file. +This allows anyone to write their own template placeholder files according to their own preferences. +We recommend that a file of type .md (markdown) +and name README.md is used such that the content is displayed when someone navigate to that folder on GitHub.com. +But this is not a technical requirement, any file type and name can be used as placeholder file. +{p_end} + +{pstd}{bf:all} creates the placeholder file in {inp:folder()} and in every subfolder, regardless if they are empty or not. +This allows the user to create a placeholder file in every folder that can be +edited with documentation and instructions to the purpose and usage of each subfolder. +This option can also be important when {it:.gitignore} is used, +as {inp:iegitaddmd} will not create files to subfolders that +only has ignored file -- in which case the folder will not be synced by GitHub. +{p_end} + +{pstd}{bf:skip} and {bf:replace} tells {inp:iegitaddmd} what to do if the option {inp:all} is used +and if any of the folders contain a file with the exact same name as the file the command is trying to create. +If a file with the same name as the placeholder file exist and neither of these options are used, +then the command will throw an error. +If {inp:skip} is used, then nothing is done in the folder where the file with the same name exists +and the command proceeds to the next folder. +If {inp:replace} is used then the file with the same name is overwritten with +the new placeholder file before the command proceeds to the next folder. +{p_end} + +{pstd}{bf:skipfolders}({it:folder_names}) is used to list folders in which a placeholder file should never be created. +You should not list the full folder path in this option, just the folder name. +All folders with that name will be skipped regardless of their location in the project folder. +Any sub-folder of these folders will also be skipped. +A folder name may be listed with or without quotation marks as long as there are no spaces in the names. +If any of the folder names has spaces, then quotation marks must be used for all folder names. +{p_end} + +{pstd}{bf:{ul:auto}matic} can be used to speed up the creation of placeholders by +telling the command to not prompt the users for confirmation for each file before it is created. +The default is that the command is asking the user before creating each place holder file. +This option should only be used when you are confident you have specified the correct folder paths. +We recommend that you use the {inp:dryrun} with this option to make sure that the folder paths are correct. +{p_end} + +{pstd}{bf:{ul:dry}run} can be used to safely test that the folder paths are +specified correctly before any placeholder files are created. +When this option it used the command simply lists the file +that would have been created if this option were not used. +Once you are confident that list is correct, +you can remove this option and re-run the command and the files will be created. +{p_end} + +{title:Stored results} + +{title:Examples} + +{dlgtab:Example 1} + +{pstd}In this example, there is a GitHub repository in the folder {it:ProjectA}. +This repository has a folder structure where +some folders are still empty but will later be populated with files. +In order to have all folders, even the empty ones, +synced on all collaborators{c 39} cloned local copies of the repository, +the folders need to contain at least one file, +which is being created by the command. +{p_end} + +{input}{space 8}global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectA" +{space 8}iegitaddmd , folder("$github_folder") +{text} +{dlgtab:Example 2} + +{pstd}In this example, there is a GitHub repository in the folder {it:ProjectB}. +This is a project similar to {it:ProjectA} above but it has two folders, +called foo and bar in which no placeholder files should ever be created in. +Any subfolders in foo or bar will be skipped as well. +The folder {it:.git} is a system folder in git repositories and will always be skipped. +{p_end} + +{input}{space 8}global github_folder "C:/Users/JohnSmith/Documents/GitHub/ProjectB" +{space 8}iegitaddmd , folder("$github_folder") skipfolders("foo" "bar") +{text} +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit iegitaddmd{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iegraph.sthlp b/src/sthlp/iegraph.sthlp new file mode 100644 index 00000000..eb025137 --- /dev/null +++ b/src/sthlp/iegraph.sthlp @@ -0,0 +1,278 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iegraph}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iegraph} - Generates graphs based on regressions with treatment dummies common in impact evaluations. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Ietoolkit":DIME Wiki}. +{p_end} + +{title:Syntax} + +{phang}{bf:iegraph} , {it:varlist} , [ {bf:{ul:basicti}tle}({it:string}) {bf:{ul:varl}abels} {bf:save}({it:string}) {bf:{ul:gray}scale} {bf:yzero} {bf:{ul:barl}abel} {bf:{ul:mlabc}olor}({it:colorname}) {bf:{ul:mlabp}osition}({it:clockpos}) {bf:{ul:mlabs}ize}({it:size}) {bf:barlabelformat} {bf:noconfbars} {bf:confbarsnone}({it:varlist}) {bf:confintval}({it:numlist}) {bf:norestore} {bf:{ul:baropt}ions}({it:string}) {bf:ignoredummytest} {it:twoway_scatter_options} ] +{p_end} + +{synoptset 27}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:basicti}tle}({it:string})}Manually sets the title of the graph{p_end} +{synopt: {bf:{ul:varl}abels}}Uses variable labels for legends instead of variable names{p_end} +{synopt: {bf:save}({it:string})}Sets the filename and the directory to which the graph will be set/exported{p_end} +{synopt: {bf:{ul:gray}scale}}Uses grayscales for the bars instead of colors{p_end} +{synopt: {bf:yzero}}Forces y-axis on the graph to start at 0{p_end} +{synopt: {bf:{ul:barl}abel}}Adds a label on top of the bars with their respective values{p_end} +{synopt: {bf:{ul:mlabc}olor}({it:colorname})}Manually set the colors of the bars{p_end} +{synopt: {bf:{ul:mlabp}osition}({it:clockposstyle})}Set color of bar label{p_end} +{synopt: {bf:{ul:mlabs}ize}({it:size})}Set position of bar label{p_end} +{synopt: {bf:barlabelformat}}Set font size of bar label{p_end} +{synopt: {bf:noconfbars}}Customizes format of bar label. Must be used with {inp:barlabel}{p_end} +{synopt: {bf:confbarsnone}({it:varlist})}Removes the confidence interval bars from graphs for all treatments{p_end} +{synopt: {bf:confintval}({it:numlist})}Sets the confidence interval for the confidence interval bars. Default is .95{p_end} +{synopt: {bf:norestore}}Allows you to debug your two way graph settings on the data set prepared by iegraph. To be used with {inp:r(cmd)}{p_end} +{synopt: {bf:{ul:baropt}ions}({it:string})}Allows you to add formatting to the bars{p_end} +{synopt: {bf:ignoredummytest}}Ignores the tests that tests if the dummies fits one of the two models below{p_end} +{synoptline} + +{phang}Any {it:twoway graph scatter} options that can be used with +regular {it:twoway graph scatter} commands can also be used. +If any of these commands conflict with any of the built in options, +then the user specified settings have precedence. +See example 2 for details. +{p_end} + +{title:Description} + +{pstd}{inp:iegraph} is a command creates bar graphs based on +coefficients of treatment dummies in regression results. +This command is developed for reading stored results from +two types of common impact evaluation regression models, +but there are countless of other examples where the command also can be used. +{inp:iegraph} must be used immediately after running the regression +or after the regression result is restored using Stata{c 39}s {it:ereturn results}. +{p_end} + +{dlgtab:Model 1: OLS with Treatment Dummies} +{pstd}The most typical impact evaluation regression is to have the outcome variable +as the dependent variable and one dummy for each treatment arm +where control is the omitted category. +These regressions can also include covariates, fixed effects etc., +but as long as the treatment status is defined by mutually exclusive dummy variables. +See especially examples 1 and 2 below. +This command works with any number of treatment arms +but works best from two arms (treatment and control) +to five treatment arms (4 different treatments and control). +More arms than that may result in a still correct but perhaps cluttered graph. +{p_end} + +{dlgtab:Model 2: Difference-in-Differences} +{pstd}Another typical regression model in impact evaluations +are difference-in-difference (Diff-in-Diff) +models with two treatment arms (treatment and control) and two time periods. +If the Diff-in-Diff regression is specified as having the outcome variable +as the dependent variable and three dummy variables (time, treatment and time*treatment) +as the independent variables, +then this command will produce a nice graph. +Controls, treatment effects etc. may be added to the regression model. +See especially example 3. +{p_end} + +{dlgtab:Graph Output} +{pstd}The graph generated by this command is created using the following values. +The control bar is the mean of the outcome variable for the control group. +It is not the constant from the regression as those are not identical if, +for example, fixed effects and covariates were used. +For each treatment group the bar is the sum of the value of the control bar +and the beta coefficient in the regression of the corresponding treatment dummy. +The confidence intervals are calculated from the variance in +the beta coefficients in the regression. +{p_end} + +{pstd}The graph also includes the N for each treatment arm in the regression +and uses that value as labels on the x-axis. +Stars are added to this value if the corresponding +coefficient is statistically different from zero in the regression +{p_end} + +{title:Options} + +{pstd}{bf:{ul:basicti}tle}({it:string}) manually sets the title of the graph. +To apply formatting like title size, position, etc., +use Stata{c 39}s built in {inp:title()} option instead. +{p_end} + +{pstd} {bf:{ul:varl}abels} sets the legends to the variable labels for the variables + instead of the variable names. +{p_end} + +{pstd} {bf:save}({it:string}) sets the legends to the variable labels + for the variables instead of the variable names. +{p_end} + +{pstd} {bf:{ul:gray}scale} uses grayscale for the bars instead of colors. + The color of the control bar will be black and the treatment bar will + run in equal shade differences from light grey to dark grey. +{p_end} + +{pstd} {bf:yzero} manually sets the y-axis of the graph to start at zero instead of the Stata default. + In many cases, we expect that neither + the default settings nor this option will make the axes look perfect, + but you may use Stata{c 39}s built in axis options + that allow you to set the axes to perfectly fit your data. + The command will ignore the {inp:yzero} option in cases where the graph cannot + be forced to zero i.e. where the values in the graph extend beyond zero, + both positively or negatively. + A warning will be displayed telling the user that the option has been ignored. + Despite the warning, the graph will be produced correctly. +{p_end} + +{pstd} {bf:{ul:barl}abel} adds a label on top of the bars with their respective values. + Equivalent to specifying option {inp:blabel(bar)} in a {it:bar graph} (see {inp:help graph_bar}). +{p_end} + +{pstd} {bf:{ul:mlabc}olor}({it:colorname}) sets color of bar label. + May only be used with the {inp:barlabel} option. + See {inp:help colorname} for valid values. +{p_end} + +{pstd} {bf:{ul:mlabp}osition}({it:clockpos}) sets position of bar label. + May only be used with the {inp:barlabel} option. + See {inp:help clockposstyle} for valid values. +{p_end} + +{pstd} {bf:{ul:mlabs}ize}({it:size}) sets size of bar label. + May only be used with the {inp:barlabel} option. + See {inp:help textsizestyle} for valid values. +{p_end} + +{pstd} {bf:barlabelformat} customizes {inp:barlabel} format. + May only be used with the {inp:barlabel} option. + Options allowed have the formats {it:%#.#f} or {it:%#.#e}. + Default if {it:%9.1f}. See {inp:help format} for valid formats. +{p_end} + +{pstd} {bf:noconfbars} removes the confidence interval bars from graphs for all treatments. + The default value for the confidence interval bars is 95%. +{p_end} + +{pstd} {bf:confbarsnone}({it:varlist}) removes confidence interval bars + from only the {it:varlist} listed. + The remaining variables in the graphs which have not been specified + in option {inp:confbarsnone} will still have the confidence interval bars. +{p_end} + +{pstd} {bf:confintval}({it:numlist}) sets the confidence interval for the confidence interval bars. + Default is .95. Values between 0 and 1 are allowed. +{p_end} + +{pstd} {bf:norestore} returns the data set that {inp:iegraph} prepares to create the graph. + This is helpful when de-bugging how one of Stata{c 39}s many graph options + can be applied to an {inp:iegraph} graph. + This option is meant to be used in combination with + the returned result in {inp:r(cmd)}. + {inp:r(cmd)} gives you the line of code {inp:iegraph} prepares to create the graph + and {inp:norestore} gives you access to the data that code is meant to be used on. + This approach will help you de-bug how to apply + Stata{c 39}s built in graph options to an {inp:iegraph} graph. + Note that this option deletes any unsaved changes made to your data in memory. +{p_end} + +{pstd} {bf:{ul:baropt}ions}({it:string}) allows you to add formatting options + that are applied to each bar and not the graph itself. + Example of such option are {it:twoway_bar} options and {it:axis_options} options. + It is not possible to use this option to add formatting to individual bars. + Everything added in this option is added to all bars. + Formatting added in this option takes precedence over + any default formatting or formatting set in any other option. +{p_end} + +{pstd} {bf:ignoredummytest} ignores the tests that test if the dummies + fits one of the two models this command is intended for. + The two models are described in detail above. + There might be models we have not thought of for which this command is helpful as well. + Use this option to lift the restrictions of those two models. + But be careful, this command has not been tested for other models than the two described. +{p_end} + +{title:Stored results} + +{title:Examples} + +{dlgtab:Example 1} + +{input}{space 8}regress outcomevar treatment_dummy +{space 8}iegraph treatment_dummy , basictitle("Treatment Effect on Outcome") +{text} +{pstd}In the example above, there are only two treatment arms (treatment and control). +{it:treatment_dummy} has a 1 for all treatment observations and a 0 for all control observations. +The graph will have one bar for control and it shows +the mean for {it:outcomevar} for all observations in control. +The second bar in the graph will be the sum of that mean +and the coefficient for {it:treatment_dummy} in the regression. +The graph will also have the title: {it:Treatment Effect on Outcome}. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8}regress income tmt_1 tmt_2 age education, cluster(district) +{space 8}iegraph tmt_1 tmt_2, noconfbars yzero basictitle("Treatment effect on income") +{text} +{pstd}In the example above, the treatment effect on income in researched. +There are three treatment arms; control, treatment 1 ({it:tmt_1}) and treatment 2 ({it:tmt_2}). +It is important that no observation has the value 1 in both {it:tmt_1} and {it:tmt_2_ +(i.e. no observation is in more than one treatment) +and some observations must have the value 0 in both {it:tmt_1} and {it:tmt_2_ +(i.e. control observations). +The variables age and education are covariates (control variables) +and are not included in {inp:iegraph}. +The option {inp:noconfbars} omits the confidence interval bars, +and {inp:yzero} sets the y-axis to start at 0. +{p_end} + +{dlgtab:Example 3} + +{input}{space 8}regress chld_wght time treat timeXtreat +{space 8}iegraph time treat timeXtreat , basictitle("Treatment effect on Child Weight (Diff-in-Diff)") +{text} +{pstd}In the example above, the data set is a panel data set +with two time periods and the regression estimates the treatment effect +on child weight using a {it:Difference-in-Differences} model. +The dummy variable time indicates if it is time period 0 or 1. +The dummy variable treat indicates if the observation is treatment or control. +{it:timeXtreat} is the interaction term of time and treat. +This the standard way to set up a {it:Difference-in-Differences} regression model. +{p_end} + +{dlgtab:Example 4} + +{input}{space 8}regress harvest T1 T2 T3 +{space 8}iegraph T1 T2 T3 , basictitle("Treatment effect on harvest") xlabel(,angle(45)) yzero ylabel(minmax) save("Graph1.gph")} +{text} +{pstd}The example above shows how to save a graph to disk. +It also shows that most two-way graph options can be used. +In this example, +the {inp:iegraph} option {inp:yzero} conflicts with the two-way option {inp:ylabel(minmax)}. +In such a case the user specified option takes precedence over {inp:iegraph} options like {inp:yzero}. +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications +writing {c 34}ietoolkit iegraph{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main authors: Kristoffer Bjarkefur, Luiza Cardoso De Andrade, DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iekdensity.sthlp b/src/sthlp/iekdensity.sthlp new file mode 100644 index 00000000..60e82a08 --- /dev/null +++ b/src/sthlp/iekdensity.sthlp @@ -0,0 +1,210 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iekdensity}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iekdensity} - This command plots univariate kernel density estimates by treatment assignment. +{p_end} + +{title:Syntax} + +{phang}{bf:iekdensity} {it:yvar} [if] [in] [weight] , {bf:by}({it:treatmentvar}) + [ {bf:stat}({it:string}) {bf:statstyle}({it:string}) {bf:effect} {bf:control}({it:numlist}) {bf:effectformat}({it:%fmt}) {bf:{ul:abs}orb}({it:varname}) {bf:{ul:reg}ressionoptions}({it:string}) {bf:{ul:kdensity}options}({it:string}) {bf:color}({it:string}) + {it:twoway_options} ] +{p_end} + +{phang}Where {it:yvar} is a numeric continuous outcome variable, whose distribution is to be plotted by treatment assignment. +{p_end} + +{synoptset 16}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:by}({it:treatmentvar})}Treatment (dummy or factor) variable.{p_end} +{synoptline} + +{dlgtab:Content options:} + +{synoptset 18}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:stat}({it:string})}Add vertical lines for each treatment group with statistic specified.{p_end} +{synopt: {bf:statstyle}({it:string})}Specify graphic style of statistic lines.{p_end} +{synopt: {bf:effect}}Add note with treatment effect, containing point estimate, standard error, and p-value.{p_end} +{synopt: {bf:control}({it:numlist})}Specify value of variable for control group.{p_end} +{synopt: {bf:effectformat}({it:%fmt})}Specify format of point estimate and standard error of the treatment effect.{p_end} +{synoptline} + +{dlgtab:Estimation options:} +{synoptset 25}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:abs}orb}({it:varname})}Specify fixed effects variable, if any.{p_end} +{synopt: {bf:{ul:reg}ressionoptions}({it:string})}Specify regression options.{p_end} +{synopt: {bf:{ul:kdensity}options}({it:string})}Specify kernel estimation options.{p_end} +{synoptline} + +{dlgtab:Graphic options:} +{synoptset 14}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:color}({it:string})}Specify colors for each group.{p_end} +{synopt: {it:twoway_options}}Specify graph options.{p_end} +{synoptline} + +{title:Description} + +{pstd}{bf:iekdensity} is a command that allows to easily plot the distribution of a variable by treatment group. It also allows to include additional information, such as descriptive statistics and treatment effect(s). +{p_end} + +{title:Options} + +{dlgtab:Required options:} + +{pstd}{bf:by}(treatmentvar) indicates which variable should be used to idenfity the treatment assignment. This can be a dummy variable (0/1) or a factor variable, when there are multiple treatments. +{p_end} + +{dlgtab:Content options} + +{pstd}{bf:stat}({it:string}) specifies a descriptive statitistic to be plotted over the kernel density graph. In particular, vertical lines for each treatment group are added. Accepted statistics are: {it:mean, p1, p5, p50, p75, p90, p95, p99, min} and {it:max}. +{p_end} + +{pstd}{bf:statstyle}({it:string}) specifies the graphic style to be used for the statistic lines. Namely, you will be able to use {bf:lpattern}(linepatternstyle) and {bf:lwidth}(linewidthstyle) opt ad controlled by option {bf:color}({it:string}). +{p_end} + +{pstd}{bf:effect} adds a note with treatment effect, containing point estimate, standard error, and p-value, to the graph. +{p_end} + +{pstd}{bf:control}({it:numlist}) indicates which value the variable {bf:by}({it:treatmentvar}) takes for the control group. This is usually equal to 0 when the treatment is binary, but may vary when dealing wi arms. +{p_end} + +{pstd}{bf:effectformat}({it:%fmt}) specify the format in which treatment effect point estimate and standard error should be displayed in the graph note. +{p_end} + +{dlgtab:Estimation options:} + +{pstd}{bf:{ul:abs}orb}({it:varname}) indicates the fixed effects variable (for example, the experimental strata when the treatment was stratified) to be included in the estimation. This variable must be numerical. +{p_end} + +{pstd}{bf:{ul:reg}ressionoptions}({it:string}) indicates other options to be employed for the treatment effect estimations, for example suppress constant term ({bf:{ul:nocons}tant}) or clustered standard errors ({bf:{ul:cl}uster}({it:varname})). Al regress (or areg when option {bf:absorb()} is specified) are accepted. +{p_end} + +{pstd}{bf:{ul:kdensity}options}({it:string}) specifies kernel estimation options, such as kernel function and half-width of kernel. The default kernel function is {bf:kernel}({it:epanechnikov}). Many options accepted by kdensity are : {bf:kernel}({it:kernel}), {bf:bwidth}({it:#}), {bf:n}({it:#}), and all the {it:cline_options} (see {inp:help cline_options}) for univariate kernel density estimation. +{p_end} + +{dlgtab:Graphic options:} + +{pstd}{bf:color}({it:string}) indicates the colors to be used for each treatment arm. The colors should come in the order of the values in {bf:by}({it:treatmentvar}). For instance, if the treatment is binary, you can set the line colors (color1 color2). See {it:colorstyle} ({inp:help colorstyle}). +{p_end} + +{pstd}{it:twoway_options} indicates other options to be applied to the graph, such as additional text and lines, changes axes, titles, and legend, etc. (See {inp:help twoway_options}) +{p_end} + +{title:Examples} +{pstd}All the examples below can be run on the Stata{c 39}s built in automobile data set, by first running this code: +{p_end} + +{pstd}* Open the built in data set +{p_end} + +{input}{space 8}sysuse auto +{text} +{pstd}* Randomly assign time and treatment dummies +{p_end} + +{input}{space 8}gen treatment = (runiform() < .5) +{text} +{dlgtab:Example 1} + +{input}{space 8}iekdensity auto , by(treatment) +{text} +{pstd}This is the most basic way to run this command. This will output a graph with the distributions of of the variable of interests (price in this case) by treatment assignment. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8}iekdensity auto , by((treatment) stat(p50) +{text} +{pstd}This is an easy way to add descriptive information to the graph. This will output the same graph as above with the addition of two vertical lines for the medians of the control and treatment groups. +{p_end} + +{dlgtab:Example 2.1} + +{input}{space 8}iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) +{text} +{pstd}This changes the style of the median vertical lines. +{p_end} + +{dlgtab:Example 2.2} + +{input}{space 8}iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) color(eltblue edkblue) +{text} +{pstd}This sets the colors of the control and treatment lines to different shades of blue. +{p_end} + +{dlgtab:Example 2.3} + +{input}{space 8}iekdensity auto , by(treatment) stat(p50) statstyle(lpattern(dash) lwithd(2)) title(auto distribution) subtitle(By Treatment Assignment) +{space 8}graphregion(color(white)) plotregion(color(white)) +{text} +{pstd}This changes some of the graphical options. +{p_end} + +{dlgtab:Example 3} + +{input}{space 8}iekdensity auto , by(treatment) stat(p50) effect +{text} +{pstd}This adds a note to the graph, displaying the treatment effect in terms of point estimate, standard error and statistical significance. +{p_end} + +{dlgtab:Example 3.1} + +{input}{space 8}iekdensity auto , by(treatment) stat(p50) effect effectformat(%9.0fc) +{text} +{pstd}This changes the format of the treatment effect in the note. The point estimate and the standard error now do not include any decimal points. +{p_end} + +{dlgtab:Example 4} + +{input}{space 8}iekdensity auto , by(treatment) effect absorb(foreign) +{text} +{pstd}The treatment effect is now derived from a regression controlling for the variable {it:foreign} fixed effects. +{p_end} + +{dlgtab:Example 4.1} + +{input}{space 8}iekdensity auto , by(treatment) effect absorb(foreign) regressionoptions(cluster(foreign)) +{text} +{pstd}The treatment effect is now derived from a regression controlling for the variable foreign fixed effects and clustering standard errors at {it:foreign} level. +{p_end} + +{dlgtab:Example 5} + +{input}{space 8}iekdensity auto , by(treatment) kdensityoptions(epan2 bwidth(5)) +{text} +{pstd}The kernel density is estimated through the alternative Epanechnikov kernel function and half-width of the kernel is specified to be equal to 5. +{p_end} + +{title:Acknowledgements} + +{pstd}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order): +Luiza Andrade +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications writing {c 34}ietoolkit iekdensity{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Authors} + +{pstd}All commands in {inp:ietoolkit} are developed by DIME Analytics at DIME, The World Bank{c 39}s department for Development Impact Evaluations. +{p_end} + +{pstd}Main author: Matteo Ruzzante, DIME, The World Bank Group. +{p_end} diff --git a/src/sthlp/iematch.sthlp b/src/sthlp/iematch.sthlp new file mode 100644 index 00000000..bb1b145d --- /dev/null +++ b/src/sthlp/iematch.sthlp @@ -0,0 +1,181 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iematch}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iematch} - Matching base observations towards target observations using on a single continous variable. +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Iematch":DIME Wiki}. +{p_end} + +{title:Syntax} + +{phang}{bf:iematch} [if] [in] , {bf:{ul:grp}dummy}({it:varname}) {bf:{ul:match}var}({it:varname}) [ {bf:{ul:id}var}({it:varname}) {bf:m1} {bf:maxdiff}({it:numlist}) {bf:maxmatch}({it:integer}) {bf:seedok} {bf:{ul:matchid}name}({it:string}) {bf:{ul:matchdi}ffname}({it:string}) {bf:{ul:matchre}sultname}({it:string}) {bf:{ul:matchco}untname}({it:string}) {bf:replace} ] +{p_end} + +{synoptset 23}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:grp}dummy}({it:varname})}The group dummy variable where 1 indicates base observations and 0 target observations{p_end} +{synopt: {bf:{ul:match}var}({it:varname})}The variable with a continous value to match on{p_end} +{synopt: {bf:{ul:id}var}({it:varname})}The uniquely and fully identifying ID variable. Used to indicate which target observation a base observation is match with. If omitted an ID variable will be created. See below if you have multiple ID vars.{p_end} +{synopt: {bf:maxdiff}({it:numlist})}Set a maximum difference allowed in {bf:matchvar()}. If a base observation has no match within this difference then it will remain unmatched{p_end} +{synopt: {bf:m1}}Allows many-to-one matches. The default is to allow only one-to-one matches. See the description section.{p_end} +{synopt: {bf:maxmatch}({it:integer})}Sets the maximum number of base observations that each target observation is allowed to match with in a {bf:m1} (many-to-one) match.{p_end} +{synopt: {bf:seedok}}Supresses the error message thrown when there are duplicates in {bf:matchvar()}. When there are duplicates, the seed needs to be set in order to have a replicable match. The {bf:seed} (see {inp:help set seed}) should be set before this command.{p_end} +{synopt: {bf:{ul:matchre}sultname}({it:string})}Manually sets the name of the variable that indicates if an observation was matched, or provide a reason why it was not. The default is {it:matchResult{p_end} +{synopt: {bf:{ul:matchid}name}({it:string})}Manually sets the name of the variable that indicates which target observation each base observation is matched with. The default is {it:matchID{p_end} +{synopt: {bf:{ul:matchdi}ffname}({it:string})}Manually sets the name of the variable that indicates the differnece in {bf:matchvar()} in each match pair/group. The default is {it:matchDiff{p_end} +{synopt: {bf:{ul:matchco}untname}({it:string})}Manually sets the name of the variable that indicates how many observations a target observation is matched with in a many-to-one matches. The default is {it:matchCount{p_end} +{synopt: {bf:replace}}Replaces variables in memory if there are name conflicts when generating the output variables.{p_end} +{synoptline} + +{title:Description} + +{pstd}{bf:iematch} matches base observations towards target observations in terms of nearest value in {bf:matchvar()}. Base observations are observations with value 1 in {bf:grpdummy()} and target observations are observations with value 0. For example, in a typical p-score match, base observations are treatment and target is control, however, there are many other examples of matching where it could be different. +{p_end} + +{pstd}{bf:iematch} bases its matching algorithm on the Stable Marriage algorithm. This algorithm was chosen because it always provides a solution and allows stable matching even if multiple observations have identical match values (see {bf:seed()} option for more details). One disadvantage of this algorithm is that it takes into account local efficiency only, and not global efficiency. This means that it is possible that other matching algorithms might generate a more efficient match in terms of the sum of the difference of all matched pairs/groups. +{p_end} + +{dlgtab:One-to-one matching algorithm} + +{pstd}The algorithm used in a one-to-one match starts by evaluating which target observation each base observation is closest to and vice versa for each target observations. If a base and target observation pair mutually prefer each other, then these two observations are matched. The algorithm then repeats the initial two evaluation steps, and excludes observations after they are matched, until all base observations are either matched or excluded due to the option {bf:maxdiff()}. Matched observations ends up in pairs of exactly one base observation and one target observation. +{p_end} + +{pstd}In a one-to-one match, there has to be at least as many target observations as there are base observations. A one-to-one match returns three variables. One variable indicates the result of the matching for each observation, such as, matched, not matched, no match within the max difference, etc. The other two variables hold information on the matched pair. One variable is the ID of the target observation in the matched pair, and the other variable is the difference in {bf:matchvar()} between the two observations in the match pair. See the below in this section for more details on the variables generated. +{p_end} + +{dlgtab:Many-to-one matching algorithm} + +{pstd}The algorithm used for many-to-one matching is the same as in a one-to-one match. But instead of matching only when there is a mutual preference, all base observations are matched towards their preferred target observation in the first step, as long as the match is within the max-value if {bf:maxdff()} is used. Matched observations end up in groups in which there is exactly one target observation but where there are either one or several base observations. +{p_end} + +{pstd}In a many-to-one match, there is no restriction in terms of the number of base observations in relation to target observations. The many-to-one matching yields four variables. Three of the variables are the same as in one-to-one matching, and only the variable listing the difference The fourth variable indicates how many base observations that were matched towards each target observation. See the below in this section for more details on the variables generated. +{p_end} + +{dlgtab:Variables generated} + +{pstd}This section explains the variables that are generated by this command. All variables will be referred to by their default names, but those names can be manually set to something else (see the options for this command). +{p_end} + +{pstd}{inp:_matchResult}: This variable indicates the result of the match for all observations. Observations that ended up in a match pair/group has the value 1. Target observations not matched have the value 0. Base observations without a valid match due to {bf:maxdff()} are assigned the value .d. Observations excluded from the match using if/in are assigned the value .i. Observations excluded from the match due to missing value in {bf:grpdummy()} are assigned the value .g. Observations excluded from the match due to missing value in {bf:matchvar()} are assigned the value .m. All values have descriptive value labels. +{p_end} + +{pstd}{inp:_matchID}: This variable indicates the ID of the target observations in each match pair/group. For matched target observations, the value in {it:matchID will be +equal to the value in the ID variable. Since the values in the ID variable are unique and there is exactly one target observation in each matched +pair/group, this variable functions as a unique pair/group ID. In addition to indicating which observations are included in the same pair/group, +this variable can be used to include a pair/group fixed effect in a regression. +{p_end} + +{pstd}{inp:_matchDiff}: This variable indicates the difference in {bf:matchvar()} between matched base observations and target observations. In a one-to-one match this value is the identical for both the base observation and the target observation in each matched pair. In a many-to-one match, this value is only indicated for base observations. It is missing for target observations as there are potentially multiple matches, and subsequently multiple differences. +{p_end} + +{pstd}{inp:_matchCount}: In a many-to-one match, this variable indicates how many base observations were matched towards each matched target observation. This variable can be used as regression weights when controlling for the fact that some observations are matched towards multiple observations. +{p_end} + +{title:Options} + +{pstd}{bf:{ul:grp}dummy}({it:varname}) is used for xyz. Longer description (paragraph length) of all options, their intended use case and best practices related to them. +{p_end} + +{pstd}{bf:{ul:matc}hvar}({it:varname}) is the variable used to compare observations when matching. This must be a numeric variable, and it is typically a continuous variable. Observations with a missing value will be excluded from the matching. +{p_end} + +{pstd}{bf:{ul:id}var}({it:varname}) indicates the variable that uniquely and fully identifies the data set. The values in this variable is the values that will be used in the variable that indicates which target observation each base observations matched against. If this option is omitted, a variable called {it:ID will be generated. The observation in the first row is given the value 1, the second row value 2 and so fourth. +{p_end} + +{pstd}This command assumes only one ID variable as that is the best practice this command follows (see next paragraph for the exception of panel data sets). Here follows two suggested solutions if a data set this command will be used on has more than one ID variable. 1. Do not use the idvar() option and after the matching copy the multiple ID variables yourself. 2. Combine your ID variables into one ID variable. Here are two examples on how that can be done (the examples below work just as well when combining more than two ID variables to one.): +{p_end} + +{input}{space 8}egen new_ID_var = group(old_ID_var1 old_ID_var2) +{space 8} +{space 8}gen new_ID_var = old_ID_var1 + "_" + old_ID_var2 //Works only with string vars +{space 8} +{text} +{pstd}Panel data sets are one of the few cases where multiple ID variables is good practice. However, in the case of matching it is unlikely that it is correct to include multiple time rounds for the same observation. That would lead to some base observations being matched to one target observation in the first round, and one another in the second. In impact evaluations, matchings are almost exclusively done only on the baseline data. +{p_end} + +{pstd}{bf:maxdiff}({it:numlist}) sets a maximum allowed difference between a base observation and a target observation for a match to be valid. Any base observation without a valid match within this difference will end up unmatched. +{p_end} + +{pstd}{bf:m1} sets the match to a many-to-one match (see description). This allows multiple base observations to be matched towards a single target observation. The default is the one-to-one match where a maximum one base observation is matched towards each target observation. This option allows the number of base observations to be larger than the number of target observations. +{p_end} + +{pstd}{bf:maxmatch}({it:integer}) sets the maximum number of base observations a target observation is allowed to match with in a {bf:m1} (many-to-one) match. The integer in {bf:maxmatch()} is the maximum number of base observations in group but there is also a always a target observation in the group, so in a maxed out match group it will be {bf:maxmatch()} plus one observations. +{p_end} + +{pstd}{bf:seedok} supresses the error message thrown when there are duplicates among the base observations or the target observations in {bf:matchvar()}. When there are duplicates a random variable is used to distinguish which variable to match. Setting the seed makes this randomization replicable and thereby making the matching also replicable. The seed (see {inp:help set seed}) should be set before this command by the user. When the seed is set, or if replicable matching is not important, then the option {bf:seedok} can be used to suppress the error message. Duplicate pairs where one observation is a base observation and the other is a target observations are allowed. +{p_end} + +{pstd}{bf:{ul:matchre}sultname}({it:string}) manually sets the name of the variable that reports the matching result for each observation. If omitted, the default name is {inp:_matchResult}. The names {inp:_ID}, {inp:_matchID}, {inp:_matchDiff} and {inp:_matchCount} are not allowed. +{p_end} + +{pstd}{bf:{ul:matchid}name}({it:string}) manually sets the name of the variable that list the ID of the target observations in each match pair/group. If omitted, the default name is {inp:_matchID}. The names {inp:_ID}, {inp:_matchDiff}, {inp:_matchResult} and {inp:_matchCount} are not allowed. +{p_end} + +{pstd}{bf:{ul:matchdi}ffname}({it:string}) manually sets the name of the variable that indicates the difference between the matched base observations and target observations. If omitted, the default name is {inp:_matchDiff}. The names {inp:_ID}, {inp:_matchID}, {inp:_matchResult} and {inp:_matchCount} are not allowed. +{p_end} + +{pstd}{bf:{ul:matchco}untname}({it:string}) manually sets the name of the variable that indicates the number of base observations that has been matched towards each matched matched target observation. This option may only be used in combination with option m1. If omitted, the default name is {inp:_matchCount}. The names {inp:_ID}, {inp:_matchID}, {inp:_matchDiff} and {inp:_matchResult} are not allowed. +{p_end} + +{pstd}{bf:replace} allows {bf:iematch} to replace variables in memory when encountering name conflicts while creating the variables with the results of the matching. +{p_end} + +{title:Examples} + +{dlgtab:Example 1} + +{input}{space 8}iematch , grpdummy(tmt) matchvar(p_hat) +{text} +{pstd}In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p{it:hat, observations with value 0 in tmt. +{p_end} + +{dlgtab:Example 2} + +{input}{space 8} iematch if baseline == 1 , grpdummy(tmt) matchvar(p_hat) maxdiff(.001) +{text} +{pstd}In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p{it:hat, observations with value 0 in tmt as long as the difference in p_hat is less than .001. Only observations that has the value 1 in variable baseline will be included in the match. +{p_end} + +{dlgtab:Example 3} + +{input}{space 8} iematch , grpdummy(tmt) m1 maxmatch(5) matchvar(p_hat) maxdiff(.001) +{text} +{pstd}In the example above, the observations with value 1 in tmt will be matched towards the nearest, in terms of p{it:hat, observations with value 0 in tmt as long as the difference in p_hat is less than .001. So far this example is identical to example 2. However, in this example each target observation is allowed to match with up to 5 base observations. Hence, instead of a result with only pairs of exactly one target observation and one base observation in each pair, the result is instead match groups with one target observation and up to 5 base observations. If {bf:maxmatch()} is omitted any number of base observations may match with each target observation. +{p_end} + +{title:Acknowledgements} + +{pstd}I would like to acknowledge the help in testing and proofreading I received in relation to this command and help file from (in alphabetic order): +{p_end} + +{pstd}Luiza Cardoso De Andrade +{p_end} + +{pstd}Seungmin Lee +{p_end} + +{pstd}Mrijan Rimal +{p_end} + +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications writing {c 34}ietoolkit iematch{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Authors} + +{pstd}All commands in ietoolkit is developed by DIME Analytics at DIME, The World Bank{c 39}s unit for Development Impact Evaluations. +{p_end} + +{pstd}Main author: Kristoffer Bjarkefur, DIME Analytics, The World Bank Group +{p_end} diff --git a/src/sthlp/iesave.sthlp b/src/sthlp/iesave.sthlp new file mode 100644 index 00000000..f50fbf86 --- /dev/null +++ b/src/sthlp/iesave.sthlp @@ -0,0 +1,141 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:iesave}{p_end} +{hline} + +{title:Title} + +{phang}{bf:iesave} - applies best practices before saving data, with option to save meta data report about the data saved. +{p_end} + +{title:Syntax} + +{phang}{bf:iesave} filename, {bf:{ul:id}vars}({it:varlist}) {bf:{ul:v}ersion}({it:version_number}) [ {bf:replace} {bf:userinfo} {bf:report}({it:report_options}) ] +{p_end} + +{dlgtab:Save options:} + +{synoptset 23}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:{ul:id}vars}({it:varlist})}The variable(s) that should identify the data set{p_end} +{synopt: {bf:{ul:v}ersion}({it:version_number})}Specify which {bf:.dta} version to use when saving{p_end} +{synopt: {bf:replace}}Replace the data file if it already exits{p_end} +{synopt: {bf:userinfo}}Include user info in meta data{p_end} +{synopt: {bf:report}({it:report_options})}Save a report with meta data about the data to disk. See below for opt{p_end} +{synoptline} + +{dlgtab:Report options:} + +{phang}These options are only to be used inside {bf:report()} +{p_end} + +{synoptset 26}{...} +{p2coldent:{it:options}}Description{p_end} +{synoptline} +{synopt: {bf:path}({it:{c 34}/path/to/report.md{c 34}})}Save the report using another name and location than the data file{p_end} +{synopt: {bf:replace}}Replace report file if it already exists{p_end} +{synopt: {bf:csv}}Create the report in csv format instead of markdown{p_end} +{synopt: {bf:noalpha}}Order the variables in the report as in the data set and not alphabetically{p_end} +{synoptline} + +{title:Description} + +{pstd}The command {bf:iesave} is an enhanced way of saving data sets to disk, intended to be used instead of the built in command save (see {inp:help save}) when working with research data. In addition to saving the data set to disk, the command applies some best practices steps before saving it and it compiles meta data about the data set and about each variable. The meta data about the data set is always saved in char (see {inp:help char}) characteristics to the data file.Both the data set and the variables meta data can be exported in a separate file that can be tracked using Git. When the data points in the data set changes, then the variable meta data also changes. Therefore, tracking this report in Git allows you to know which changes to your code made changes to the data points. +{p_end} + +{pstd}Before saving the data {bf:iesave} uses compress (see {inp:help compress}) to minimize the storage space the files takes when saved to disk, and it throws and error if isid (see {inp:help isid}) fails to confirm that the ID variable(s) are uniquely and fully identifying the data. This means testing that the ID variable(s) have no duplicated values and no missing values. +{p_end} + +{pstd}The command requires the user to explicitly set the {bf:.dta} version that should be used when saving the data set.This prevents that a team members with a more recent version of Stata accidently saves the data in a file format that team members with an older version of Stata cannot open. +{p_end} + +{pstd}The data set meta data contains information on the ID variable(s), the number of observations, the number of variables, the datasignature, the time and date the file was saved as well as the .dta version the data set was last saved in using iesave. If the option {bf:userinfo} is used, then the data set meta data also includes the username and the computer ID of the user that most recently used iesave to save the data. +{p_end} + +{pstd}If the option {bf:report} is used, then the same data set meta data is also saved to a report in a separate file. In addition to the meta data about the data set, in this report, meta data on all variables are also included. This meta data is descriptive statistics on the data in each variable. The descriptive statistics is different depending on the variable being a string, date, categorical or continuous variable. It is often not feasible or desirable to track a .dta file on GitHub so changes to the data set are usually not be tracked together with changes in the code. This is solved by this report, as the variable meta data will change if the data changes (rare corner case exceptions may exist) and this report is suitable to be tracked on Git. +{p_end} + +{title:Options} + +{dlgtab:Save options:} + +{pstd}{bf:{ul:id}vars}({it:varlist}) is used to specify the variable(s) that uniquely and fully should identify the observations in the data set. This command is intended for research data where data should always be properly identified. The command will, before saving, throw an error if the variables specified in this option have missing values or duplicated values (duplicated combinations of values if more than one ID variable). +{p_end} + +{pstd}{bf:{ul:v}ersion}({it:stata_version}) is used to specify which {bf:.dta} version should be used when saving the data set. This allows a team that works in different versions of Stata to always save in the same {bf:.dta} format no matter which Stata version any team member have installed on their computer. This avoids the issue of a team member saving the data in a format that another team member with an older version cannot read.The recommendation is to set the highest version number allowed in the oldest version of Stata any team member has installed. Not every Stata version include a new {bf:.dta} version. The only the {bf:.dta} versions used in this command is 12, 13 and 14. If a Stata version higher than those versions or a version in-between is specified, then the highest .dta version lower than the specified version is used. For example, if 13.1 is specified, then 13 will be used. +{p_end} + +{pstd}{bf:replace} overwrites the data file if it already exits. If applicable and unless {bf:reportpath()} is used, this also applies to the report file. +{p_end} + +{pstd}{bf:userinfo} includes user information - user name {bf:c(username)} and computer name {bf:c(hostname)} - in the meta data.By default, this information is omitted for privacy reasons. This applies both to meta data saved to char values and, when applicable, meta data saved in the report. +{p_end} + +{pstd}{bf:report}({it:report_options}) is used to create a report with meta data. The default is to save the report in markdown format in the same location as the data file using the same name as the data file but with {bf:.md} as the file extension. See below for report{it:options that can be used to change any of the default behavior. Either {bf:report()} or {bf:report} can be used when keeping all default behavior. +{p_end} + +{dlgtab:Report options:} + +{pstd}These options are only to be used inside {bf:report()} +{p_end} + +{pstd}{bf:path}({it:{c 34}/path/to/report.md{c 34}}) is used to specify a different file location and file name than the default. The file extension must be {bf:.md} or {bf:.csv}.If this option is used then the replace option used for the data file does not apply to the report file. +{p_end} + +{pstd}{bf:replace} is used to replace the report file if it already exists.This option only applies of the report option {bf:path()} is used, as otherwise the replace option for the .dta file also applies to the report file. +{p_end} + +{pstd}{bf:csv} is used to specify that the report should be created in CSV format instead of markdown. This option is superseded and has no effect if the option {bf:path()} is also used. +{p_end} + +{pstd}{bf:noalpha} is used to list the variables in the tables in the report in the same order as the sort order of the data set.The default is to sort the variables alphabetically. +{p_end} + +{title:Examples} + +{dlgtab:Example 1} + +{pstd}This is the most basic usage of {bf:iesave}. Specified like this, it saves the data set after it has checked that the variable {bf:make} is uniquely and fully identifying the data and have used {bf:compress} (see {inp:help compress}) to make sure the data points are stored in the most memory efficient format. +{p_end} + +{input}{space 8}sysuse auto, clear +{space 8}local myfolder "/path/to/folder" +{space 8}iesave "`myfolder'/data1.dta", replace /// +{space 8} idvars(make) version(15) +{text} +{dlgtab:Example 2} + +{pstd}This example is similar to example 1, but it also saves a report with the meta data about the data set and the variables to {bf:data2.md} +{p_end} + +{input}{space 8}sysuse auto, clear +{space 8}local myfolder "/path/to/folder" +{space 8}iesave "`myfolder'/data2.dta", replace /// +{space 8} idvars(make) version(15) report +{text} +{dlgtab:Example 3} + +{pstd}This example is similar to example 2, but it saves the report in csv format and saves it in the custom location specified inside {bf:path()} +{p_end} + +{input}{space 8}sysuse auto, clear +{space 8}local myfolder "/path/to/folder" +{space 8}iesave "`myfolder'/data2.dta", replace /// +{space 8} idvars(make) version(15) /// +{space 8} report(path("`myfolder'/reports/data-report.csv") replace) +{text} +{title:Feedback, bug reports and contributions} + +{pstd}Please send bug-reports, suggestions and requests for clarifications writing {c 34}iefieldkit iesave{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version +history of the code, and submit additions or edits to the code through {browse "https://github.com/worldbank/ietoolkit":GitHub repository} for {inp:ietoolkit}. +{p_end} + +{title:Author} + +{pstd}All commands in iefieldkit are developed by DIME Analytics at the World Bank{c 39}s Development Impact Evaluations department. +{p_end} diff --git a/src/sthlp/ietoolkit.sthlp b/src/sthlp/ietoolkit.sthlp new file mode 100644 index 00000000..a72dc80b --- /dev/null +++ b/src/sthlp/ietoolkit.sthlp @@ -0,0 +1,68 @@ +{smcl} +{* *! version 7.3 20240404}{...} +{hline} +{pstd}help file for {hi:ietoolkit}{p_end} +{hline} + +{title:Title} + +{phang}{bf:ietoolkit} - Returns information on the version of {inp:ietoolkit} installed +{p_end} + +{phang}For a more descriptive discussion on the intended usage and work flow of this command please see the {browse "https://dimewiki.worldbank.org/Ietoolkit":DIME Wiki}. +{p_end} + +{title:Syntax} + +{phang}{bf:ietoolkit} +{p_end} + +{phang}Note that this command takes no arguments at all. +{p_end} + +{title:Description} + +{pstd}{inp:ietoolkit} This command returns the version of {inp:ietoolkit} installed. It can be used to programmatically test if {inp:ietoolkit} is already installed. +{p_end} + +{title:Options} + +{pstd}This command does not take any options. +{p_end} + +{title:Examples} + +{pstd}The code below is an example code that can be added to the top of any do-file. The example code first tests if the command is installed, and install it if not. If it is installed, it tests if the version is less than version 5.0. If it is, it replaces the {inp:ietoolkit} file with the latest version. In your code you can skip the second part if you are not sure which version is required. But you should always have the first part testing that {inp:r(version)} has a value before using it in less than or greater than expressions. +{p_end} + +{input}{space 8}cap ietoolkit +{space 8}if "`r(version)'" == "" { +{space 8} *ietoolkit not installed, install it +{space 8} ssc install ietoolkit +{space 8}} +{space 8}else if `r(version)' < 5.0 { +{space 8} *ietoolkit version too old, install the latest version +{space 8} ssc install ietoolkit , replace +{space 8}} +{text} +{title:Acknowledgements} + +{pstd}We would like to acknowledge the help in testing and proofreading we received in relation to this command and help file from (in alphabetic order): +{p_end} + +{pstd} Luiza Cardoso De Andrade, Seungmin Lee +{p_end} + +{title:Author} + +{pstd}All commands in {inp:ietoolkit} is developed by DIME Analytics at DIME, the World Bank{c 39}s department for Development Impact. +{p_end} + +{pstd}Main author: DIME Analytics, The World Bank +{p_end} + +{pstd}Please send bug-reports, suggestions and requests for clarifications writing {c 34}ietoolkit ietoolkit{c 34} in the subject line to: dimeanalytics@worldbank.org +{p_end} + +{pstd}You can also see the code, make comments to the code, see the version history of the code, and submit additions or edits to the code through the GitHub repository of {inp:ietoolkit}. +{p_end} diff --git a/src/tests/README.md b/src/tests/README.md new file mode 100644 index 00000000..ed60d8d7 --- /dev/null +++ b/src/tests/README.md @@ -0,0 +1,12 @@ +# Folder for test files + +The folders in this folder is expected to be created using the command `ad_command`. +For each new command, `ad_command` creates a folder named after the command and creates a do-file in that folder. +That do-file is the main do-file. + +In the command specific folders, users may create whatever files they need to create and run the relevant tests. +If you are using GitHub and have used `adodown` to set up GitHub files, then you can, in these command folders, +create a folder called `inputs` and a folder called `outputs`. +These folders and their content is ignored from the repository. +If you do want to commit your inputs or outputs in this test to your repository, +then just name the folders something slightly different. diff --git a/src/tests/iebaltab/iebaltab.do b/src/tests/iebaltab/iebaltab.do new file mode 100644 index 00000000..e4a6be74 --- /dev/null +++ b/src/tests/iebaltab/iebaltab.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iebaltab + iebaltab + + // Add more tests here... diff --git a/src/tests/ieboilstart/ieboilstart.do b/src/tests/ieboilstart/ieboilstart.do new file mode 100644 index 00000000..f27062cd --- /dev/null +++ b/src/tests/ieboilstart/ieboilstart.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command ieboilstart + ieboilstart + + // Add more tests here... diff --git a/src/tests/ieddtab/ieddtab.do b/src/tests/ieddtab/ieddtab.do new file mode 100644 index 00000000..ae000ffd --- /dev/null +++ b/src/tests/ieddtab/ieddtab.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command ieddtab + ieddtab + + // Add more tests here... diff --git a/src/tests/iedropone/iedropone.do b/src/tests/iedropone/iedropone.do new file mode 100644 index 00000000..f0e67a51 --- /dev/null +++ b/src/tests/iedropone/iedropone.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iedropone + iedropone + + // Add more tests here... diff --git a/src/tests/iefolder/iefolder.do b/src/tests/iefolder/iefolder.do new file mode 100644 index 00000000..c44bdbbf --- /dev/null +++ b/src/tests/iefolder/iefolder.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iefolder + iefolder + + // Add more tests here... diff --git a/src/tests/iegitaddmd/iegitaddmd.do b/src/tests/iegitaddmd/iegitaddmd.do new file mode 100644 index 00000000..e0680d7d --- /dev/null +++ b/src/tests/iegitaddmd/iegitaddmd.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iegitaddmd + iegitaddmd + + // Add more tests here... diff --git a/src/tests/iegraph/iegraph.do b/src/tests/iegraph/iegraph.do new file mode 100644 index 00000000..e1307156 --- /dev/null +++ b/src/tests/iegraph/iegraph.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iegraph + iegraph + + // Add more tests here... diff --git a/src/tests/iekdensity/iekdensity.do b/src/tests/iekdensity/iekdensity.do new file mode 100644 index 00000000..1180dc74 --- /dev/null +++ b/src/tests/iekdensity/iekdensity.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iekdensity + iekdensity + + // Add more tests here... diff --git a/src/tests/iematch/iematch.do b/src/tests/iematch/iematch.do new file mode 100644 index 00000000..60a05d36 --- /dev/null +++ b/src/tests/iematch/iematch.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iematch + iematch + + // Add more tests here... diff --git a/src/tests/iesave/iesave.do b/src/tests/iesave/iesave.do new file mode 100644 index 00000000..45993346 --- /dev/null +++ b/src/tests/iesave/iesave.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command iesave + iesave + + // Add more tests here... diff --git a/src/tests/ietoolkit/ietoolkit.do b/src/tests/ietoolkit/ietoolkit.do new file mode 100644 index 00000000..6cb71b25 --- /dev/null +++ b/src/tests/ietoolkit/ietoolkit.do @@ -0,0 +1,38 @@ + * This test file use utilities from the repkit package - https://github.com/worldbank/repkit + * Test if package is installed, otherwise throw error telling user to install repkit + cap which repkit + if _rc == 111 { + di as error "{pstd}You need to have {cmd:repkit} installed to run this reproducibility package. Click {stata ssc install repkit, replace} to do so.{p_end}" + } + + ************************ + * Set up root paths (if not already set), and set up dev environment + + * Always important to version control built-in Stata functions + version 14.1 + + * Use reproot to manage root path + reproot, project("ietoolkit") roots("clone") prefix("ietoolkit_") + + * Use locals for all non-root paths + local testfldr "${adwn_clone}/src/tests" + + * Use the /dev-env folder as a dev environment + cap mkdir "`testfldr'/dev-env" + repado using "`testfldr'/dev-env" + + * Make sure repkit is installed also in the dev environment + cap which repkit + if _rc == 111 ssc install repkit + + * Make sure the version of ietoolkit in the dev environment us up to date with all edits. + cap net uninstall ietoolkit + net install ietoolkit, from("${ietoolkit_clone}/src") replace + + ************************ + * Run tests + + * Test basic case of the command ietoolkit + ietoolkit + + // Add more tests here... diff --git a/src/vignettes/README.md b/src/vignettes/README.md new file mode 100644 index 00000000..52f355a4 --- /dev/null +++ b/src/vignettes/README.md @@ -0,0 +1,20 @@ +# Vignettes + +In this folder you can put article styled documentation. +What do we mean by that? +These article styled vignettes is supposed to be a complement to +the command documentation written in the mdhlp-files +which are later rendered into sthlp-files. + +Helpfiles should be technical descriptions on how to +run a command, what the options are, +how they are specified, and what the expected outcome is. + +Article styled documentation compliments that by being a +long-form guide that can be more narrative than technical. +Article styled documentation is also a better place for subjective best-practices +than helpfiles as helpfiles should be objective. + +For example, a vignette can be about the initial motivation behind a command, +it can be about how multiple commands in the package can work together, +or anything else the authors of a package wants to communicate to the users.