Friday, September 6, 2013

Sargent online

Tom Sargent and John Stachurski go online with a fascinating web based course in quantitative economic modeling.

Two thoughts.  The education world is going online, but we're all in version 1.0 at best. Tom and John's website is an interestingly different paradigm than the online courses such as the Coursera platform that I'm using for an online asset pricing course.  I'll be curious to see which elements of which paradigm survive. Or perhaps the Toms' webiste will become the "textbook" for Coursera type courses, which can then add videos, forums, a structured environment for plowing through the material, and  the carrot of certification at the end.

The website is just gorgeous. Producing economic (and scientific) articles for viewing online has so far been a headache. Our journals produce beautiful pdf representations of.. printed pages. They might as well show 3-d images of a papyrus scroll. Math and tables in html as presented on most journal websites is just pathetically ugly. As I looked through this website, I'm enthused that 1) I need to learn python and 2) I need to learn to write my papers and textbooks in this gorgeous format.


  1. It seems they are using MathJax ( to typeset equations, which simply renders the LaTeX math markup you're probably already familiar with. No need to learn python for that.

    1. Python is used to code up the quantitative exercises in their book.

  2. It looks like the website is all in Latex code and just translated from the pdf. I'm sure there's an easy way to set that up, but I have pretty much no idea what that is.

    I read most of the pdf. I thought the python introduction was one of the better ones I've seen (mainly since it was well-written, looked good, and included some stuff I wasn't already familiar with).

    1. How do you translate latex or pdf directly to html? I know mathjax, and tried to use it for this blog. Alas it didn't work on mobile devices so I stopped.

    2. Prof. Cochrane,

      Have you tried WinEdt? WinEdt is a latex editor and provides a way for you to convert latex to html. I tried it once and was satisfied. To convert latex to hmtl: open WinEdt, and go to Tex -> Html -> Latex (or Tex) -> Html. I believe that many other latex editors provide such a functionality.

    3. A really helpful tool for this kind of thing is is pandoc:

      For R users there's a great package for creating documents like the online textbook you mention above: knitr

      I find myself using knitr for pretty much everything these days, from research articles written in LaTeX to teaching material deployed online. Here's an example (math at the bottom):

      The preceding example was written in RMarkdown. All the math commands are straight-up LaTeX and everything else is like a stripped down version of HTML. The R code chunks live inside the document so when you compile it the output is automatically updated and included. Best of all, the final webpage is completely self-contained: all images and other material are directly embedded so there's only one file to upload.

      Python is very cool, but for econometrics it's hard to beat R in my opinion. For those who worry that R is too slow for heavy-duty computation, I recommend the Rcpp package which makes it completely painless to include C++ code in R scripts:

      along with the RcppArmadillo package for high-performance matrix algebra:

    4. Wow! Thanks for sharing these tools.

  3. Cooler than you think: they use sphinx, which then outputs html, latex, or pdf as desired. Also does syntax highlighting on code snippets.

    * Sphinx:
    * Example of code (look for "show source" on the right):


Comments are welcome. Keep it short, polite, and on topic.

Thanks to a few abusers I am now moderating comments. I welcome thoughtful disagreement. I will block comments with insulting or abusive language. I'm also blocking totally inane comments. Try to make some sense. I am much more likely to allow critical comments if you have the honesty and courage to use your real name.