This is incredibly simple code but may be of use to some people. Typing out derivatives in LaTeX (e.g. \(\frac{\partial y}{\partial x}\)) can be shortened.

Add this line of code to the header of your document:
[code]
\newcommand{\dydx}[2]{\frac{\partial{#1}}{\partial{#2}}}
[/code]

This creates a new command \dydx that takes two arguments, e.g. \dydx{P}{\tau}. Include this command in math mode (e.g. encased in dollar signs) and it will produce \(\frac{\partial P}{\partial \tau}\).

//

If emigration had been included in the Olympics when they were first introduced, Ireland would be a great sporting nation. Nonetheless the scale of the emigration is sometimes slightly exaggerated.

I have seen it stated online that “Four out of every five children born in Ireland between 1931 and 1941 emigrated in the 1950s.” (For example, here and here.) This is not true.

The claim first appears on p.379 of JJ Lee (1989) Ireland, 1921-1985: Politics and Society. This is an excellent book, but the claim is slightly incorrect. Lee attributes the claim to Tobin (1984:156) The Best of Decades. I tracked this book down on eBay. Tobin in turn was citing Garret FitzGerald, who wrote in the Irish Times in September 1966 that “[Current low unemployment] contrasts sharply with the position between 1954 and 1961 when net emigration averaged over 45,000 a year, or the equivalent of 80 per cent of those born eighteen or twenty years earlier.”

FitzGerald notes that the emigration rate is “the equivalent” of 80% of those born twenty years earlier. This definition could include, for example, two thirty year-olds and their three small children. In that respect the original 80% statistic is stated too strongly: restricting emigration exclusively to those born between 1931 and 1941 invalidates the claim. We know that many of the emigrants of the 1950s were young children.

In summary, the statement that four out of every five children born in Ireland between 1931 and 1941 emigrated in the 1950s is incorrect. What is true is that around 57,000 were born each year in the 1930s, and around 45,000 people (i.e. about 80% of 57,000) emigrated each year in the 1950s. The starkness of that statistic doesn’t require any exaggeration.

//

Students ask me this all the time, so here’s my explanation of the three types of inefficiency.

1. Productive inefficiency. This is a supply-side idea. Mattie and Joe both produce bananas. The bananas are identical. It cost Mattie $12 to produce his last kilogram of bananas, and it cost Joe $10 to produce his last kilogram. They would both better off if, instead of producing that last unit for $12, Mattie paid Joe e.g. $11.50 to produce it. That way Mattie saves 50c and Joe makes a profit of $1.50.

The condition needed to satisfy productive efficiency is that the marginal cost for Company A equals the marginal cost for Company B. If the marginal costs differ, then there are gains from trade from the low marginal cost company (e.g. Joe) selling the item to the company with the high marginal cost (e.g. Mattie).

2. Distributive inefficiency. This is a consumer-side idea. Let’s say that for some reason bananas sell for $1 in the US and $3 in Canada. Then there are people in Canada who are willing to pay, say, $2.75 for bananas but do not receive them. Suppose some American is willing to pay up to (but no more than) $1.20 for bananas. If he sells the bananas to the Canadian for e.g. $2.50, then everyone is better off. Although the American was receiving 20c in consumer surplus by purchasing the bananas for $1, he is clearly better off by selling them for $2.50. (Obviously transport costs have to be small for this to hold.) The Canadian gets the bananas and 25c consumber surplus, so he is also better off. Therefore the $1 and $3 prices generate inefficiencies.

The condition needed to satisfy distributive efficiency is that the marginal benefit to Mr 1 equals the marginal benefit to Mr 2. If they differ, then there are gains from trade from the person with the low MB (e.g. $1) selling the item to the person with the high MB (e.g. $3).

3. Allocative inefficiency. This puts the consumer-side and the producer-side together. Suppose everything regarding productive efficiency (marginal costs for Company A and Company B are the same) and distributive efficiency (marginal benefits for Mr 1 and Mr 2 are the same) is just fine. You can still have inefficiency if the marginal benefits don’t equal the marginal costs. For example, if the costs of the last kg of bananas is $10 but consumers are only willing to pay $3 for it, then producing that last unit is inefficiently costly.

Thus the condition needed to satisfy allocative efficiency is that the marginal benefits (consumer side) equal the marginal costs (producer side).

//

These are external functions to calculate skewness and kurtosis for a vector in R. Anyone using R is likely able to write similar functions themselves, but you never know.

[code]

### sample_skew.R
### Enda Hargaden, January 2013

sample_skew = function(data_vec_dirty)
{

# Remove missing values
data_vec = data_vec_dirty[!is.na(data_vec_dirty)]

n = length(data_vec)
xbar = mean(data_vec)

second_moment = c()
third_moment = c()

for(i in 1:n)
{
second_moment[i] = (data_vec[i] – xbar) ^ 2
third_moment[i] = (data_vec[i] – xbar) ^ 3
}

s_numerator = sum(third_moment) / n
s_denominator = sum(second_moment /n) ^ 1.5
skew = s_numerator / s_denominator

skew
}

[/code]

 

[code]

### sample_kurtosis.R
### Enda Hargaden, January 2013

sample_kurtosis = function(data_vec_dirty)
{

#Remove missing values
data_vec = data_vec_dirty[!is.na(data_vec_dirty)]

n = length(data_vec)
xbar = mean(data_vec)

second_moment = c()
forth_moment = c()

for(i in 1:n)
{
second_moment[i] = (data_vec[i] – xbar) ^ 2
forth_moment[i] = (data_vec[i] – xbar) ^ 4
}

k_numerator = sum(forth_moment) / n
k_denominator = ( sum(second_moment) /n )^2
kurtosis = k_numerator / k_denominator

kurtosis

}

[/code]

//

These are tips that I wish I had known on landing in Detroit airport. I’ll update this list as more come to mind.

  1. Ann Arbor can be broadly split into two parts. The State St/South University area is aimed at students, with bars and cheap pizza places. About six blocks west is Main St, the area for locals/”townies”.
  2. Thankfully there is now a CVS pharmacy near State St and North University. This is the best place to buy your toothbrush and milk and the like to get you through your first couple of days. It’s open (close to?) 24 hours a day.
  3. The consensus for best all-round supermarket is Meijer. If you don’t have a car, the Ann Arbor Transportation Authority run a bus service, The Ride. The 16 bus goes to Meijer every 30 minutes or every hour. It goes in a loop, so the stop in the Meijer parking lot is also where they pick you up an hour later. Swiping your MCard will get you on for free. If you haven’t got your MCard yet, a single pass will do for both legs of the trip.
  4. If you’re not from the US and want a cheap cell phone plan, I recommend Virgin Mobile USA. It’s the cheapest I’ve found.
  5. The undergrad ghetto is south of Hill St and north of Stadium. It can stretch as wide as Main St to Washtenaw Ave. The area around Burns Park is fine, though. In terms of where to live, there’s a good guide here.
  6. In terms of renewing a lease: under Ann Arbor law, tenants have a seventy day first refusal period on lease renewal. This means that your landlord may not re-lease your apartment (for the subsequent year) without your approval within seventy days of you moving in. Consequently many leases are signed around November 10th, or about seventy days after the first day of classes. If you wish to find the best housing in Ann Arbor, it is advisable to start looking – and be willing to sign a lease – in early November.
  7. The Michigan Flyer is an excellent way to get from Ann Arbor to Detroit airport. It’s about $15, whereas a cab is about $60. My understanding is that cab companies are all the same. When all the students are going to the airport (Spring Break, either side of the Christmas holiday, etc.) the university runs discounted buses to the airport. It’s called the Air Bus, and it’s about $7.
  8. The best (but expensive) coffee is in Comet Coffee in Nickel’s Arcade. The best burritos are to be found in BTB’s. The best undergrad bar is the Blue Leprechaun. The most popular grad school bar is probably Old Town, although I prefer Red Hawk. The best dive bar is the 8-Ball Saloon. Cottage Inn is probably your best bet for takeaway pizza. The best “nice” but not ridiculously priced restaurant is Palio’s. The best quiet study place is in the Rackham Building, with the Law Reading Room a close second.
  9. I think the following places are over-rated: Zingerman’s, Ashley’s, Fleetwood Diner.
  10. The two main places for concerts are The Ark and the Blind Pig. There are some noteworthy other shows in the Power Center and Kerrytown Concert House, but these are few and far between.
  11. Make sure you buy your stationary before the first week of classes. The queues in Ulrich’s in South University will cost you twenty minutes if you’re not careful. The only other place to buy paper and pencils (that I know of) is in the basement of the Michigan Union.
  12. Go to the UM Museum of Art. It’s very good. The Kelsey Archaeology museum charmed the pants off me.
  13. The UM International Center website has lots of good advice. They’re also helpful in there, too.
//

I had to present on path dependence recently. Paul David’s famous QWERTY paper (American Economic Review P&P, 1985) was covered, as was Paul Pierson’s Increasing Returns, Path Dependence, and the Study of Politics (American Political Science Review, 2000).

Both of these papers reference the Polya urn model. This is a ball-and-urn process where, instead of simple replacement, there is replacement with addition of a ball of the same colour. This gives one colour a dominant position in the long run.

I coded a script to run Polya urn simulations. It’s in JavaScript, and easily adaptable. I tested it in Chrome.

[sourcecode language=”javascript”]
<html><body><script language="JavaScript">
///////////////////////////////////////////////////////////////////////////////////////////////

// Number of iterations
var runs = 400;

// Number of blue balls initially in urn
var num_blue = 1;

// Number of red balls initially in urn
var num_red = 1;

// Number of additional red/blue balls added after red/blue "wins"
var extra_extra = 1;

// Show which colour was picked etc
var details = true;

// Summarize the mean at the end
var mean_details = true;

///////////////////////////////////////////////////////////////////////////////////////////////

var initial_dist = num_red / (num_red + num_blue);
red_width = initial_dist*400;

// Graph initial distribution
document.write("Initial Distribution<br /><div style=’background-color:blue;height:10;width:400;’>");
document.write("<div style=’background-color:red;height:10;width:" + red_width +";’></div></div>");

// Random number
var r_n = 0;

var red_share = new Array();
red_share[0] = num_red / (num_red + num_blue);

for(i=1;i<runs;i++)
{

// Random number on unit interval
r_n = Math.random();

if (r_n > red_share[i-1])
{
num_blue = num_blue + extra_extra;
if(details){document.write("Blue.");}
}

if (r_n <= red_share[i-1])
{
num_red = num_red + 1;
if(details){document.write("Red.");}
}

red_share[i] = num_red / (num_red + num_blue);
if(details){document.write(" Red Share = " + num_red + "/(" + num_red + " + " + num_blue + ") = " +

red_share[i]);}

document.write("<div style=’background-color:blue;height:10;width:400;’>");
document.write("<div style=’background-color:red;height:10;width:" + red_share[i]*400 + ";></div>");
document.write("</div><div style=’background-color:white;height:5;width:400;’></div>");
}

var total = 0;
var mean = 0;
for(j=0;j<runs;j++)
{total = total+red_share[j]}
mean = total/runs;
if(mean_details){document.write("Mean of red share: " + mean);}
</script></body></html>
[/sourcecode]

//

What’s the easiest way to include a graphic (or graph, diagram, figure etc.) in my document?

[code]
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\centering
\caption{This is my picture}
\includegraphics[width=5in,height=3in]{adamsmith.jpg}
\end{figure}
\end{document}
[/code]
Then compile using pdflatex.

I’m getting a “no BoundingBox” error when I compile my document.

Have you tried compiling the document with pdflatex? In WinEdt, select PDFLaTeX from the dropdown menu that’s below ‘Accessories’ on the menu bar, and to the right of the recycle bin icon. If you’re compiling from the command prompt and your document is named thesis.tex, type pdflatex thesis.

I’m trying to compile my document and I am using natbib to do the references, but the document won’t compile with PDFLaTeX.

It’s unfortunate that natbib (as far as I can see) relies on latex (not pdflatex) but latex gets confused if you have graphics in the document. My workaround for this is to temporarily place a % sign in front of any graphics to turn them into comments, rather than code. This means the graphics are initially excluded, and you can run latex/bibtex and natbib will work. Once all the references are good and ready, you can remove the % signs (a quick Find > Replace All will do the trick) and compile using pdflatex.

//

And a rock star meets Enda.

Although my tastes have moved on over the last ten years, Quinn Allman was my favourite guitarist for quite a while.

He’s still an absolute gent, as he was when I met him seven years ago. On the other hand, I must work on looking less nerdy around cool people.

//

I updated the otherwise-excellent BarcodeScanner App on my LG Optimus phone and it stopped working. After the update the program just gave me a black screen with a red line on it. A quick search of an Android forum proved I’m not the only one who had this problem, it happens on all Optimus models.

The fix is simple. Uninstall the app and install the old version which can be downloaded from http://code.google.com/p/zxing/downloads/detail?name=BarcodeScanner3.72.apk. Done.

//
Scroll to Top