Blog Topics...

3D plotting (1) Academic Life (2) ACE (18) Adaptive Behavior (2) Agglomeration (1) Aggregation Problems (1) Asset Pricing (1) Asymmetric Information (2) Behavioral Economics (1) Breakfast (4) Business Cycles (8) Business Theory (4) China (1) Cities (2) Clustering (1) Collective Intelligence (1) Community Structure (1) Complex Systems (42) Computational Complexity (1) Consumption (1) Contracting (1) Credit constraints (1) Credit Cycles (6) Daydreaming (2) Decision Making (1) Deflation (1) Diffusion (2) Disequilibrium Dynamics (6) DSGE (3) Dynamic Programming (6) Dynamical Systems (9) Econometrics (2) Economic Growth (5) Economic Policy (5) Economic Theory (1) Education (4) Emacs (1) Ergodic Theory (6) Euro Zone (1) Evolutionary Biology (1) EVT (1) Externalities (1) Finance (29) Fitness (6) Game Theory (3) General Equilibrium (8) Geopolitics (1) GitHub (1) Graph of the Day (11) Greatest Hits (1) Healthcare Economics (1) Heterogenous Agent Models (2) Heteroskedasticity (1) HFT (1) Housing Market (2) Income Inequality (2) Inflation (2) Institutions (2) Interesting reading material (2) IPython (1) IS-LM (1) Jerusalem (7) Keynes (1) Kronecker Graphs (3) Krussel-Smith (1) Labor Economics (1) Leverage (2) Liquidity (11) Logistics (6) Lucas Critique (2) Machine Learning (2) Macroeconomics (45) Macroprudential Regulation (1) Mathematics (23) matplotlib (10) Mayavi (1) Micro-foundations (10) Microeconomic of Banking (1) Modeling (8) Monetary Policy (4) Mountaineering (9) MSD (1) My Daily Show (3) NASA (1) Networks (46) Non-parametric Estimation (5) NumPy (2) Old Jaffa (9) Online Gaming (1) Optimal Growth (1) Oxford (4) Pakistan (1) Pandas (8) Penn World Tables (1) Physics (2) Pigouvian taxes (1) Politics (6) Power Laws (10) Prediction Markets (1) Prices (3) Prisoner's Dilemma (2) Producer Theory (2) Python (29) Quant (4) Quote of the Day (21) Ramsey model (1) Rational Expectations (1) RBC Models (2) Research Agenda (36) Santa Fe (6) SciPy (1) Shakshuka (1) Shiller (1) Social Dynamics (1) St. Andrews (1) Statistics (1) Stocks (2) Sugarscape (2) Summer Plans (2) Systemic Risk (13) Teaching (16) Theory of the Firm (4) Trade (4) Travel (3) Unemployment (9) Value iteration (2) Visualizations (1) wbdata (2) Web 2.0 (1) Yale (1)
Showing posts with label Teaching. Show all posts
Showing posts with label Teaching. Show all posts

Monday, February 14, 2011

Ashamed to admit it, but...

Today I went through a properly rigorous mathematical treatment of the basic IS-LM model for the first time.  Alpha Chiang gives an excellent treatment of the IS-LM framework in his Fundamental Methods of Mathematical Economics.

I am embarrassed to say that this is my first time going through IS-LM!  I assume that this would be something that a second (or maybe even first) year undergraduate would have encountered.  I am only slightly absolved because I never studied undergraduate economics.  It was covered, very briefly, in my MSc at the University of Edinburgh.  However it wasn't stressed as being useful, and we weren't examined on it.

Having spent my entire day going through increasingly sophisticated versions of IS-LM, I feel pretty good.  I feel like I learned quite a bit about how the macroeconomy works.  I pose to my readers the following question: Why is it that some economists believe that IS-LM has been discredited?

I take as given that the economists in question are extremely intelligent and have thought deeply about the issues involved...so there must be some other reason.  I was actually surprised that a Google search for: IS-LM "discredited" turned up (for the most part) fairly positive articles.  If anyone has what they think is a convincing refutation of the IS-LM framework I would appreciate it if you send a pointer in my direction!

I will be teaching a very basic (and non-mathematical) version of the model in first year macroeconomics in a few weeks...

Update: Sean passed Tyler Cowen's critique of IS-LM to me via email.  My quick take on Tyler's critiques: points 1 and 4 are well taken.  Point 2 (and to a lesser extent point 5) would seem to implicitly assume that investment decisions are made solely on the basis of real and not nominal variables.

Sunday, October 24, 2010

Sage is Awesome!

I just started playing around with Sage this morning and am already hooked!  The pedagogic possibilities alone would make learning to use Sage worthwhile for economists...imagine a classroom where the lecturer was simultaneously plotting production possibility sets in 3D and then manipulating them as she chatted about returns to scale, diminishing marginal products, sunk costs, etc.

On the research end, Sage has most (if not all) of the functionality of MatLab, Mathematica, Magma, etc and because it is Python based it incorporates a large number of additional features absent from those other platforms...and it is totally free!

Saturday, September 18, 2010

Introductory Maths and Stats: Intertemporal Optimization...

This lecture should be cut.  Material covered is not really used enough in the core curriculum to justify spending anytime on this...some version of the material could be included as a separate handout over winter holiday.

Introductory Maths and Stats: Discrete-time Intertemporal Optimization...

This should be the culminating lecture of QM0.  Students should be able to understand the difference between static and dynamic optimization.  The intuition for this can be built by focusing time on explaining how one derives the life-time budget constraint from the budget constraints for each time period (basically just add/aggregate, integrate depending).  Really invest time in going through the details of exactly what the budget constraint is how it is derived etc.  This is important as it comes up again and again...

Intertemporal Choice: Two-Period Example: Wouldn't really change much from this section, it is nicely written and hits all the high points...

Intertemporal Choice: T-Period Example: Here the focus is on the permanent income hypothesis, which is a pretty good example that demonstrates the techniques involved.

More Complicated T-period Example: This section should be cut from the lecture and covered in tutorials...this would allow lecturer to move through the above material at more measured pace.  I would jump from the permanent income hypothesis material straight to the simple discussion of dynamic programming.

Simple Discussion of Dynamic Programming: Section is good, although the maths needs to be simplified a bit so as to coincide with the permanent income hypothesis section that would proceed it.  Perhaps tutors could extend the dynamic programming case in the tutorials...

Introductory Maths and Stats: Kuhn-Tucker Theorm...

Intuition: Since most economic constraints are inequality constraints not equality constraints, it makes sense for students to learn a bit about Kuhn-Tucker theory...to build intuition I like to draw pictures in order to demonstrate the different sets of complementary slackness conditions for a single variable function in both the maximization case and the minimization case.  There would be six diagrams that clearly emphasize the corner solutions v. the interior optimum, and the idea of a binding constraint versus a slack constraint.  Remember, if one of the constraints is slack the other MUST be binding!

Kuhn-Tucker Theorem: After building intuition with diagrams in the single variable case, I would jump straight to the Kuhn-Tucker theorem and the corresponding algorithm used to solve inequality constrained optimization problems.

General Case: The notes on the general case are confusing and I am not sure that they add to the student's understanding of how to apply Kuhn-Tucker.  I would recommend cutting the notes on the general case and spend more time working problems and making sure that the students understand the difference between slack constraints and binding constraints...

Friday, September 17, 2010

Introductory Maths and Stats: Static Unconstrained Optimization of N-Variable Function...

The title is a mouthful, but the lecture itself is fairly straightforward (aside from the notation being a bit complex)...

Rules for Single Variable Optimization:
  • If df/dx=0 and d^2f/dx^2<0 at any point x0, then x0 is a local max
  • If df/dx=0 and d^2f/dx^2>0 at any point x0, then x0 is a local min
  • If df/dx=0 and d^2f/dx^2=0 at any point x0, then necessary but not sufficient conditions exist for x0 to be an inflexion point...
N-variable case is similar, but the notation becomes more complex (uses vectors instead of single variables etc.) 

The Two Variable Case: The discussion in the lecture notes of unconstrained optimization with two variables is good.  I particularly like how emphasis is placed on using Taylor expansions in the argument.  I would only recommend that more pictures be included.  Anytime a Taylor expansion is used, it just screams DRAW A PICTURE!!!

Quadratic Form, Definite Matrices and Hessians: I would like to see this discussion moved up a bit.  Hessians should be introduced in lecture 2 on multi-variable calculus.  The maths notes should link more closely with the stats notes (particularly the linear algebra parts).   Definite matrices should be emphasized in both the maths and stats, and a solid amount of lecture and tutorial time should be spent on the concept.  Definite matrices provide the coat-hanger on which much of the linear algebra that is used in microeconomics and QM hangs...

Concavity and Convexity: Again draws pictures.  Emphasize that the definitions are almost identical to the single variate case.  Only difference is that we are dealing with vectors now and not scalars in the argument of the function.

Chain Rule and the Envelope Theorem:  Material on the Envelope Theorem is scattered across three lectures.  I think the best think to do is devote an entire lecture to the envelope theorem after all of the necessary maths have been developed.  This would serve as a useful mid-course refresher for the students, and I think would make the theorem more understandable.  It is important, and thus I think it should get its own lecture...

Economic Applications: Solow Efficiency Wage model should be cut out of lecture and covered in a tutorial.  This would open up more lecture time for other more important topics...

The entire section that covers the derivations of the OLS equations using maximum likelihood should be cut from the lecture and converted into a handout for the students to study over winter holiday, it is very long and too complicated to ask about on the QM0 exam.  Lecture time and tutorials would be better spent elsewhere... 

Introductory Maths and Stats: Multi-Variable Calculus...

This is a continuation of my notes for my intro maths and stats tutorials.  This is my summary of Lecture Two: Multi-Variable Calculus...

Partial Differentiation: Easy to extend differentiation from single variable to multi-variable case.  Say you have f(x,y), then to take partial derivative with respect to x simply treat y as a constant and take the derivative of f with respect to x like single variable case!  That's it...also higher order derivatives are calculated by successive application of differentiation.  Demonstrate that cross-partial derivatives are equal (if f is well-behaved)!

I think it would be worthwhile to also mention the Hessian Matrix (matrix of second derivatives).  Talk about special cases when matrix is positive (semi) definite of negative (semi) definite.  Can also use it as an excuse to talk about eigenvalues, eigenvectors, determinants, etc from linear algebra.  Example: f(x,y)=x^2 + y^2...

Total Differentiation and Chain Rules: I totally agree with Yu Fu...one should not try to memorize all of the chain rules related to partial differentiation there are just too many combinations and cases.  Better to focus on understanding the concept of total differentiation and then the difference between independent and intermediate variables.  For example: suppose we have the usual case in economics where f(x(t), y(t)) and t=time.  In this case the independent variable is t, and the dependent variable is f (x and y are only intermediate variables that "filter" the effect of t on f). 

Implicit Functions and Differentiation: Just another application of partial differentiation and chain rules...

The Envelope Theorem: Understanding the envelope theorem is key in microeconomic price theory.  Mathematically, the envelope theorem is simply an application of chain rules, total differentiation, and partial differentiation!  No sweat...

Systems of Implicit Functions and Jacobian Determinants: BLAH!  OK, first I think the lecture notes need to be re-ordered so that the lecturer reviews determinants, Cramer's rule etc. BEFORE tackling this section.  Note that Cramer's rule is a REALLY inefficient way to solve a system of linear equations!  For QM0 exam the students may have to compute 3x3 determinant, so they need to know a formula for it...I would go with the Co-factor expansion...

Leibnitz's Rule: This is a cut I think...should be covered in detail by lecturer on Ramsey model in Macroeconomics I...

Integration with Several Variables: Move towards the beginning...this is very straightforward and should probably be talked about right after partial differentiation...

Homogeneous and Homothetic Functions: This is a cut.  Not because it isn't important...it is very important (implications of CRTS and such) but I think that the lecturer should cover these topics in class during term.  There is already too much material in the QM0 lecturers and this would allow for more detailed coverage of other topics...

Linear Dynamic System: If we want to keep this material in course, then we need to do a much better job of teaching eigenvalues, eigenvectors, and matrix diagonalization techniques.  Would recommend moving Appendix on eigenvalues, and eigenvectors into the lecture notes and teaching students how to reach the general solution of a linear dynamic system properly...

Introductory Maths and Stats: Single Variable Calculus...

As a first year Phd student I will be teaching introductory maths and stats to the MSc students this year. I am going through the lecture notes and making little notes for myself about things that I think should be emphasized (or de-emphaszied) in the turorials as well as some little tricks that I have picked up along the way that should be helpful for the incoming MSc students.  The following are my notes to myself on single variable calculus...

Rules of Differentiation: The derivtive is a linear operator.  Mathematically this means that d/dx(f(x) + g(x))=d(f(x)) + d(g(x)) and d/dx(t*f(x))=t*d/dx(f(x)).  In words this means that the derivative of any linear combination of well-behaved functions is equal to the same linear combination of the derivatives of the individual functions.  Note that if you remember that the derivative is a linear operator then you automatically know how to take derivatives of sums and differences of functions.

Other Rules I remember:
  1. Constant: The derivative of a constant is always zero.
  2. Powers: If f(x)=x^k, then df(x)/dx=kx^(k-1)
  3. The Chain Rule: NEVER forget the chain rule! d/dx(f(g(x)))=df/dg*dg/dx.  Most simple mistakes in taking a derivative come from forgetting about the chain rule.
  4. Derivative of the exponential and the natural logarithm functions: Easy...d/dx(e^x)=e^x (this result is one of the reasons that exponential functions turn up so often in the general solutions to differential equations), and d/dx(ln(x)=1/x.  Maybe review some basic properties of logarithms and exponentials...
  5. Product Rule: d/dx(f(x)*g(x))=d/dx(f(x))*g(x) + f(x)*d/dx(g(x))
Rules I never remember:
  1. Quotient Rule: Why? Because the quotient rule is simply an application of the product rule and the chain rule.
  2. Rule for d/dx(a^x): Why? Because it is better to just take natural logarithms and the differentiate.  For example, if f(x)=a^x then ln(f(x))=ln(a^x) and because I know the my properties of logarithms, the rule for taking d/dx(ln(x)) and the chain rule this becomes d/dx(ln(f(x))=[1/f(x)]*d/dx(f(x))=d/dx(ln(a^x))=ln(a) and finally d/dx(f(x))=ln(a)*a^x
l'Hopital's Rule: Unbelievably useful for taking limits.  Basically if you are ever in the case where the lim of two functions turns out to be 0/0 or inf/inf, then take deriviates of the top and bottom and take limits again...

At this point the lecture notes have a discussion of 1st order differential equations that is out of place.  These equations have not been covered yet in the notes, and even though this discussion is brief it detracts from more important material.  Lecture notes also have a long digression on stock returns, capital gains, and dividends.  This is an important economic application of the material being taught, but should be covered by tutors in the QM0 tutorials where it can be gone over at a slower pace...

Optimization: Recall geometric interpretation of derivative: the value of a derivative at a given point tells you whether the function is increasing of decreasing at the point:
  • If df/dx>0, then the function is increasing
  • If df/dx<0, then the function is decreasing
  • If df/dx=0, then f has a critical point
At this point I like to draw pictures to help me remember that d^2f(x)/dx^2>0 (<0) implies that the function is convex (concave). Which leads to the corresponding definitions of maximums and minimums of functions.  I like to point out the main ideas both graphically and in terms of the FOC and SOC on derivatives.

Taylor Expansions: Important topic that the lecturer should spend more time laying out the details.  Re-empahsis should be placed on the Taylor Expansion in the tutorials.

Concavity/Convexity and Quasi-concavity/Quasi-convexity of Functions: I never remember the  derivative or algebraic definitions for these terms.  Best to draw pictures!  Three functions to remember f=x^2 (convex), f=ln(x) (concave), and f=x^3 (quasi-convex and quasi-concave)

Rules of Integration: Emphasize the area under the curve interpretation of an integral.  The rules for integration are easy IF you know your rules for differentiation.  The two processes work in reverse.  When taking an integral of f(x), think what function would I need to take the derivative of the get the function f(x).  Don't forget about the arbitrary constant!

Sunday, September 12, 2010

Online Lecture Series on Differential Equations...

MIT OCW saves the day again!  A whole course on solving ODE's from MIT's Arthur Mattuck...

Saturday, September 11, 2010

Another Brilliant Linear Algebra Lecture...

Prof. Gilbert Strang at MIT delivers a beautiful lecture on how to solve systems of first order differential equations using linear algebra...an absolute must for anyone studying graduate economics...

Thursday, August 26, 2010

First Section of Lecture Notes on Geometry of Linear Regression...

This is my first cut of lecture notes on the Geometry of Linear Regression...FYI the b and beta are the same...having html issues.  Hopefully I have not made any egregious errors...

The Geometry of Linear Regression

Suppose we have the following system of equations:

y=Xb

Here the dependent variable y is a vector of length m, X is our (m x n) matrix (i.e., m rows and n columns, typically m>n) of independent variables, b is a vector of coefficients of length n.  Why are we going to start by talking about the geometry of solutions to systems of linear equations? Well, because at a fundamental level linear regression is really all about "solving" a system of linear equations when there is no true solution.  Linear regression finds a solution b to our system of equations that is the "best" because it is "closest" in a very specific way to the vector y.

Now our system of m equations with n unknowns (the n coefficients which comprise the vector b) tells us that the vector y (our dependent variable) is a linear combination of the columns of X (our independent variables)….

y= b1x1 + b2x2  + … + bnxn

Here xi i=1,…n are the column vectors of length m that make up the matrix X.  This means that the vector y is in the column space, col(X), of our matrix X. In pictures with 2 independent variables…notice that the our independent variable, the vector y, lies in the plane corresponding to the col(X)

Remember from its definition that the col(X) is the vector space spanned by the column vectors of X, which is simply a fancy way of saying that the col(X) includes all linear combinations of the column vectors of  X (which includes y at this point).  If the column vectors, our dependent variables, also happen to be linearly independent of one another then our column vectors form a basis for the col(X).  Normally this will be the case…but it is crucial that our set of dependent variables be independent of one another!  

If we have nice case: X is an (m x n) matrix with m>n and that our columns of X, which span the col(X) by definition, are linearly independent of one another and thus also form a basis for the col(X).  This implies that the rank of X (which as you will remember is simply the number of linearly independent columns of X) and the dimension of col(X) (which is simply the number of vectors needed to form the basis of col(X)) are both equal to n.  Our matrix has full column rank! We are off to a good start…

Let’s Talk About Correlation…
Geometrically, correlation between two variables (which we are representing as vectors) is related to the angle between two variables/vectors via the following formula…


Cosine! Theta! Dot products and Euclidian Norms! Boo! Let’s draw pictures…In this first picture our two independent variables are positively (negatively) correlated because the angle between their two corresponding vectors in the col(X) is acute (obtuse).  I draw the positively correlated case below… 





In this second picture, the two vectors are at right angles with one another and are therefore uncorrelated.  This is an extremely important case…when you are learn about OLS, IV and GLS the question of whether or not your error term is uncorrelated with your explanatory (i.e., independent) variables will come up again and again…remember, geometrically, uncorrelated mean vectors at right angles!


Finally what does it look like if the two vectors are perfectly positively (negatively) correlated with one another?  Although I will leave it up to you to draw your own picture, for the perfectly positively correlated case look at the picture of the acute case and think about what happens as the angle gets really, really small.  Once you figure that out and get your picture, the perfectly negatively correlated case is simply the 180-degree (hint) opposite…

To be continued in the near future with a simple linear model y=Xb + e!

Tuesday, August 24, 2010

Watching More Linear Algebra Lectures...

In the original link I sent out with the 35 MIT lectures on Linear Algebra, lecture 8 on Solving Ax=b and the Row Reduced Form R is corrupted.  You can find the whole (or at least most of the series) on Google Video.  Here is a working link to for lecture 8...

Monday, August 23, 2010

A Visual Approach to OLS...

As I am prepping for my teaching requirements for the upcoming year, I have been thinking about employing a more visual/geometric approach to OLS.  I remember sitting in a lecture on GMM where the professor was talking about projection matrices and all of the sudden something just clicked.  I recall thinking: "Wow, the different versions of regression analysis (i.e., OLS, GLS, IV, etc) can be thought of as projections of the dependent variable (y) onto the column space spanned by the regressors (Xs)."  When you multiply the vector y by the projection matrix P = X(X′X)−1X′ you project the vector y onto the space spanned by the columns of X and the result is shown in the diagram below.
The matrix Xβ is simply a linear combination of the columns of X (i.e., a linear 
combination of the regressors) and as such lies in the column space of X.  The idea 
behind OLS is to then simply choose the right β so that the linear combination will 
minimize the distance between the vector y and its projection in the column space of X.
Additionally it is straightforward to extend this framework to talk about issues related
to correlation between regressors, errors, etc.



I would like to emphasize this projection interpretation to my introductory statistics and econometrics students.  Although this approach does use some basic jargon borrowed from linear algebra (most of which they are already required to know)...I think/hope that it will be more intuitive for the students. 

Cobb-Douglas Applet...

Useful JAVA applet that helps visualize Cobb-Douglas production function in 3-D.   Would be useful for students trying to understand the relationship between increasing, decreasing, or constant returns to scale, and the shape of marginal returns...

Sunday, August 22, 2010

Watching Linear Algebra Lectures...

I was watching MIT Linear Algebra lectures 3-Multiplication and Inverses, and 4-Factorization into A=LU and 10 minutes into lecture 4...the tape quit!  Damn!  Factoring a matrix A into the product of a lower triangular matrix L and an upper triangular matrix U is a pretty useful thing to know how to do.  It makes calculating things like trace, determinants, and inverses of A really easy...

Alas...it is a good thing that I already new how to do the factorization...but here is a link to the video lecture that will work...the link takes you to a series of written notes based on the MIT lecture series which is also quite useful...

Friday, August 20, 2010

Teach Yourself Linear Algebra in a Day and a Half...

35 lectures on linear algebra from MIT Professor Gilbert Strang.  Start with "The Geometry of Linear Equations" and end with "Final Course Review."  I am on lecture two: "Elimination with Matrices."  I had two course on linear algebra as an undergrad and the subject played a starring role in my MSc.  I am prepping for TAing Quantitative Methods courses this year, and I am finding these lectures to be a nice refresh...