An Economist Learns Piano: Part 1

My life didn’t change all that much due to Covid-19 pandemic. I live in a small university town. I mostly continued to go to work and my kids mostly continued to play with their neighbor friends. After a brief hiatus, I ended up growing much closer to my neighbors. One nearby couple are even the godparents my most recently born child.

The university at which I teach is a liberal arts school…. And I teach economics. I knew that these music-type of students and professors were out there, but I didn’t have much exposure. I recently obtained a zero-priced piano and had a good 2-hour conversation with a music major. This post illustrates part of I’ve learned so far. First, a graph.

Whether we want to or not, many of us know the musical scale thanks to The Sound of Music. What I didn’t know was that there is not a uniform distance between all of those notes. Along the x-axis is the note labels (do re mi fa so la ti do). The pitch is characterized by an increment called a step. Given some arbitrary pitch for the first note, do, each subsequent note is a specific number of steps away. The pattern is that each increment between notes is 1 step, except the step from mi to fa and from ti to do. Those are half steps. The result is a segmented function.

Now, this pattern can be applied to a piano.

There are a total of 88 keys on a piano. Some are black, others are white. But all of them are a half-step increment from the prior and subsequent key. IDK why there are small black keys and big white ones. But pianos would be a lot bigger without the narrower black keys. Every single white key on a piano is labeled with a letter. The letter *does not move*. A ‘C’ is always a ‘C’.

What can move is the scale label, do, which can be any key. The pattern identified in the graph above must be maintained. To play ‘in the key of C’ means that ‘C’ is identified as do. The remaining keys can be labeled.

The key of ‘C’ is easy because the entire scale can be played on all white keys.

Those two half steps that we mentioned earlier? Those might have been on a black key – except that there is no black key between ‘B’ and ‘C’ or between ‘E’ and ‘F’. The B-C keys are adjacent. That means that their pitch is a half-step apart – exactly what is necessary for the pitch difference between mi and fa. The same is true for the E-F step and the pitch difference between ti and do.

What about the black keys? We can see their roll by placing do on a different lettered key. We can start on ‘D.  

do to re is a full step, from ‘D’ to ‘E’ – skipping the black half-step that’s between them. For re to mi we need to skip a key, all keys are a half step apart. So? To the black key! We skip ‘F’ and land on the subsequent black key. Then, fa falls on ‘G’, a half step and a single key higher in pitch. ‘A is a full step away from ‘G’, so that’s so. la is another full step away on ‘B‘. Recall that all of the keys are separated by a half-step – the key colors are 100% unimportant. ti is a full step higher – but there is no key separating ‘B’ and ‘C’. So, we skip up to the black key again just as we did with mi. Finally, do is a single key and a half step more.

There you have it! One of the things that a pianists can do is play the entire scale, from do to do, starting from any lettered key on the piano. I can’t do that yet, but golly I certainly feel like I have a better handle of what I’m even looking at.

PS – My conversation took a long time and I had to nail down the difference between 1) The note label, 2) the pitch step increments, & 3) the piano key letter labels. Key letter labels and the note labels are ordinal variables while the steps are cardinal. So, the graph at the top of this post isn’t the only important relationship. The graph below includes the relationship between the step and key letter labels. A graph of the note label and the key letter labels requires a rudimentary knowledge of flats and sharps (with two different do’s).

Gen Z on Deep Work

I asked students to read an excerpt of the first chapter of Cal Newport’s book Deep Work and comment in a discussion board. The prompt asked whether deep work goes on in college and what are the barriers to deep work. I think it’s important for society that some people engage in deep work on our problems. I’m interested in how 20-year-olds perceive Newport’s ideas on focus and what barriers they identify to deep work.

Replies ranged from “I do believe that deep work is happening at college, but I think that it is hard to find students using this strategy regularly.” to “I know multiple people who do not practice deep work….” They each have a different subjective view of “deep work” and their replies are anecdotal. It’s possible that some students are too hard on themselves, considering that I biased them to be negative with the discussion prompt. Some of them might have thought that “deep work” requires many consecutive hours of focus, which is not actually what I expect of undergraduates. Still, the discussion could be helpful to others who aspire to deep work.

The following barriers to deep work were identified:

“The barriers that we experience include social media, roommates, friends, significant others, going to classes, having to work, and any number of other things that cause our day to become disjointed …  We are the first generation that has spent the majority of our life utilizing social media… and in general, are used to taking in information from a large number of sources over a short period of time.

“Most students cannot spend a large amount of hours just focused on the one task at hand and that is required for deep work. For most college students it will be nearly impossible to practice deep work because of a job, outside social life, or a heavy class workload …

“I believe that deep work happens in college a lot.  Students often times must prepare/study for tests for a long time and that is when it happens the most.  When someone has to study for hours they are intensely focused if they put themselves in a good studying environment…

“This can be achieved when you are able to clear your mind of external things and place yourself in a non-distracting environment. As a college student, this can be difficult especially because we are constantly thinking about our to-do list, when will we hang out with friends, or what’s for dinner.

Continue reading

How Should We Teach Public Goods Theory?

Joshua Hendrickson recently wrote about the provision of public goods, and how we teach public goods in economics. My post today is not so much a reply to Hendrickson, but is inspired by his mediation on public goods as I gear up to teach another semester of Public Finance.

The theory of public goods that economists discuss among themselves is pretty straightforward: when a good is both non-rival and non-excludable, there is a strong case for government intervention of some sort (though not necessarily public provision). The opposite is true when a good is both rival and excludable: there is a strong case for laissez faire.

Seems simple enough, right? But communicating this concept to undergraduates and the general public has been a major challenge. Part of the confusion arises from the term itself, “public good.” Non-economists tend to use the term interchangeably with the notion of “the common good, as is clear from Wikipedia, a dictionary, or a conversation with your grandma. For this reason, I sometimes substitute the awkward phrase “collective consumption good” (this is actually Samuelson’s term in his classic article on the topic), but all the textbooks so use it so I often default to the standard terminology.

From Jonathan Gruber’s Public Finance and Public Policy

But I think there’s a deeper problem than just terminology. Economists have put themselves in a box. Literally. Here’s a standard 2×2 matrix from Jonathan Gruber’s undergraduate public finance textbook. I don’t mean to pick on Gruber here — this is a pretty standard presentation. You can find it in many microeconomics textbooks too, or on Wikipedia. Everything goes in a box! It’s a nice stylized way to think of the terminology. It makes for nice test questions. But here’s the real problem with it as a pedagogical tool: it doesn’t seem to help many students! Or at least, it doesn’t seem to help them retain the knowledge between their micro principles courses and upper division courses (at least in my experience, I’d be happy to hear others chime in here).

So how can we teach this concept better? I have a few ideas. I’d like to hear yours too.

Continue reading

Visual Decision Trees in SAS Viya

As I said earlier, I used SAS Viya for Learners this semester. I assigned a final project for students. They had to use the data pre-loaded into the free version of SAS Viya, but otherwise had freedom to select their own variables and construct their own research question.

SAS Viya for Learners just recently opened for any users to make an account. This will allow you to learn SAS Viya functions (but not do your own actual work, because you cannot import new data). I’m using SAS Viya 3.4.

I like the way SAS Viya allows users to create a beautiful intuitive interactive decision tree model. This blog is to show you what that looks like. In traditional EconLit, regressions are more popular than decisions trees. Decision trees are a simple and useful machine learning technique. If you are trying to teach a first-timer about decision trees, then the visualization in SAS Viya for Learners can be helpful.

I’ll demonstrate using a decision tree for classification using built-in SAS data. One of the larger datasets available is USCENSUS1990. I’ll use it to demonstrate (and I do love the 90’s!). Consider the variable about the number of children a person has. This could be reasonably predicted by age and education level. [Footnote 1]

Here’s a chart showing the frequency of family sizes for adult women. (I used a Filter to only include people who are not coded zero in iFertil. See Footnote 1.)

For adult women in 1990, the most frequent category is to have more than 2 children. This would include the parents of Boomers. Think about those big families you know from the Boomer generation.

For input variables to my model, I’ll use age categories and also education levels. I set the new categorical variable I created called NumberChildren as the Response variable for a decision tree model. [Footnote 2] Here’s a zoomed out picture of the visual model output.

It’s immediately obvious that age is more informative than schooling. Women under the age of 30 are much more likely to have no children. The width of the grey tree branches makes it easy to see where the majority of the observations are.

I’ll zoom in on the left side of the tree where most of the people are.

The “>= 4.25” means that women on the far left side are over the age of 40. Among older women, the norm is to have 2 or more children. If you are looking for the older women with exactly two children, you are more likely to find them among those who have an education score of larger than “13”, meaning that they have a Bachelor’s degree or higher.

My point is not to posit causal relationships among education and fertility. My point is how awesome these graphs are. You do have to learn some point-and-click functions within SAS Viya to make them. But I don’t know of any other software that can produce this.

SAS Viya also provides tables and statistics on each node, which is more like what I could get from free open source software a few years ago when I looked into decision tree packages.

[Footnote 1] If you want to replicate what I did, know that the USCENSUS1990 dataset in SAS Viya comes with no explanation. Google brought me to UCI, where I found what I needed in terms of technical documentation.

dAge, iFertil, iSex, iYearsch are the names of the variables you will find in SAS. To create my graphs and models, I converted some of them to categorical variables using the “+New Data Item -> Custom Category” functions. No programming is required.

iSex: 0 indicates Male, 1 indicates Female

dAge is coded as follows: 0 is babies; 1 is under 13, 2 is under 20 (but over 13), 3 is under 30, 4 is under 40, 5 is under 50, 6 is under 65,  7 is for 65 and over

iFertil is coded: 0 is either less than 15 years old or male, 1 is no child, 2 means they have one child (confusing…), 3 means they have two children, all the way up to a 13 which is the code for 12 or more children

iYearsch:  3-10 refers to primary school up to a 10 indicating graduating from high school, 11-13 refer to some college and associate degrees, 14 is a Bachelors degree, 15-17 refers to higher degrees

[Footnote 2]  I decided to set Maximum levels to 5 in Options. This keeps the tree smaller which looks better in the blog.

Teaching with SAS Viya for Learners: Last Report

I used SAS Viya for Learners to teach data analytics to undergraduate business students for one semester.

I’ll start with the benefits of SAS Viya: It’s free; It’s visually appealing and requires no coding; There are some SAS tutorial materials that teachers can use; The way decision tree results are displayed makes intuition easy for students who are new to data mining.

I made a post earlier in which I reported that it actually works. I still think that, but at the end of the semester I did have individual students experience errors and mysterious interruptions to service. It made me wonder if the server gets busy at the end of an academic semester.

SAS is known for making excellent products and charging high fees for them. Since SAS Viya is free, they aren’t going to be giving all the functionality with it. The free version does not let students import any data. There is a sandbox of data to learn with, which is more than enough to fill a semester. I didn’t even open most of the available data sets.

My students did their final projects by choosing one of the pre-loaded datasets and using that for analysis. As far as applying the principles I taught, this was fine. In one sense, it was easier than telling them to fend for themselves and find data on the world wide web.

The downside is that the software-specific skills students learn from free student SAS Viya can’t be used on a project for work or for a different class. Eventually, any useful work involves importing new data.

The decision to use SAS Viya for Learners instead of R should depend on what your students want to do next. Both products will allow them to learn concepts and common functions.

If you are going to use SAS Viya, I highly recommend using the tutorials made by SAS with screenshot-by-screenshot instructions. You can give the instructions to the students, so students aren’t coming to you with questions about every click they need to make.

I paired SAS Viya with a Business Intelligence Textbook. Also note that students had already taken a traditional Business Statistics course previously.

Introducing Students to Text Mining

I’m going to teach text mining in the upcoming week. Most of my students have never heard of it. We have spent the semester talking about what do to with structured data, which includes some of the basic concepts from traditional statistics.

I often ask them to think about what computers can do. We talk about why “data analytics” classes are happening in 2020 and did not happen in 1990. Hardware and software innovations have expanded the boundaries of what computers can do for us.

The gritty details of how text mining works can make for a boring lecture, so I’m going to use the following narrative to get intellectually curious students on board. It always helps to start with fighting Nazis. Alan Turing helps defeat the Nazis by using a proto-computer to crack codes. The same brilliant Turing was smart enough to realize that computer could play chess someday (acknowledgement for me knowing that trivia: Average is Over). Turing didn’t live to see computers beat humans in chess but, in a sense, it didn’t take very long. Only about 50 years later, computers beat humans at chess.

Maybe chess is exactly the kind of thing that is hard for humans and easy for computers. When we discuss basic data mining, I tell students to think about how computers can do simple calculations much faster than humans can. It’s their comparative advantage.

Could Turing ever have imagined that a human seeking customer service from a bank could chat with a bot? Maybe text mining is a big advance over chess, but it only took about one decade longer for a computer (developed by IBM) to beat a human in Jeopardy. Winning Jeopardy requires the computer to get meaning from a sentence of words. Computers have already moved way beyond playing a game show to natural language processing.

How computers make sense of words starts with following simple rules, just as computer do to perform data mining on a spreadsheet of numbers. As I explain those rules to my students this week, I’m hoping that starting off the lecture with fighting Nazis will help them persevere through the algorithms.

Economists and Cocktail Parties

Sometimes I remark to my students, “This is why economists don’t get invited to cocktail parties.” This post is about that.

From 2008 – 2011 I taught a course at Florida State called “Economics of Compassion”. It is a course co-designed with my mentor Mark Isaac. The class discusses historical and contemporary problems related to poverty, both at the domestic and international levels. Having heard about the course, the Social Justice Living Learning Community at Florida State wanted me to teach the course to their incoming freshman. 

It was quite different from other courses they were taking that seemed to talk in terms of solutions without regard for scarcity. My role was to put parameters on their utopia and get the students to think carefully about a couple questions related to issues they care about:

  • Compared to what?
  • What happens next?

The students seemed to like the class, but, for a committed group of people who want to change the world it was also quite a downer. It was a downer for them the same way economics is a downer for people at cocktail parties.

We start with scarcity. Scarcity is a fact of life. There are never enough resources to satisfy everyone and there will always be unmet desires. For the economist, the notion of trade-offs — you must give up one thing to get another — flow from this scarcity. It means that anytime a solution to a problem is attempted you are always giving something up.

For example, the death of George Floyd this summer sparked conversation about how to reduce police violence. One approaching to curbing this important social problem is to eliminate or reform qualified immunity (QI). This is a legal doctrine intended to protect police and others from frivolous lawsuits. The problem is that QI has made accountability extremely difficult. The logic of reforming QI is that doing so will increase accountability, raise the cost of police violence, and therefore lead to less police violence. That’s good economics.

But, remember there are trade-offs. In a new world where police are opened up to lawsuits, local government might need to increase police compensation to retain or attract qualified men and women. Where does the money come from? Can you reduce the number of police and/or will you have to raise taxes? There are other trade-offs too. Will police become more reluctant to enter dangerous neighborhoods? After all, there is a greater chance that inserting themselves into a risky situation will lead to financial ruin.

Moving from heavy to light. If you haven’t seen Yoram Bauman’s comedic schtick on Principles of Economics Translated, take five minutes and check it out here. As he illustrates, “economic profit” depends on alternatives: A Snickers bar valued at one dollar with no alternative implies an economic profit of $1. However, if the alternative was M&Ms that you value at 70 cents then your economic profit is 30 cents … Your profit from pursuing one course action declines as the value of the alternative increases.

By accounting for trade-offs the net benefit of a course of action goes down. When we bring up trade-offs in conversation, economists effectively eat into people’s mental profits for some course of action.

Another thing to consider, when you’re intervening, that intervention can sometimes have dramatic side effects that you didn’t even think about. You cannot merely move people around as if they’re pieces on a chessboard (head nod to Adam Smith).

For example, it is possible that eliminating qualified immunity leads to less police violence but more neighborhood violence overall if police decide not to insert themselves into situations that could be more costly. Beyond this hypothetical example I have been using, there are loads of other unintended consequences economists talk about.

Thinking in this way is the bread and butter of economists. This is how we see the world. But, don’t try this in social settings. As EconTalk host Russ Roberts once commented (this podcast), a pleasant picnic veered into chilly company when he pointed out someone’s proposed minimum wage could have negative employment effects. The others at the picnic started to inch away from him on the picnic blanket. At parties, I’ve had people talk about the idea that a tax won’t effect them because it is only on sellers, homeowners, etc. I’ve had to ask myself, “Is it worth it to bring up that the tax is likely to be passed through?”

So while my last couple posts sing the praises of economics, I should let you know, at cocktail parties people don’t like to think about scarcity, tradeoffs, and unintended consequences. Economists like to think about the seen and unseen. Many others, especially in social settings, would rather the unseen remain unseen.

Experience at a lower price

In an earlier post, I discussed the idea that memorable and persuasive arguments have the force of logic, credibility, and emotional appeal. Economists who stink at emotional appeal do so to their own detriment. One strategy to make an emotional appeal is to use the power of beauty to promote a sense of wonder and awe (see here). In this post, I discuss the use of experience in the classroom. 

This idea really hit home with me in an EconTalk podcast with Milton Friedman. In that episode, Friedman suggested that public appetite for price controls was low — not because economists educated the public on their dangers — but because people still remembered the long waiting lines for gasoline. Once those memories faded, or the people who experienced those lines died, there would be a renewed desire for price controls.

Gas Lines Evoke Memories Of Oil Crises In The 1970s : The Picture Show : NPR

Experience is important. But, the gas lines were a costly way to learn that lesson, especially if the lesson needs to be re-learned in every generation. How can we give students experience at a lower price? We can tell them stories from experiences around the world. I am in favor! I love case studies and their thick descriptions. At some point I will blog about my favorite stories to tell. But, for this post, let me propose the widespread use of classroom experiments.

The basic idea of a classroom experiment is to embed students inside an economic environment and give them a goal to maximize. For example, in an experiment on supply and demand students are embedded in a market institution and serve as either a buyer or seller. Their goal is to buy something at a low price or sell at a high price. These experiments can be run either with paper-and-pencil or electronically.

Talking Through the Results: Competitive Market Game

To show how these experiments can result in emotional appeal, let me recount a story. In a unit on price controls, I had students participate in a market without price controls followed by a market with a price ceiling. Back when I taught the Economics of Compassion class at FSU — specifically to the Social Justice Living Learning Community — I remember the following (quoted from here): 

“The market without a price control demonstrated smooth convergence to the equilibrium prediction. The double auction with the price ceiling was chaos. Once the frenetic burst of trades stopped, buyers started yelling at sellers, “Post some asks!” and “Why aren’t you selling anything? We’re posting bids, why aren’t you doing anything?” The sellers of course shot back, “If we sell [at the max price] we will lose money!” It was chaos! I remembered that visceral reaction, the frustration, and the silence as all students waited with no trades happening … tick-tock, tick-tock, until the clock timed out. They felt the shortage. Students would stop me on campus (sometimes years later) saying they remembered playing that game.”

Experiments enhance credibility through engaging students in theory testing. But, to close I want to emphasize that experiments also help provoke visceral reactions and audible sighs. Experiments can help provide experiential punch in different institutional contexts at a low price. All of that connects students to the material in a way our logic and credibility alone cannot do.

The Problem of Paying Attention in Online Classes

Currently, I subscribe to Bloomberg Businessweek. Instead of ranking MBA programs, this year they decided to report on a survey of students about switching to online classes. (in the Sept. 21 issue)

Overall, the reaction from students has been negative. They believe an online MBA is not as valuable as the traditional in-person experience.

Something MBA students state, which I have already heard from my own undergraduates, is that it’s difficult to focus during online instruction hours. If your face isn’t being watched through your webcam, then it’s tempting to “multitask” and not pay attention to the professor. I feel the same temptation when I join online research seminars.

What’s the most sympathetic view of this situation? Doing your online classes “isn’t that hard”. I feel like the scold looking over my bifocals at millennials saying, “going to a dry cleaner isn’t that hard”. (We millennials cannot be bothered to go to a dry cleaner.)

Here’s my first and brief thought: College students today have been taught to use screens for recreation by their parents.

Parents put kids in front of screens to get rid of them. I get rid of my own kids by putting them on screens. I ensure that they are not watching something evil.

I hope parents are diligently ensuring that their preteen daughters are not chatting up predators. What responsible parents have been told is to try to limit total screen hours and also to try to keep your child out of the digital equivalent of dark alleys.

That kind of guidance doesn’t teach students how to use screens constructively. They are suddenly being asked by teachers to be constructive on the screen. Some of them can hack it. Some of them can’t. None of them were prepared for this.

Your typical 20-year-old college student today must have done well in traditional classrooms because they did, after all, get admitted to college. But when they were on their screens, they were scrolling and gaming and indulging their impulses. As long as they physically showed up to class on Monday morning and turned in enough homework assignments, no adult was going to make them do chores on screens.

Since screens are here to stay, we need a lot more research on how to raise humans who know how to be responsible on screens.

No answers came to me when posed this question to the hive mind:  

The Most Valuable Class I Took

In middle school, when I was about 12, I had a rotating non-academic period in my schedule. For at least 6 weeks, I can remember we had a typing class. We would go into the school computer lab and practice “touch typing”. I typed the letter “f” with my left index figure hundreds of times. They made us put a cover over our hands to force us to practice typing without looking.

I resented that class. I hated taking the long way round. I hated typing the letter “f” over and over. Since it’s so boring, I don’t know if I would have forced myself to learn QWERTY touch typing. Part of the value of school is a framework in which you do things that you don’t have the discipline to do on your own. (Tyler Cowen has written somewhere about teachers as coaches, but I could not find the link.)

Looking back, this is the most valuable thing I did in school. I’m writing this post almost as fast as I can think of the words.

Learning to type is not useful if you can’t read or write. I’m not saying that nothing else I did in school was valuable. Also, I recognize that this would not be the most valuable class for every student.  

There is the potential for Speech to Text to make touch typing obsolete. I don’t think I would work better that way and I do not personally know any professionals who write using Speech to Text.