#+OPTIONS: ^:nil
#+BEGIN_COMMENT
.. title: Teaching with Stata
.. slug: stata-teaching
.. date: 2018-09-28 11:15:50 UTC-05:00
.. tags: stata, jupyter, reproducible research, literate programming
.. category:
.. link:
.. description:
.. type: text
#+END_COMMENT
This post skews towards recommending the stata add-on "markstat". For most of my students this is still recommended. For those that have some python interest/skills and especially those that have already installed jupyter notebook or lab, [[./stata_kernel_jupyterlab.html][I highly recommend =stata_kernel= and jupyter notebook (or lab)]].
This post is a followup to two earlier blog posts on reproducible research found [[http://rlhick.people.wm.edu/posts/stata-and-literate-programming-in-emacs-org-mode.html][here]] and [[http://rlhick.people.wm.edu/posts/reproducible-research.html][here]]. This post focuses on my usage of Stata for classroom assignments turned in by students. These assignments entail
1. Model Description including mathematical equations (Latex)
2. Data Summaries and Figures
3. Stata Code
4. Stata Results
5. Quality publishing system to produce a problem set document containing all of the above elements
6. Easy for students to use (given a willingness to learn the markdown syntax)
These are different from my own research requirements. For me, emacs org-mode is the best tool for the reasons I outline in the prior posts linked above. For my students, however, learning Emacs and org-mode is totally impractical. This post quickly surveys the three available options: Markdoc, Markstat, and Jupyter Notebook.
#+HTML:
** Markdoc and Markstat
Over the years I have tried two Stata-centric solutions:
1. [[https://github.com/haghish/markdoc][Markdoc]]
2. [[http://data.princeton.edu/stata/markdown/][Markstat]]
Both of these take a similar approach to building the assignment document. For a project, the student creates a type of =do= file that contains a mix of markdown and stata commands that can then create a pdf, word document, or html output file. For example, the [[http://rlhick.people.wm.edu/econ407/bin/reproducible_research.stmd][stata markdown file here]] produces [[http://rlhick.people.wm.edu/econ407/bin/reproducible_research.pdf][this pdf document]] using the installable =markstat= command (what I am currently using for my teaching). Both of these installable 3rd party commands take creative approaches to sidestepping Stata's shortcomings when it comes to literate programming. They mostly work well (95% of the time) but there can be platform-specific problems that are difficult to support for an instructor who wants to focus on econometrics rather than technical glitches.
** Jupyter Notebook
In my post [[http://rlhick.people.wm.edu/posts/reproducible-research.html][about reproducible research]] from 2017, I was fairly dismissive about using the Jupyter Notebook with Stata using [[https://github.com/TiesdeKok/ipystata][Ipystata]] on either a Mac or Linux computer. Recently, I revisited the use of Stata with Jupyter using the [[https://kylebarron.github.io/stata_kernel/][stata_kernel]] rather than Ipystata that I outline in [[./stata_kernel_jupyterlab.html][this post on =stata_kernel=]]. All of my prior complaints seem to be settled and I may try using this for my courses next year.
There are numerous Jupyter Notebook demos on YouTube available so I'm not going to include a sales pitch here about capabilities, but they are impressive. The Jupyter Notebook is arguably the most used scientific research platform and is used here on campus for teaching a number of the Computer Science courses so many students will already be aware of basic usage and setup.