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)

Tuesday, June 28, 2011

Masada...

Thought I would finally get around to sharing some of my photos from my trip to Masada.  The geology and hydrology of Masada is almost as impressive as the history of the events that have transpired in this seemingly desolate place.  Upon arrival all guests are required to view a weirdly dubbed (and very nationalistic) video about the Roman siege of Masada during the first century A.D. and the subsequent mass suicide of the Jewish rebels occupying the fortress.   After the video, which lasted about ten minutes, we exited to the platform to catch the cable car ride to the top of the cliff.  I had hoped to hike up the cliff on foot, but time constraint was binding, which prevented anyone from attempting.

A nice shot of the cliffs behind Masada. The ruins in the middle left of the photo are the Roman fortifications left by the Legions almost 2000 years ago.
Some of the ruins on Masada itself...and a bird...
  A nice shot of some of the geology of the plains below the cliff (shot from the Northern Palace):
The sun was blazing hot all day.  Fortunately, I had purchased a Jordanian Keffiyeh at the Souk in Jerusalem the day before.  I soaked my Keffiyeh with roughly a liter and a half of water, which helped fend off the sun.  A very practical piece of kit, this Keffiyeh.
In hindsight I feel like my photos do not do a good job of capturing the immensity of Masada.  I will have to ask around to see if any of my colleagues took better photos...

Sunday, June 26, 2011

The Dead Sea...

Some photos from trip to the Dead Sea.  On the walk to the beach I passed the world's lowest meteorological station at 418 m (1,371 ft) below sea level.  The Dead Sea is rapidly shrinking due to overuse of the river systems that feed into it by the Israelis and the Jordanians.  In the picture you can see the water level mark from 2004 and in the distance you can see the water level today!
Floating in the Dead Sea is probably the closest thing to zero gravity that I will ever experience. Wallowing in the mud baths was a new experience for me as well...
A shot of the hills overlooking the Dead Sea.
 More to photos to follow from my trip to Masada...

Thursday, June 23, 2011

More Photos from the Old City...

Just got back from our official tour to the Old City (which was my third trip overall).  While it is an amazing place, at times the city feels like it has a permanent facade.  There is a bit of smoke and mirrors quality to this place.  What you see is not what you get in Jerusalem...

Some of my favorite photos from the tour are of the Dome of the Rock and al-Aqsa Mosques
After the tour, some friends and I stayed in the Old City until almost midnight walking around and enjoying the festival (there was a festival of lights in Jerusalem this week which we just found out about!).  Some of the churches were lit with complex geometric light patterns...
More posts to come...maybe a post on something economics related (given that I am here to attend an economics conference!)

Monday, June 20, 2011

First trip to the Old City...

After checking into the hotel, I made my way via bus to the Damascus Gate on the North side of the Old City of Jerusalem.
Crossing through the gate was a bit like traveling back in time.  Once you cross inside the walls, the city becomes eerily quiet (despite the fact that entering the city through the Damascus gate dumps you straight into the middle of the Souk).
It is incredibly easy to get lost in Jerusalem.  There seem to be very few good maps of the city.  This isn't terribly surprising given the way each layer of the city builds up and around the previous layers.  It is the closest thing the wandering through an actual maze that I have ever experienced.  I wandered around the Souk for over an our trying to find a way through to the temple mount and ended up crossing over my path at least three times!
Surprisingly, despite wandering through the Souk for several hours, I managed to not buy anything except a new set of chess pieces. 
I spotted a couple of nice looking antique Bedouin coffee sets, but I need to do a bit more research (and practice my haggling skills before attempting such a serious purchase).  More blog posts to come tomorrow...it has been a long day of lectures and I need to get a bite to eat and get cleaned up for dinner.

The view from my hotel window...

Not the view I was hoping for...
The view I was hoping for (I was actually hoping for a better view of the Dome of the Rock but what are you going to do...)

The Jaffa flea market...

Have been remiss on my posting.  Apologies to those following along, but the internet connectivity is not great in the hotel.  A few posts to catch everyone up...

Before leaving Old Jaffa for the trip to Jerusalem, I stopped by the flea market to do a bit of shopping...
 The flea market is enormous.  The entire market, including both the indoor and outdoor portions, encompasses 3 full city blocks.  If you are interested in antiquing you could easily spend an entire week browsing for a good find!
I came away with some really nice traditional Bedouin gifts (I will refrain from saying exactly what I bought as they are a surprise for a certain someone...)

Sunday, June 19, 2011

My last sunset in Old Jaffa...

On to Jerusalem...

The Beach...

So, I thought I was going to write a post about the beaches in Tel Aviv and post some photos...but I didn't see any worth taking.  The beaches here are crowded and dirty.  The water is dirty and full of garbage and jellyfish.  Definitely not a beach worth visiting...

Saturday, June 18, 2011

Shabbat in Jaffa...

The hustle and bustle slow considerably in Jaffa on Shabbat.  I headed up the hill to St. Peter's Church above the old port to take in the sunset and take some photos.  The church, which was built in 1654, was home to Napoleon Bonaparte in 1799 during his military adventures Egypt and Syria.  A view of St. Peter's from the main courtyard...
The view from the large park just next to St. Peter's (definitely the best place to photograph the modern Tel Aviv skyline).
 There are at least three mosques in Jaffa, the smallest of which is down by the port.  Around sunset, just before the call to prayer, the lights inside the minaret turned green casting an eerie glow, that contrasted sharply with the reds, oranges, and purples of the dying sun...
A good evening all around.  Tomorrow the beach...

Friday, June 17, 2011

Demand slopes UP...Supply slopes DOWN!

This post is a continuation of a previous post on liquidity and leverage (both posts closely follow the analysis of Adrian and Shin (2008)).

First, a quick summary of previous post.  There is a negative relationship between growth in balance sheets (value of assets) and leverage for passive investors such as households.  All data is taken from the U.S. Flow of Funds accounts maintained by the Federal Reserve.
However there is a positive relationship between growth in balance sheets (asset values) and leverage for security brokers and dealers (i.e., investment banks).  For this group, at least, leverage is pro-cyclical.
Continuing with the implications of pro-cyclical leverage.  Back to basic balance sheet arguments.  Consider a firm that actively manages it's balance sheet in order to maintain a constant leverage ratio of 10:1.  Start with the following balance sheet:

AssetsLiabilities
100Equity: 10

Debt: 90

Again assume that the value of debt is constant in response to change in asset values (which seems reasonable for small changes in assets values).  Now suppose that the value of assets increase by 1% to 101.  The new balance sheet is as follows (note that equity has increased by 10% as a result of the 1% rise in asset prices).

AssetsLiabilities
101Equity: 11

Debt: 90

The leverage ratio is now 101 / 11 = 9.18.  If the firm wants to maintain a leverage ratio of 10, it must take on more debt and use the cash it borrows to buy more assets.  How much debt?  Firm requires that 101 + D / 11 = 10, which implies that D=9.  Thus an increase in the value of assets of 1 leads to an increase in the quantity demanded of assets by the firm worth 9.  Price of asset goes up, quantity demanded of the asset by firm goes up.  The demand curve for assets slopes up!  The firm's new balance sheet now has a leverage ratio of 10.

AssetsLiabilities
110Equity: 11

Debt: 90

Same type of mechanism is at play for negative shocks to asset prices.  Doing the math leads to the conclusion that for a firm actively managing its balance sheet to maintain a constant leverage ratio, the supply curve for assets slopes down.  Note that just as equity increases as asset prices increase, equity bears the burden of adjustment when asset prices are falling.

This mechanical adjustment process of leverage will be strengthened if either:
  1. Leverage is pro-cyclical
  2. Asset markets are not completely liquid
If asset markets are not completely liquid, then the asset price will be affected by the change in the firm's demand for assets following an, asset price shock.  Consider a negative asset price shock.  The negative shock to asset prices leads, through the mechanism above, to the firm to sell assets in order to maintain the desired leverage ratio.  If markets are not perfectly liquid, then the firm's decision to sell assets will further decrease the price of these assets, which then weakens the firm's balance sheet even more, which causes the firm to sell more assets, and so the cycle goes.

Adrian and Shin (2008) outline empirical evidence consistent with the above amplification story.  Specifically they demonstrate that firm's balance sheet components are able to forecast changes in asset price volatility.  I am working to replicate their results (as they are highly relevant to my own empirical work on leverage and asset price volatility) and will follow up with the R code of the replication as soon written (hopefully in the near future!)...

Shouk HaKarmel...

As one would expect, the Shouk HaKarmel is a very busy place...
James and I stopped for (more like pulled into) lunch at a random house/stall where a woman was selling sauteed chicken bits, mixed with onions and vegetables, with hummus and pita bread...
Note the old man sitting next to me falling asleep in the chair...
Am now well provisioned: pita, an assortment of swarma meats, salad, mangoes, dates, olives, random smoked deli meats...back to the hostel...

Shabbat means grilling out...

It being Friday, most shops close down at sunset for Shabbat and remain closed until Saturday evening.  James and I are going to cook at the hostel tonight.  The Old Jaffa Hostel has such an excellent rooftop terrace garden with a kitchen that I think I will cook for myself this evening...
Headed off to the Shouk HaKarmel for provisions...and then beach...

Breakfast at Dr. Shakshuka's...

James and I had an amazing breakfast at Dr. Shakshuka's this morning.  The good doctor is generally acknowledged to make the best shakshuka in all of Tel Aviv.  For those unfamiliar, Shakshuka is a north African omelet-esque, tomato, and grilled vegetable dish which has become a popular breakfast dish throughout Israel.  Preparation varies, but Dr. Shakshuka's serves his shakshuka with as much salad, bread, and lemonade as you can eat and drink...and finished the meal off with Turkish coffee and sweetbreads.
 

Thursday, June 16, 2011

Sunset in Jaffa...

Just enjoyed a couple of beers at a place that literally did not have a name (I asked!) down on the beach...note the pirate flag...
The view of old Jaffa from my table...
The evening call to prayer just echoed across the city...ambiance in Jaffa is really something.

Old Jaffa is very different from the only other part of Tel Aviv that I have seen: the section in and around the new central train station.  When I arrived from the airport,  I caught a taxi from the new central train station to the hostel.  According to my taxi driver (a 63-year old Indian Jew from Calcutta who immigrated to Israel in 1948), the area around the central train station is very run down due to large influx of predominately poor African immigrants and guest workers.  He recommended that I spend most of my time in Old Jaffa (because, according to him, it has real character).

I end with a shot of the modern Tel Aviv skyline...alas I think I will be following the taxi driver's advice and steering clear of downtown Tel Aviv.
 

Leverage and Balance Sheets...

Killing time at JFK International waiting to board my flight to Paris.  I recently came across a brilliant and simple discussion of the relationship between leverage and the size of balance sheets in Adrian and Shin (2008) and had to share...

Suppose that a household owns a house that is financed via a mortgage.  Suppose that the house has a value of 100, and that the value of the mortgage is 90 (thus household net-worth, or equity, is 100 - 90 = 10).  This household has the following balance sheet:

Assets Liabilities
100 Equity: 10
Debt: 90

What is this household's leverage ratio? Leverage (L) is defined as the ratio of the value of total assets (A) and the value of equity (E).  In this case the household has a leverage ratio of 100:10 or 10:1.  What happens to the household's leverage ratio as the value of the house (its asset) fluctuates?  For simplicity assume that the value of debt stays fixed for small changes is asset prices.  Then leverage is roughly...

L ≈ A / (A - 90)

So as the value of the house (i.e., assets) rises, with the value of debt fixed, household net worth increases and the leverage goes down!  Leverage varies inversely with the value of total assets.  This inverse relationship is exactly what is born out in the data.  To calculate leverage, I use the ratio of household total assets and household net worth from the quarterly  U.S. Flow of Funds data for the years 1963 - 2011. 

There is a clear negative relationship between changes in leverage and changes in household assets.

Now instead of household balance sheets, let's consider firm balance sheets.  Specifically, based on data availability, consider three classes of firms:
  1. Non-financial (non-farm) firms
  2. Commercial banks
  3. Security brokers and dealers (includes investment banks)
If, like households, firms where fairly passive in their balance sheet management, then we should see a nice negative relationship between firms' asset values and leverage...however (not surprisingly) the data indicate that firms are a bit more active in managing their balance sheets than households.  As with households, all firm data is quarterly, and is taken from the U.S. Flow of Funds accounts maintained by the Federal Reserve.

Non-Financial (Non-Farm) Firms: I take the data from the U.S. flow of funds What is going on here? Certainly the clear negative relationship from the household scatter  is gone.  You can kind of begin to see clustering around zero growth in leverage (suggestive of firms actively managing balance sheets to maintain a fixed leverage ratio?)
Commercial Banks: The clustering phenomenon is now very apparent and consistent with the fact that commercial banks actively manage their balance sheets in order to maintain a fixed leverage ratio.
Security Brokers and Dealers: Now the relationship between leverage and assets is positive! This means that for security brokers and dealers (a group which includes all major Wall Street investment banks) leverage is pro-cyclical.

How can this be? What are the implications of pro-cyclical leverage?  I leave this as a topic for a future post...alternatively you can read Adrian and Shin (2008).

Arrived in Old Jaffa...

The view from the rooftop of my hostel in the old city of Jaffa...
...it is nice to be settled after a long journey.  Another terribly experience connecting through JFK...will avoid like the plague in the future.  Also, in the future, I will be doubly sure to check that when I book a trans-Atlantic ticket with Air France, that I actually fly Air France (and not an Air France flight managed by Delta!).  These two seeming similar travel experiences are not even remotely comparable...

Tuesday, June 14, 2011

Heading to Jerusalem...

I depart tomorrow for the 22nd Summer School in Economic Theory in Jerusalem on the Global Financial Crisis...

Amongst other things, I plan to follow up with Prof. Geanakoplos regarding his paper "Leverage Causes Fat Tails and Clustered Volatility." Blogging will be either sporadic, or prolific depending on wireless connectivity...

Wednesday, June 8, 2011

More on Smoothing Splines...

Chalk yesterday's post up as a learning experience...following a very helpful comment left on yesterday's blog post, I made two changes to my code:
  1. I am now calculate the confidence bands by bootstrapping the residuals (instead of the data points themselves).  The confidence bands yesterday were huge.  The reason why the confidence bands were so wide was because the bootstrap method I implemented scrambled the dataset during each iteration, which destroyed the time series nature of the underlying data.  Bootstrapping over the smoothing spline's residuals should preserve the times series nature of the data (which should narrow the confidence bands considerably). 
  2. I am now using generalized cross validation (GCV) to pick the penalty for the curvature( for those following at home that is setting cv=FALSE using the function smooth.spline().
Here are the relevant plots using daily, weekly, and monthly returns:

Daily Returns:
Weekly Returns:
Monthly Returns:
Both the daily and monthly plots exhibit significant asymmetry between the left and right tails of the data.  Although I still wonder about the sensitivity of the results to certain outliers (particularly with the daily data).  Recall the EMH implies that returns should follow random walk with a drift, and the red-dotted line represents the EMH null prediction (ignoring the drift...feel free to mentally shift the dotted-red line up or down as you see fit). 

My (not very enlightening) interpretation of the above plots is that EMH works pretty well for the "body" of the data (all three plots are roughly "flat" where most of the data lies), but there is something fundamentally different governing the dynamics for large returns (and that whatever is governing the dynamics must effect large negative returns differently than large positive returns).  Note that the robust asymmetry is much harder (maybe impossible) to detect using a linear model. 

Tuesday, June 7, 2011

Today's Distraction...

For the past month or so I have been working my way through Cosma Shalizi's excellent course on data analysis.  Today I distracted myself from my own research by playing with Smoothing Splines (Cosma's Lecture 11).  Everything below was done in R.

First, I grabbed some historical data for the S&P 500 from Yahoo finance using the get.hist.quote() function from the tseries library.  I pulled down daily, weekly, and monthly data starting on 3 January 1950 and ending 31 Dec 2010 (start and end dates are for daily data).  I then constructed S&P 500 returns by taking the first-difference of the logarithm of the S&P 500 Adjusted Closing Price.   Here are (probably familiar) time series plots of the daily returns and a density plot...
Note that stock returns exhibit clustered volatility and are negatively skewed with significantly heavier tails than one would expect if returns were Gaussian.  On a side note (related to my current research), a couple of years ago some researchers at the Santa Fe Institute (specifically Stefan Thurner, J. Farmer, and John Geanakoplos) published a paper titled "Leverage Causes Fat Tails and Clustered Volatility."  Their model also predicts that returns should be negatively skewed (a point I think they should have included in the title).

Back to learning about splines! Is today's S&P 500 return useful in predicting tomorrow's S&P 500 return?  For the null hypothesis, I take a strongish form of the Efficient Market Hypothesis (EMH):
  • Ho: Stock prices follow a random walk with a drift (i.e., returns should be mean zero white noise)
For alternative hypotheses, I use a brutally simple parametric model, and then what ever functional form the smoothing spline finds
  • HA,1: rt+1 = β0 + β1 rt + εt
  • HA,2: Whatever the smoothing spline kicks out
To test the null against the parametric alternative, we simply need to test the joint restriction that β0=β1=0.  Presumably to test the smoothing spline, we need to calculate some 95% confidence bands for the fitted spline and then look to see if the confidence bands contain the curve (really a line) predicted by the null hypothesis.  This is my first time using splines, so if anyone out there knows whether a better way (or a book) about how to do hypothesis testing with smoothing splines, I would be interested in hearing from you.

Here is a scatter plot of tomorrow's return against today's return.  I fit a simple linear regression to the data and plotted the curve in gray.  While both the slope and intercept terms are very significant (p-values essentially zero for both), it is worth noting that the standard confidence intervals are not valid (much too narrow) given the blatant violation of Gauss-Markov assumptions for the regression.  More work needs to be done before we can take this as evidence against the EMH null (since this post is about smoothing splines I am going to simply state that I would be surprised if, after calculating appropriate standard errors (either using bootstrapping, or some type of heteroskedastic robust standard errors, etc), the parameter results were still significant...but maybe!)

The smoothing spline is in orange.  I used the smooth.spline() function in R to fit the spline (using leave-one-out cross-validation to pick the optimal penalty for the curvature).  
If stock prices reflect all relevant information about the value of the stock, then one would expect that today's return should be pretty useless in predicting tomorrow's return (thus under the null the true regression line should be the dotted red line in the above scatter).

But what about the smoothing spline?  A few things:
  1. While the regression line is positively sloped, the smoothing spline is negatively sloped for larger negative and large  positive values of today's return.
  2. The asymmetry.  The slope of the smoothing spline is more negative for large negative values of today's return (compared with the slope of the smoothing spline for large positive values of today's return).
  3. Outliers:  The October 1987 stock market crash looms large in the data. How sensitive is the estimated smoothing spline to these 1-2 observations?
  4. Is the asymmetry of the smoothing spline a statistical artifact?
  5. Most importantly, despite the dramatic appearance, is the smoothing spline significantly different than the dotted red line?
I am going to focus on point 5 for the rest of the post.  I calculated 95% confidence bands for the smoothing spline using a bootstrap re-sampling of the data points.  Basically, I re-sampled (with replacement) the stock return data creating a new synthetic data set, fit a smoothing spline to this new data set, and then repeated the process a bunch of times to build up a distribution that I could use to create the confidence bands.
For the most part, the dotted-red line lies entirely within the 95% confidence band for the smoothing spline (if you squint you can kind of see a small portion of the dotted-red line that lies outside the bands).  So despite the dramatic appearance of the smoothing spline I would say that we can not statistically distinguish it from the dotted-red line.

I was curious to see what the above plot might look like if I used weekly and monthly S&P 500 returns instead of daily returns...

Weekly Returns:


Monthly Returns:

I was surprised at how different the daily, weekly, and monthly smoothing splines turned out to be...still in all three cases the 95% confidence bands for the smoothing spline contain (almost completely) the red-dotted line.  I will have a think as to why they are so different, and perhaps follow up with another post.  My R code will be posted as soon as I have time to get my Google Code page up and running...until then feel free to email me (or leave email in a comment) and I will send it to you.

Update: As pointed out in a comment below, EMH predicts stock returns should follow a random walk with a drift...which implies that the dotted-red line doesn't necessarily need to have a zero intercept.  One would hope that the drift is slightly positive!