What is in a QR Code?

Bar codes have been common in retail stores since the 1970s. These give a one-dimensional read of digital data. The hardware and software to decode a bar code are relatively simple.

The QR code encodes information in a two-dimensional matrix. The QR code, short for quick-response code, was invented in 1994 by Masahiro Hara of the Japanese company Denso Wave for labelling automobile parts. It can pack far more information in the same real estate than a bar code, but it requires sophisticated image processing to decode it. Fortunately, the chip power for image processing has kept up, so smart phones can decode even intricate QR codes, provided the image is clear enough.

Here is the QR code that encodes the URL for Wikipedia, i.e., the characters: “https://en.wikipedia.org/wiki/Wikipedia”.

Like most QR codes, it has three distinctive square patterns on three corners, and a smaller one set in from the fourth corner, that give information to the image processing software on image orientation and sizing.

As time goes on, more versions of QR codes are defined, with ever finer patterns that convey more information. For instance, here is a medium-resolution QR Code (version 3), and a very high resolution QR code (Version 40):

Version 3 QR Code (29×29), encodes up to 50 characters

Version 40 QR Code  (177×177), encodes up to 1852 characters

My phone could not decode the Version 40 above; the limit may be how much detail the camera could capture.

QR codes use the  Reed–Solomon error correction methodology to correct for some errors in image capture or physical damage to the QR code. For instance, this QR code with the torn-off corner still decodes properly as the URL for Wikipedia (whole image shown above):

Torn QR Code still decodes properly.

Getting down a little deeper in the weeds, this image shows, for Version 3  (29×29) QR code, which pixels are devoted to orientation/alignment (reddish, pinkish), which define the format (blueish), and which encode the actual content (black and white):

Uses Of QR Codes

A common use of QR codes is to convey a web link (URL), so pointing your phone at the QR code is the equivalent of clicking on a link in an email. Here is an AI summary of uses:

They are used to access websites and digital content, such as restaurant menus, product information, and course details, enabling a contactless experience that reduces the need for printed materials. Smartphones can scan QR codes to connect to Wi-Fi networks by automatically entering the network name (SSID), password, and encryption type, simplifying the process for users. They facilitate digital payments by allowing users to send or receive money through payment apps by scanning a code, eliminating the need for physical cash or cards. QR codes are also used to share contact information, such as vCards, and to initiate calls, send text messages, or compose emails by pre-filling the recipient and message content. For app downloads, QR codes can directly link to the Apple App Store or Google Play, streamlining the installation process. In social media and networking, they allow users to quickly follow profiles on platforms like LinkedIn, Instagram, or Snapchat by scanning a code. They are also used for account authentication, such as logging into services like WhatsApp, Telegram, or WeChat on desktop by scanning a code with a mobile app. Additionally, QR codes are employed in marketing, event ticketing, and even on gravestones to provide digital access to obituaries or personal stories. Their versatility extends to sharing files like PDFs, enabling users to download documents by scanning a code. Overall, QR codes act as a bridge between the physical and digital worlds, enhancing efficiency and interactivity across numerous daily activities.

Note that your final statement in this world might be a QR code on your gravestone.

Security with QR Codes

On an iPhone, if “Scan QR Codes” (or something similar) has been enabled, pointing the phone at a QR code in Camera mode will display the first few characters of the URL or whatever, which gives you the opportunity to click on it right then. If you want to be a bit more cautious, you can take a photo, and then open Photos to look at the image of QR code. If you then press on the photo of the QR code, up will come a box with the entire character string encoded by the QR code. You can then decide if clicking on something ending in .ru is what you really want to do.

Accessing a rogue website can obviously hurt you. And even if you aren’t dinged by that kind of browser exploit, the reader’s permissions on your phone may allow use of your camera, read/write contact data, GPS location, read browser history, and even global system changes. The bad guys never sleep. Who would have thought that a QR code on a parking meter posing as a quick payment option could empty your bank account? Our ancestors needed to stay alert to physical dangers, for us it is now virtual threats.

ACKNOWLEDGEMENT: The bulk of the content, and all the images, in this blog post were drawn from the excellent Wikipedia article “QR code”.

Teaching Business Statistics Graphs with Chart Crimes

Many people take a basic statistics course in college. Those course usually include an overview of standard graphs and best practices for visualizing data.

To keep that section from getting boring (“here’s a line graph… here’s a bar chart…”) you can borrow my slides on #chartcrimes  Teaching people best practices is more engaging when you can show real examples of charts gone wrong.

These are pictures I dropped directly into slides and talked through:

P.S. Joke I made about this section of my textbook:

Older post about teaching stats to Gen Z: Probability Theory for the Minecraft Generation

Where are the Elderly Workers? Still around, just older.

I’m piggy-backing off of the FRED blog and off of Jeremy’s post with yet more data. Let’s set the stage.

  • FRED blog, using BLS data from the Current Population Survey (CPS), shows that the labor force participation rate (LFPR) fell by about 1.4pp for people 55 years and older between 2017 & 2023. CPS data is released quickly, but the sample sizes are not massive. There are 3.4 million people in the 7 years of monthly data (so, a little over 40k people age 55+ per monthly observation).
  • Also using CPS data, Jeremy shows that FRED commits the fallacy of composition because there are very different people who are 55 and older. Specifically, he illustrates that the LFPR for people ages 55-64 have experienced about a 1.3pp *higher* LFPR in 2023 vs 2017. The implication is that something is happening to the people older than 64.
  • I use annual CPS instead. Why? Because it can be corroborated with the annual American Community Survey (ACS) data for 2017-2023.
Continue reading

Older Workers Have Not Dropped Out of the Labor Force

A recent blog post from the St. Louis Fed claims that:

“Both younger and older workers withdrew from the labor force in large numbers during the pandemic: In fact, their participation rates plummeted. Yet, within two years, the younger workers had bounced back to their pre-pandemic participation rates. But the older workers have not.”

They include a chart which seems to back up that assertion:

However, if you look closely, you will see that the older workers’ age group is open-ended. It includes 55-year-olds, as well as 95-year-olds. Given that the US population is aging, this seems like a poor choice.

While not available currently in the FRED database, there is data from BLS available for older workers that is not open-ended. For example, we can look at workers ages 55-64, who are older but still young enough that they are mostly below traditional retirement age. I use that data and compare with the 25-54 age group (note: because the 55-64 data isn’t available seasonally adjusted, I use the non-adjusted data for both age groups, then use a 12-month average, so my chart doesn’t exactly replicate the chart above):

By using a closed-end age group for older workers, we see that labor force participation has not only recovered from the pandemic, but it exceeds the pre-pandemic peak for both prime-age and older workers, and had done so by the Spring of 2023. In fact, both are now about 1 percentage point above February 2020. If we want to go to the first decimal place, older workers have actually increased their labor force participation slightly more: 1.1 vs 0.9 percentage points. But these are close enough, given that this is survey data, to say the recovery has been roughly equal.

The St. Louis Fed blog concludes by saying that early workforce retirements “will continue to depress the labor force participation rate of workers aged 55 and older for the foreseeable future.” But it’s not true that the LFPR of older workers is depressed! Provided that we exclude those 65 and older.

The American Middle Class Has Shrunk Because Families Have Been Moving Up

In 1967, about 56 percent of families in the US had incomes between $50,000 and $150,000, stated in 2023 inflation-adjusted dollars. In 2023, that number was down to 47 percent. So the American middle class shrunk, but why? (Note: you can do this analysis with different income thresholds for middle class, but the trends don’t change much.)

The data comes from the Census Bureau, specifically Table F-23 in the Historical Income Tables.

As you can see in the chart, the proportion of families that are in the high-income section, those with over $150,000 of annual income in 2023 dollars, grew from about 5 percent in 1967 to well over 30 percent in the most recent years. And the proportion that were lower income shrunk dramatically, almost being cut in half as a proportion, and perhaps surprisingly there are now more high-income families than low-income families (using these thresholds, which has been true since 2017). The number is even more striking when stated in absolute terms: in 1967 there were only about 2.4 million high-income households, while in 2023 there were 11 times as many — over 26 million.

Is this increase in family income caused by the rise of two-income households? To some extent, yes. Women have been gradually shifting their working hours from home production to market work, which will increase measured family income. However, this can’t fully explain the changes. For example, the female employment-population ratio peaked around 1999, then dropped, and now is back to about 1999 levels. Similarly, the proportion of women ages 25-54 working full-time was about 64 percent in 1999, almost exactly the same as 2023 (this chart uses the CPS ASEC, and the years are 1963-2023).

But since the late 1990s, the “moving up” trend has continued, with the proportion of high-income families rising by another 10 percentage points. Both the low-income and middle-income groups fell by about 5 percentage points. Certainly some of the trend in rising family income from the 1960s to the 1990s is due to increasing family participation in the paid workforce, but it can’t explain much since then. Instead, it is rising real incomes and wages for a large part of the workforce.

What is $300,000 from “The Gilded Age” Worth Today?

SPOILER ALERT FOR THE THIRD SEASON OF THE GILDED AGE

In Season 3 of the drama series “The Gilded Age,” one of the servants (Jack, a footman) earns a sum of $300,000 by selling a patent for a clock he invented (the total sum was $600,000, split with his partner, the son of the even wealthier neighbor to the house Jack works in). In the series, both the servants and Jack’s wealthy employers are shocked by this amount. Really shocked. They almost can’t believe it.

How can we put that $300,000 from 1883 in New York City in context so we can understand it today?

A recent WSJ article attempts to do that. They did a good job, but I think more context could help. For example, they say “Jack could buy a small regional bank outside of New York or bankroll a new newspaper.” Probably so, but I don’t think that quite conveys the shock and awe from the other characters in the show (a regional bank? Ho-hum).

First, the WSJ states that the “figure nowadays would be between $9 and $10 million.” That’s just doing a simple inflation adjustment, probably using a calculator such as Measuring Worth (it’s a good tool, and they mention it later in the story). But as the WSJ goes on to note, that probably isn’t the best way to think about that figure.

Here’s my best attempt to contextualize the $300,000 figure: as a footman, Jack probably made $7 to $10 per week. Or let’s call it $1 per day. That means Jack’s fellow servants would have had to work 300,000 days to earn that same amount of income — in other words, assuming 6 days of work per week, they would have had to work for almost 1,000 years to earn that much income. Jack appears, to his co-workers, to have earned that income almost in one fell swoop (though in reality, he spent months of his free time toiling away at the clock).

Continue reading

The 2018 Tariffs in Many Graphs

Did president Trump’s first term tariffs, enacted in 2018, increase manufacturing employment or even just manufacturing output? Let’s set the stage.

Manufacturing employment was at its peak in 1979 at 19.6 million. That number declined to 18m by the 1980s, 17.3m in the 1990s. By 2010, the statistics bottom out at 11.4m. Since then, there has been a rise and plateau to about 12.8m if we omit the pandemic.

Historically, economists weren’t too worried about the transition to services for a while. After all, despite falling employment in manufacturing, output continued to rise through 2007. But, after the financial crisis, output has been flat since 2014, again, if we omit the pandemic. Since manufacturing employment has since risen by 5% through 2025, that reflects falling productivity per worker. That’s not comforting to either economists or to people who want more things “Made in the USA”.

Looking at the graphs, there’s no long term bump from the 2018 tariffs in either employment or output. If you squint, then maybe you can argue that there was a year-long bump in both – but that’s really charitable. But let’s not commit the fallacy of composition. What about the categories of manufacturing? After all, the 2018 tariffs were targeted at solar panels, washing machines, and steel. Smaller or less exciting tariffs followed.

Breaking it down into the major manufacturing categories of durables, nondurables, and ‘other’ (which includes printed material and minimally processed wood products),  only durable manufacturing output briefly got a bump in 2018. But we can break it down further.

Continue reading

Initial Jobs Reports from BLS are Very Good At Identifying Downturns in the Labor Market

Yesterday I showed that BLS jobs reports from the CES aren’t getting worse over time, if we judge them by how much they are later revised. In fact, they are much better than decades past, with the last 20 years or so standing out as much better than the past.

Today I want to address a related but separate topic: are the initial jobs reports good at telling us when a downturn in the labor market is beginning? This is actually the strongest argument for releasing this survey data in a timely manner, even though the data often goes through significant revisions later. The report typically comes out the first Friday of a new month, so it is very current data. Given that the likely new BLS Commissioner has signaled he prefers the more accurate quarterly release, even though it is 7-9 months after the fact, it is useful to ask if these initial reports have any value in telling us when labor market declines (and recessions) are beginning.

That’s right: you are getting two posts from me this week, on essentially the same topic. Because it’s very important right now.

The short answer: the report is very good for the purpose of identifying downturns, especially the start of the downturns. Let’s walk through the past few recessions.

Continue reading

BLS Has Been Getting Better at Estimating Jobs, and They are Not More Favorable to Democrats

You’ve probably heard a lot about BLS data recently (or at least more than usual) with Trump firing the BLS Commissioner after a bad monthly revision to the nonfarm payroll jobs figures. But this didn’t come out of the blue, as there was plenty of criticism of the jobs numbers during the Biden term as well, mostly coming from the political right.

The two main criticisms leveled at the BLS, in my reading of it are:

  1. The BLS is getting worse at estimating jobs numbers over time, leading to larger revisions
  2. The revisions are done in a way that is favorable to Democrats

I think both of those claims can be analyzed with the following chart, which also shows those claims to be incorrect:

Continue reading

Hayek on The Volatility Pie

In the Road to Serfdom, Friedrich Hayek uses some basic quantitative logic to make an important point about employment and political economy.

Hayek starts by assuming that government jobs are stable relative to those in the private sector. This might seem obvious, but let’s just start by checking the premises. Below are the percent change in total compensation and total employment for government employees and for the private sector. From year to year, private employment and total compensation is more volatile. So, Hayek’s initial premise is correct.

From there, he proceeds to say that if any part of income or employment is guaranteed or stabilized by the government, then the result must be that the risk and volatility is borne elsewhere in the economy. He reasons that if there is a decline in total spending, then stable government pay and employment implies that the private sector must have a deeper recession than the overall economy. Looking at the above graphs, both government employment and the total compensation are much less volatile.

But can’t governments intervene in macroeconomic stabilization policies effectively? Yes! They can and do stabilize the economy, especially with monetary policy. But Hayek is referring to individual stabilizations. For any individual to be guaranteed an income, all others must necessarily experience greater income volatility. How’s that?

Consider two individuals. Person #1 has an average income of $100. In any given year, his income might be $10 – or 10% – higher or lower than average. For the moment, person #2 is not employed and has income volatility of zero. If the government provides a job with a constant pay rate to person #2, then they still have zero income volatility. But instead of earning a consistent $0, person #2 earns a consistent $50. Nice.

Of course, person #2 gets his pay from somewhere. By one means or another, it comes from person #1. Let’s be generous and assume the tax on person #1 has no resulting behavioral effect. His new average income is $50, being $10 higher or lower in any given year. But now, that $10 deviation is over a base of $50 rather than $100. Person #1’s income varies by 20% relative to his new average!

Reasoning through this, we can consider that a person has a stable portion of their income and a volatile portion. If someone takes a part of your stable portion and leaves you with all of your volatile portion, then your remaining income is now more volatile on average. I think that this point is interesting enough all by itself.

IRL, many of our taxes are not lump sum. Rather, progressive taxation causes a negative incentive for production & earnings. The downside is that we produce less. The upside is that the government takes a higher proportion of our volatile income than of our stable income (because income changes are always on the margin and those marginal dollars are taxed at a higher rate). So, the government shares the income volatility of the private sector. By continuing to pay government employees a stable salary, the government is effectively absorbing some of that year-to-year income volatility on behalf of its employees.* The government is, in a sense, providing income insurance to a subgroup.

What does this have to do with The Road to Serfdom? Hayek argues that, as the government employs an increasing proportion of the population, the remaining private sector experiences increasing income and employment volatility. Such volatility increases private risk exposure so much that people begin to fawn over and increasingly compete for the stability found in government work. He gets anthropological and argues that the economic attraction to government jobs will introduce greater competition for those jobs and subsequently greater esteem and respect for those who are able to get them. This process makes the government jobs even more attractive.

My own two cents is that there is nothing internally unstable about this process. Total real income would fall compared to the alternative. However, such a state of affairs might be externally unstable as other governments/economies compete with the increasingly socialist one.


*An important analogue is that firms behave in a similar way. An individual may receive a relatively constant salary so long as they are employed. But the result must be that the firm bears more of the net-profit volatility. So, as more people want stable private sector jobs, the profit volatility of firms would increase and result in greater [seemingly windfall] profits and losses.