

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Ryan Banerjee University of Maryland Econ 744 Mini Computing Course (2008)
Outline
This course is going to be run over email, with the occasional lectures/discussions, if we find them necessary. The only way to learn programming is to just do it. Feel free to email me questions or just drop into my office TYD 4118A.
The aim of this mini course is:
This mini course will only teach you the basics of getting the job done. There are many more fancy techniques for solving dynamic programming problems. John Rust’s Econ625 course is a good place to learn them. Hopefully this course will give you the basics, which will make learning the more advanced techniques easier.
I assume you all have a basic knowledge of MATLAB. Please let me know if you have never used MATLAB before. There are lots of good tutorials on the web.
I don’t know how to program in FORTRAN, so we will learn this section together. However, once you get the basic idea of dynamic programming in MATLAB, I anticipate that making the transition will not be too complicated. Also there are many FREE versions of FORTRAN around, and I will help you get started with it, and FREE programming in general.
I think seeing the implementation of a recursive competitive equilibrium on a computer is the best way to fully appreciate the concept. The important things are (a) to have the concepts of what recursive equilibria are, so one can construct the right Bellman equation(s) depending on the problem one wants to study (while this has nothing to do with knowing either Matlab or Fortran, seeing the implementation in code helped me understand the logic).
The best way to learn programming is from seeing examples. So I will give you some example code and ask you to modify it. Working in small groups is often very helpful. Also feel free to look for code/help on the web. There is no such thing as cheating, grab what you can from where you can. Just make sure you understand it.
Problems
Computers and software
MATLAB vs. FORTRAN
Everything we do on this course can be done in MATLAB. For most applications MATLAB should be sufficient. E.g. the solution of the Aiyagari-Hugget model in the Ljunqvist+Sargent textbook has the web links to Matlab code for solving it, but Aiyagari and Hugget both solved them originally in Fortran. Prof. Mendoza suggest: ‘A good rule of thumb is that if your problem is memory intensive and/or requires lots of loops with possible subroutine calls, exit clauses and lots of conditional statements within loops, Fortran is likely to do better than Matlab, but otherwise it is likely to do worse or at best just as good but with many more lines of code.’
MATLAB
MATLAB is installed on the graduate lab computers, if you don’t have it already. There is a student version available, but usually, professors can get a better deal if they contact MATLAB directly, let me know if you want to get your own copy of MATLAB.
A free alternative to MATLAB is called Octave. If you really hate paying for software this might be a good alternative. I have not tried it, but supposedly, it should do all the things we are going to cover and has very similar syntax to MATLAB (unlike another free program Scilab, which has more bells and whistles.)
FORTRAN
For FORTRAN it might be helpful to have everything set up on your own computer. You will have to install a bunch of things on your computer (all FREE). For those of you who only use the mouse, this will be your intro to geekdom. It is intimidating at first, but there are loads of tutorials on the web. I have only learned this stuff in the past 6 months.
The first thing you need is a text editor. If you use Linux or Mac, there are already good editors built in. If you use a MS Windows computer, you should install a text editor such as VIM or EMACS (Notepad.exe is not really that good for programming). I use VIM and followed the tutorial that came with the install. The text editor enables you to write/edit you code, before running the FORTRAN compiler, which turns your code into