tag:blogger.com,1999:blog-55806202024-03-12T16:02:37.906-07:00Better than Standard Errors | Brian QuistorffThoughts on Economics and other musingsbequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.comBlogger51125tag:blogger.com,1999:blog-5580620.post-21280072102369006692022-04-22T13:07:00.001-07:002022-04-22T13:07:14.182-07:00Alleviating bias from testing pre-trends in event study designs Jonathan Roth has a recent paper Pre-test with Caution: Event-study Estimates After Testing for Parallel Trends, dealing with event study designs that rely on the "parallel trends" assumption (i.e., in the absence of treatment, the treated units would have moved parallel to the control units). He makes the case that (1) many tests for parallel trends in the pre-treatment period in the bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-71704145345304293332021-08-30T14:34:00.003-07:002021-08-31T06:33:14.731-07:00Cross-fitting in StataCross-fitting is a method to produce unbiased (honest) predictions/residuals from a model. It is commonly used these days when dealing with Machine Learning models as they typically have flexibility/bias built-in. Cross-fitting can be seen as the initial part of cross-validation: the data are split into K folds, and predictions for fold k are done using a model trained on all data but fold k. bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-54375693260609063732021-08-30T14:24:00.001-07:002021-08-30T14:24:33.579-07:00Random Forest imlementation in StataI recently needed a Random Forest implementation on a slightly older version of Stata and found the choices quite lacking. crtrees (deck)
is a Stata-native implementation, but I found confusing errors when
running this. I tried to fix them, but the code looks like it has been
sent through a code obfuscator!Stata's native interface with Python wasn't available to me since I was using Statabequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-53649240423825766842021-07-29T13:03:00.004-07:002021-07-29T13:13:03.785-07:00Getting Stata automation working without administrative priveleges"You have no power here!"If you're using Stata on Windows, Stata automation is really powerful. It can allow you to efficiently use Jupyter notebooks using stata_kernel (or IPyStata's automation interface). The "installation", however, typically requires admin right. If you have a non-admin user, here's how to do it.Installation consists of registering the Stata type library in the Windows bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com2tag:blogger.com,1999:blog-5580620.post-61739037965957318592018-07-07T08:09:00.002-07:002018-07-07T08:09:40.641-07:00A safer way to allow gambling
With the recent decision by the Supreme Court to allow states to legalize sports betting, states should think through possibly ways to legalize gambling. We should thinking through how to do it while reducing the negative consequences, such as, gambling addiction. I think one of the keys is separating as much as possible gambling from temptation. We should worry less about someone who has bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-80770575486109748252018-02-08T10:53:00.003-08:002018-02-08T10:53:24.548-08:00FinTech: Service to optimize credit card payments
Many people carry credit balances across multiple cards. The best general strategy to allocate a given amount towards monthly payments is to make the minimum payments on each card and then allocate the remainder to the card with the highest interest rates. Multiple studies have shown, however, that people do not do this, but instead follow simple heuristic such as dividing payments in proportionbequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-72018235100760373452017-11-12T10:18:00.003-08:002017-11-12T10:18:49.919-08:00Blinded voters guides
A common practice when hiring is to "blind" the resumes of candidates at initial evaluation stages so that attributes such as race/ethnicity, gender, and age do not unduly influence the initial process. I would like a similar "screen" for voters guides for local elections where I may be unfamiliar with the candidates. The guide would present candidates as unnamed #1, #2, ..., and then give the bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-77181548195411968932016-09-12T20:57:00.000-07:002017-07-31T09:33:24.235-07:00Guidelines for making a Stata package
Here are some guidelines for making a well behaved Stata package (ado):
Provide all relevant output programmatically, not just textually. Another package may want to work with yours.
Provide a way to check the version of your package.
Use version.
The package file should have a line like 'd Distribution-Date: 01jan2000' so that the package can be updated from adoupdate.
Make clear in the bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-25744105010504184602016-05-02T08:50:00.000-07:002016-05-02T08:50:09.260-07:00LyX template for UMD dissertation format
The following is a template for formatting dissertation in LyX for PhD dissertations for the University of Maryland, College Park. The umdthesis.cls file is a slightly modified version of thesis.cls from here (and renamed so it doesn't conflict with existing thesis files). Instructions for using the LyX file are in a comment at the top of that file.
Files:
umddissertation.lyx
bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-2106547700808072542016-04-23T06:39:00.001-07:002016-04-23T06:39:08.262-07:00"Auto-edit failed" errors in LyX
A nice feature of LyX is that you can edit \included (or \inputed) files from the Insert→File→Child Document dialog window. I was recently having a problem, however, where I could edit file types that had notepad as the default handler but not those that had Notepad++ as the default handler. I would get dialog messages saying "Error: Cannot edit file \n Auto-edit file file_path.tex failed". If bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com2tag:blogger.com,1999:blog-5580620.post-87087766607397406962016-02-18T09:41:00.003-08:002016-02-18T09:41:25.537-08:00More efficient news reading
Nassim Taleb famously doesn't read the news. One of his reasons is that much of the news is inconsequential. This is both because news outlets need to publish even on slows days (the BBC has on only one day stated "[t]here is no news") and because it is difficult to tell at the time what will be important, especially from just headlines. Existing metrics to help determine if something bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-61323158398793350102016-01-31T14:37:00.001-08:002016-01-31T14:40:31.560-08:00Reproducible PDFs from LaTeX
I like using version control, such as git, to store project files. When working with others it is often convenient to commit generated files, such as PDFs from LyX files. PDFs, however, may be different for inconsequential reasons, making them more inconvenient with version control systems.
I have patched the pdftex executables from MiKTeX so that if you are on Windows (x64), the PDFs can be bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-87994598184238935162015-09-13T18:38:00.002-07:002016-01-14T17:49:22.140-08:00Compiling Stata plugins
Here are some notes on how to compile plugins for Stata. The official plugin page is a bit out of date.
Linux: Add option -fPIC. If you want to build a 32-bit plugin on a 64-bit system then you will need the 32-bit version of libc (e.g. on Debian install g++-multilib and libc6-dev-i386).
Windows: You will need the mingw-w64 compiler (unless you just want 32-bit in which bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-56580158799905684922015-09-02T17:09:00.000-07:002016-03-06T12:35:07.746-08:00assign_treatment: A Tool for Stratified Randomization
This blog post by David McKenzie and Miriam Bruhn talks about assigning treatments at random when stratification variables cause cells (unique combinations of stratification variable values) to have uneven number of methods. The provided Stata do-file is hard-coded for a six treatments and is a bit difficult to adapt for another number. I've made a module that does the assignment for bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com2tag:blogger.com,1999:blog-5580620.post-45388864021463728202015-08-18T21:25:00.002-07:002016-03-03T07:43:09.512-08:00Continuous Integration with Stata
Continuous Integration is a workflow that frequently merges code changes and automatically runs tests. This can be especially helpful when working in teams. Several free services exist, such as Travis-CI which provides Linux build infrastructure and integrates with GitHub. Basically, you instruct Travis how to setup a Linux environment for your project and then direct it what tests to run. bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-61864522879869493822015-06-22T06:34:00.000-07:002015-07-05T10:16:35.231-07:00Indepedent backups of researcher data
Open data is important for healthy scientific research. A recent journal article by Vines et al. studies how available data is from authors. Sadly, they find that
[R]esearch data cannot be reliably preserved by individual researchers, and further demonstrates the urgent need for policies mandating data sharing via public archives.
Most policy mandates are for newly published research, but what bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-37659610917268893802015-06-17T10:07:00.003-07:002015-09-17T11:40:14.776-07:00Stand-alone Pre-analysis Plans for observational studies
The push for research transparency in social science has included advocating for pre-analysis plans (PAPs) where researchers detail what they will do before seeing the data. These plans provide many benefits, the most obvious ones are (a) it rules out specification searching so that p-values are more believable, and (b) since it registers research before the findings it helps in understanding bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-43797010335653469112015-06-11T11:31:00.000-07:002015-06-22T06:01:59.403-07:00Getting versions of Stata modules
For reproducible research it is important to be able to reproduce your analysis environment. For Stata analyses, one needs to list the version of Stata modules used. This is especially important as the ssc archive does not store previous versions of modules. Ideally, one is storing the module files with a project, but it is still useful to have a measure of the version of the modules. Stata bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-55113700622877116542015-04-22T16:33:00.002-07:002015-05-09T13:07:22.576-07:00Code Management in Dropbox
Dropbox is not the ideal version control system, but some people do not want to make the leap to a full VCS (like git or svn which full software developers use). Given that one should not make the perfect the enemy of the good, what simple tips can Stata-base economists follow that will make their lives easier? Here are some tips that will be helpful on projects that last a while (longer than bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-79921966744010267262015-01-30T08:38:00.002-08:002015-01-30T08:38:17.795-08:00Using Yik Yak to quantify aspects of student life?
Just listened to a nice piece on Reply All about Yik Yak, which is app where users can post messages anonymously and see the messages of those nearby (10 miles). The podcast mentioned how it was useful in showing written evidence of racism that previously was hard to prove. It got me thinking that if there was a way to get the feeds from different universities then one could analyze these using bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-82431113818512364732015-01-28T13:52:00.003-08:002016-01-17T09:51:02.795-08:00Prediction markets for human capital investment
While there has been a growing literature on prediction markets, most of the markets have been confined to politics and macro-economics. These are great to have, but I would like to see markets that could help with more decisions that typical people make, such as when, and in what field to get training. The information that people have is usually about the current economy (this industry bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-23999531211480146402015-01-20T08:44:00.002-08:002015-01-30T06:52:43.679-08:00Getting latexmk working within LyX
If you would like to add latexmk as an export option in Lyx, here are the two basic steps to do in Tools -> Options.
1) In File Handling -> File Format, hit "New" and then put in these options, then "Apply".
2) Then in File Handling -> Converter, click on any existing converter, change the options to the below, and then click "Add", then "Save".
Now you should be able to bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com2tag:blogger.com,1999:blog-5580620.post-19018905269757121652015-01-20T07:48:00.002-08:002015-08-20T07:42:16.022-07:00Running Stata 12 on Ubuntu 14.04 (Trusty Tahr)
After upgrading my linux machine I realized that I could no longer run my copy of Stata 12 GUI. It game the error:
./xstata-se: error while loading shared libraries: libgtksourceview-1.0.so.0: cannot open shared object file: No such file or directory
These older versions of libraries aren't in the normal Ubuntu repositories anymore, so this is a simple work around to get Stata working again. (bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com8tag:blogger.com,1999:blog-5580620.post-14238424477910518372014-11-25T05:35:00.004-08:002014-11-25T06:32:02.417-08:00Graphs with log-scales in the positive and negative domains
Often to show data that is highly dispersed one will compress the data by graphing its log. One down-side of this is that it only works if the data is all-positive or all-negative (if you use \(-ln(-x)\)). If your data contains zero and/or points in both domains then the you have to do something else. Here is a simple extension that uses a linear function around zero to smoothly connect a bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0tag:blogger.com,1999:blog-5580620.post-73345547008437040452014-11-19T20:25:00.000-08:002015-01-28T13:56:20.105-08:00Using make with Stata
Having a makefile helps automate a lot of tasks with a project.
Generating different formats of logs, tex tables, and gphs (including making versions of the figs that have no titles). And removing orphan files if the primary ones are removed.
Normalizing logs, gphs, and dtas prior to committing.
Generating PDFs of Lyx files.
Updating the project mlib when mata files change.
bequwhttp://www.blogger.com/profile/03320815247660618827noreply@blogger.com0