Monday, March 18, 2019

Drawing economic models on macOS with GraphSketcher (using free open source software!)

I didn't think blogging about university assignments from yesteryear would be popular; to use economic parlance, I thought the demand curve for my posts would be as flat as sales of Windows Phones. When I wrote my blog series about chess data structures in ANSI C89, I didn't think anyone would read it voluntarily, but my posts seem to have found a niche audience of CS students who have chess simulator assignments due the next day.

Today I've decided to write about economics. Anything economics posts I write should be timeless, because none of the questions or answers have changed in last 129 years since Alfred Marshall's Principles of Economics.

Marshall's Principles of Economics (1890).
Amazon did not exist in the year 1890 so students
had to purchase over-priced textbooks in person.

If you're an economics student, you're going to have to draw a lot of models. If you have a Mac, there's only one tool you need for drawing models: GraphSketcher. This is a free and open source tool that was originally designed by The Omni Group (the team behind OmniGraffle or "not quite Visio for Mac").

Download: GraphSketcher for Mac

Here are some tips for High Distinction success.
  • Don't use the graphing function in Microsoft Excel. You'll spend too much time trying to create the "correct" source data to generate curves, and you've only got till morning to submit your assignment.
  • Don't use Photoshop. You'll spend too much time messing around with layers, and trying to crack Photoshop.
  • Label your axis. Specify the unit of measurement too, e.g. Private spending ($ billions)
  • Work out the order of magnitude required to illustrate your point. In macroeconomics, the quantity of money at which you want to analyse curves is "large". You're not going to be able to analyse changes of private spending vs. real GDP at $500,000 to $600,000: you'll typically be working at the magnitude of hundreds of billions of dollars. Leave the microscopic $2 MR=MC magnitudes to microeconomics. Before you start drawing, calculate the order of magnitude that can illustrate your point, then figure out the quantities you need.
  • Use big dots and letters to draw attention to "before and after". Tell the story with your model. In the first example below, A is the normal level of private spending/real GDP. B is what happens when we private spending is reduced, and C is what happens when it's increased.
  • Use arrows to explainn the story. The lecturer/TA marking your assignment is a busy person: they are trying to trying to test whether you and 250 other students understand a particular economic model. They will spend one second looking at your graph to judge your knowledge. If private spending goes up, does this student have the first clue about what happens to real GDP? You may know the answer, but can you demonstrate this using only a graph? In the example below, it's clear that when (C+I)0 shifts upward to (C+I)2, this intersects GDP curve at a higher level. We indicate this with arrows that tell the story for us: an upward arrow for the (C+I) curve shift, and a right arrow for the real GDP shift.
  • Put a zero on your graph. No zero? One mark deducted!
I've uploaded some of my old macro graphs to get you started.
  • Aggregate expenditure/output approach [download]
  • Consumption Schedule graph [download]
  • Investment demand curve with shifts graph [download]
  • Investment demand curve graph [download]
  • Net Exports schedule graph [download]
  • Increases in price level graph [download]
  • Inflationary gap graph [download]
  • Built-in stability graph [download]

Aggregate expenditure/Output approach [download]
Consumption Schedule graph [download]
Investment demand curve with shifts graph [download]
Investment demand curve graph [download]
Net Exports schedule graph [download]
Increases in price level graph [download]
Inflationary gap graph [download]
Built-in stability graph [download]

Tuesday, January 16, 2018

Paul's opinionated travel tips for Japan - is the JR Pass worth it?

tl:dr; if you're visiting 2+ cities, yes!

This post is for friends who've asked for Japan travel tips. If you want objective travel advice, a tourism website or YouTube channel is probably better. These are the travel tips that worked for me.

You'll use trains to go everywhere.

Trains are the dominant form of transport in Japan and have a special place in Japanese culture: if you ask a Japanese resident where they live, chances are they'll answer relative to the nearest train station. The Japanese weather channel shows nice relaxing videos of mountains, fields and bullet trains passing Mount Fuji. The Japanese are proud of their trains and rail network for good reason: they're the best in the world! They're punctual, clean, comfortable, convenient and safe: this makes them different to countries where you’re continuously evaluating whether driving/Uber is cheaper than a public transport (if it's available) or whether you'll be mugged. If you want to visit another city, forget the hassle of airports and airlines: the “Shinkansen” high-speed bullet train system is the cheapest and most convenient way of getting there.

Determine whether you want an unlimited JR (Japan Rail) pass, or whether you want to buy individual rail tickets.

As a tourist, you’re eligible to purchase the tourist-only JR Pass that allows you unlimited travel on most trains (including Shinkansen bullet trains, and the Narita Airport-Tokyo “NEX” service) on the JR rail network. There are gaps in the JR Pass coverage (notably the Nozomi and Hikaru-class Shinkansen) but these won't affect your travel as a tourist.

The alternative to the JR Pass is to purchase individual tickets which may be cheaper or more expensive depending on your itinerary. While local rail network travel is cheap (usually ¥140-160), inter-city Shinkansen travel is an order of magnitude more expensive: Tokyo to Kyoto is around ¥ 13000. The unlimited Shinkansen travel is the real value of the JR Pass is, not the local rail.

Advertisement for the N700-series Shinkansen.
It's fast.

The cost benefit of the JR pass is basically the à la carte vs. buffet problem: is your travel frequent and structured enough to make it worthwhile? Generally speaking, if you’re visiting multiple cities, the JR Pass is cheaper. If you’re going to stay in one city, the JR Pass is not worth it.  If you’re a first time visitor to Japan who intends to visit multiple cities, there’s peace of mind and simplicity in buying the JR Pass. If you're a cheapskate, open your pirated version of Microsoft Excel or OpenOffice Calc and do a cost benefit analysis.

Is it worth paying extra for the Shinkansen Green Class?

No. The leather armrests and chairs in Green Class aren't worth the premium.

Which JR Pass duration is right for me, and when should I activate it?

The JR Pass can be purchased for 7, 14 or 21 days. The pass becomes valid when you visit a JR booking office and activate your "JR Pass Exchange Order". You don’t need to activate he pass on day 1 unless you want to use the Narita Airport-Tokyo NEX train (around ¥3000). You should consider delaying activation if your inter-city travel starts several days after you arrive.

The typical 10-14 day tourist itinerary starts at Narita Airport, spends 7 days in Tokyo, then visits other cities. In this case, it makes sense to get a 7 day JR pass (instead of 14 day) and activate it on the day that the inter-city travel begins.

I reside in Australia: where do I buy a JR Pass?

In the past, you could only buy a JR Pass outside of Japan. I've heard that it's now possible to buy a JR Pass within Japan, but navigating a JR booking office is the last thing you want to be doing on holiday. Make your life easy: buy the pass outside of Japan.

The best Australian JR Pass sales agent in my experience has been JTB Travel (I don’t get any commission!). I’ve used them three times and they delivered consistently each time. For reference, here are the prices for JTB, H.I.S. Travel and

Price for JTB

Price for H.I.S. Travel

Price for

As you can see, the prices are within $7-10 depending on duration. If you trust H.I.S. Travel or, book with them. Regardless of who you buy it from, they will not give you the actual JR Pass: you’ll be provided an Exchange Order which looks like a cheque book. Don’t lose this! When you want to activate your JR Pass, take the Exchange Order to the JR booking office.

What do I do to use a Shinkansen?

To board a Shinkansen, you’ll need to book a ticket at your local JR booking office. The first time I travelled to Japan, I booked all my Shinkansen tickets a few hours before departure without issue. There is nearly always capacity so you don’t need to worry about booking too early. Unless you're booking around NYE, cherry blossom season, or another regional holiday, booking the day before is fine.

Beware cherry blossom season.
Hotel availability will drop to zero! Book in advance.

Should I use buses?

Don’t bother with buses unless it’s a specialty bus to somewhere special like a theme park (Fuji-Q Highland). If you're going to Fuji-Q, take the bus from Shinjuku station.

Should I use taxis?

Avoid them where possible due to price. Taxis are expensive; ¥350 per km, 20% extra after 10 PM, and their English isn't great. On the upside, Japanese taxis are clean, safe and driven by professionals. If you're going to have a late night out, pick up a copy of your hotel's business card so you can give it to your taxi driver. I've noticed that the taxi GPS systems can covert hotel phone numbers into the address: clever!

Friday, September 8, 2017

IT architecture and the environment: you, yes, you can make a difference.

Every cloud and IT architect can make a difference to the environment. We don't need to wait for feel good news about a solar or hydro project. There's a quantifiable cut in energy consumption when you select the correct CPU, design an hot aisle correctly, cache results closer to the requester, or optimise a query.

How much power has been saved by VDI/thin clients? We need to improve our communication skills: while a hydro plant/wind farm is noticeable ("looks big, must be good!"), the nature of our work makes it's difficult to communicate the benefits. Your DC went from PUE 1.3 to 1.2? Great! Is that the equivalent of rolling out 10,000 solar panels or turning the kitchen light off? You optimised a query? Fantastic! How many times does that query run per day, how much can the server be downsized, and what is the corresponding energy saving?

If we don't appreciate our own capabilities we will become the status quo we despise: expansion for the sake of budget, trading off perceived risk for inefficiency and waiting for someone else to fix our demand-side power inefficiencies with supply-side solar. The good news is that every IT architect can be the change they want to see. The bad news is that not every IT architect knows that.

Thursday, November 24, 2016

Excel formula for calculating stamp duty in Australian Capital Territory (ACT), Australia (that's where Canberra is)

Excel runs the world. If Microsoft removed nested IFs in Excel, every taxation system would transition to a flat rate overnight. Here's a stamp duty table for properties in Canberra, clearly constructed by someone who loves Excel.

I live one quarter my life in Excel, a quarter in Word, Visio and PowerPoint.

This is taken from the official ACT Revenue Office (that's state revenue, not federal). The Excel formula representing this table is as follows:

If you rely on this formula for critical financial decisions without testing it yourself, you're nuts.

Tuesday, November 22, 2016

Excel formula for calculating stamp duty in Western Australia (WA), Australia (that'd be where Perth is)

If you want to buy property in Western Australia, it's helpful to understand stamp duty liability.

Location of Perth, according to CNN.

This formula replicates the WA Department of Finance stamp duty calculator. It assumes you're an Australian citizen, aren't eligible for concessions, and are purchasing a residential property.

However, the stamp duty calculator rounds to the nearest 100. Hence, a $1000 property will have the same liability as a $1099 property. Here's another formula that calculates liability exactly, as per the WA schedule of rates

Pick whichever one makes your wildest property fantasies come true. I hope it goes without saying that you should test an Excel formula you found on the internet before making actual financial decisions. It is entirely possible for the WA government to change the stamp duty rates 3 seconds after you read this blog post.

Monday, November 21, 2016

Excel formula for calculating stamp duty in Tasmania (TAS), Australia (that'd be where Hobart is)

Here's my Microsoft Excel formula for calculating stamp duty in Tasmania (TAS), Australia.

The output of this formula doesn't match the official Tasmanian State Revenue Office's calculator, because their calculator only "rounds" the input to the nearest $100.

Example: if you enter $100,000 into the official calculator and the Excel formula, they will match. However, if you enter $100,001, the official calculator will say $2438.50 and the Excel formula will say $2435.04. In fact, if you enter any figure between $100,000 and $199,999, their calculator will give the same response. I'm not sure whether the Tasmanian SRO round their inputs to the nearest $100, or whether they follow the letter of the law when calculating liability.

I've created an additional Excel formula which replicates the behaviour of the online calculator.
You're free to pick which one you like. Either way, the maximum margin of error for this formula will be $4.50 (the liability from the highest range). If an inaccuracy of $4.50 bothers you, perhaps you shouldn't be in the property market!

Standard disclaimer applies: do not trust this formula until you have tested it yourself. It makes all sorts of assumptions like you are an Australian citizen and are not entitled to any concessional rates.

Sunday, November 20, 2016

Excel formula for calculating stamp duty in South Australia (SA), Australia (that's where Adelaide is)

Because I'm a completionist, I feel the urge to write Excel formulas to calculate stamp duty for every state in Australia. Here's the formula for South Australia from Revenues SA.

Unlike other states, Revenues SA calcualate liablility to include cents. Hence, no ROUND() in this formula.

If you're trusting an internet stranger's formula without comparing it with the official SA stamp duty calculator, you're nuts. The intent of these formulas is to calculate ballpark stamp duty.