DCF Nerds http://www.dcfnerds.com Applying Undue Dilligence Mon, 17 Oct 2016 21:43:01 +0000 en-US hourly 1 https://wordpress.org/?v=4.6.6 40425663 Is Hearthstone’s Heroic Tavern Brawl worth it? http://www.dcfnerds.com/702/is-hearthstones-heroic-tavern-brawl-worth-it/ Mon, 17 Oct 2016 21:28:15 +0000 http://www.dcfnerds.com/?p=702 TL;DR: If you’re a scratch player, Heroic Tavern Brawl has a slightly higher expected value than purchasing an equivalent amount of packs in the store. However, it has far less value than purchasing the same number of packs via gold.

My little brothers introduced me to Blizzard’s Hearthstone about a year ago. It and Factorio are the only games I play these days. If you have no idea what I’m talking about, then click here.

Today, Blizzard announced a new week-long mode called Heroic Tavern Brawl. For an entrance fee of $9.99 (or 1,000 gold), players are allowed to construct a deck and play in a makeshift tournament until they achieve either 12 wins or 3 losses. The more you win, the better the rewards.

Is it worth playing? I crunch the numbers in this Excel Book and explain below the fold. If you download the file, you can customize the calculation to your own situation.

Per the game files, the payouts are as follows.


In order to compare the value of different numbers of wins, I attempted to break everything down into dust on table 2.1. I assumed that a pack would, on average, produce 100 dust and that random golden legendaries would be dusted for a value of 1,600. If your collection is less than complete, then you might value some of these draws more highly, but this effect is also true of your opportunity costs, so I wouldn’t bother modeling it.


On table 1.1, I calculated the probability of achieving various records given a particular win rate. The resulting expected value of dust is calculated at the bottom.


For a scratch player who wins as often as he loses, he or she can expect to make 711 dust per HTB run. If they instead spent their hard-earned money at the store, $9.99 would buy 7 packs, which is worth 700 dust on average.

However, if they were to buy entry with in-game currency, they could buy 10 packs in the store for a total expected dust of 1,000. This is a much larger hump to get over.


Of course, if you’re the kind of whale who is used to purchasing packs in 60-unit increments, you have to expect more than 856 dust per HTB run for this to be worth it.

By changing the win percentage and using Excel’s Goalseek feature, you can calculate the necessary win rate to expect 1,000 dust / HTB run. It’s 55.32%. Given that you will be playing against other players who expect to win more than 55.32% of the time, you probably shouldn’t enter unless you have a strong understanding of the current meta-game. Since I can’t reliably beat midrange shamans, I’ll probably stay away, but I’ll give it a try if and only if streamers are showing off HTB matchups that I think I can win. I like the idea of a higher stakes game.

If this post is popular, I might make some calculators for the effectiveness of combo-heavy decks and optimal deck selection given the current meta. It would be a good excuse to learn theano. Until then, you can find me on ladder getting salty over tunnel troggs.

Do company valuations react to market sentiment with a lag? http://www.dcfnerds.com/698/do-company-valuations-react-to-market-sentiment-with-a-lag/ Wed, 27 Jul 2016 01:24:17 +0000 http://www.dcfnerds.com/?p=698 According to their website, Duff & Phelps “is the premier global valuation and corporate finance advisor with expertise in complex valuation” and other fields. According to their annual Valuation Handbook – Guide to Cost of Capital, most stock valuations react to market news with a lag.

Often, valuators use conclusions of this model to make meaningful decisions about pricing company risk.

If the model isn’t true, then we will need to rethink the way we value companies — likely in a way which increases the value of closely held businesses. They will systemically overstate the risk of publicly traded corporations and therefore understate the value of closely held firms.

If the model were true, one could utilize the predictions to almost effortlessly make untold fortunes in the stock market.

I’m publicly sharing the results of my research, so I imagine you can guess where I stand on the question.

I am not comfortable using the “sum beta” methodology to estimate the riskiness of an individual stock. Any observed difference between the normal beta and the sum beta is likely the result of statistical noise. Unfortunately, this invalidates the conclusions of the Duff & Phelps methodology. Their industry risk estimates are likely biased in an upward direction.

I didn’t want this to be the result. I wanted to find an easy way to consistently beat the stock market, but I’m going to have to keep looking.

Introducing Analyzing Technical Analysis http://www.dcfnerds.com/683/introducing-analyzing-technical-analysis/ Fri, 12 Feb 2016 04:01:23 +0000 http://www.dcfnerds.com/?p=683 I’m happy to announce a new series of pages: Analyzing Technical Analysis.

I frequently read people talking about Moving Average Crossovers, Bollinger Bands, Relative Strength Indexes and other indicators that allegedly allow traders to beat the market. The default algorithm at QuantConnect uses volume-weighted moving averges to beat the market. A few weeks ago, my Uber driver told me he uses Average True Ranges to trade the currency market.

It’s hard to believe all these strategies are being discussed if there’s nothing there. Then again, it’s also hard to believe a successful currency trader would drive Uber.

This series of posts is an attempt to rigorously and thoroughly check the effectiveness of technical analysis indicators through a series of iPython notebooks. In the notebooks, I’ll do my best to set my biases aside and objectively test the facts. In posts such as these, I’ll share my conclusions.

In the initial block of posts, I tested how returns react in the days after moving averages cross each other and when prices “bounce” off moving averages. (Click here for results and here for a guide to interpreting results.) In every strategy for every horizon, nothing close to statistically significant returns are observed. The strategies failed so spectacularly, I almost felt guilty about making my computer subset white noise so many times.

Regardless, it has been a good exercise. The past two weeks haven’t taught me how to beat the market, but I did finally have a good excuse to make the jump from R to Python, I learned how to perform bash scripting and I developed an objective way to test trading strategies.

With some luck, the next strategy I try will make me fabulously wealthy.

Captain Morgan Consulting LLC Internal Style Guide http://www.dcfnerds.com/593/captain-morgan-consulting-llc-internal-style-guide/ Wed, 11 Feb 2015 18:30:36 +0000 http://www.dcfnerds.com/?p=593 freightTrainWrite like a freight train.

Try to remove “that,” “had” or any of its derivatives. “You’ll find that you can often live without them.” vs. “You’ll find you can often live without them.”

Actually, remove every word you can. You can live without them.

When possible, place adjectives and adverbs before the words they modify. Be on a continuing mission to boldly split infinitives which have never been split before.

A colorful word is better than a colored word. When possible, replace adjectives with meaningful nouns and adverbs with meaningful verbs. “It’s a big mess.” vs. “It’s a debacle.” “Fournette ran hard through the line.” vs. “Fournette muscled through the line.”

Deliberately use adverbs. Long, descriptive, meaningful chains of modifiers can subtly and delightfully overwhelm the reader’s working memory. If you want your readers to process with abundant attention, dutifully remove adverbs. If you want your readers to be gleefully hypnotized, happily unpack your favorite adjectives and adverbs.

Develop an allergy to passive sentences. The subject of the sentence is a woman. It comes first. Be chivalrous.

Avoid using the same word twice. Writers write well when they write with variety.

Active readers anticipate. When they’re correct, they pay less attention. Be unpredictable. Leave no phrase unturned, unless it’s literally your first rodeo.

Never use the word “this” by itself. “This confuses the reader.” vs. “This mistake confuses the reader.”

Start and end every paragraph with the most important sentences. They’re the only parts skimmers will read. The insides are the least important. Use this space to confess your regrets. I said those hurtful things because I wasn’t ready for a relationship. You know you’re gorgeous, girl. I’m ready to try again when you are. In technical writing, the reader needs to identify the section that answers their question. Give the people what they want. Be easy to skim.

Write simply. Call a spade a shovel.

Write often. The brain has limited space for works in progress. You can’t fill the queue until you’ve emptied it. Finish what you start and move on to the next one.

Write quickly. When I was younger, I used to wake up every morning, write for ten minutes and then literally burn the paper. I trained myself to believe the first draft doesn’t matter.

Edit carefully. Changing the formatting can help you freshly focus. Try printing your pieces or dramatically changing the font size.

Read often. You are what you eat.

Vary sentence structure. Simple sentences have one independent clause. Compound sentences have two independent clauses, and they’re usually separated by a comma and a coordinating conjunction. Complex sentences have both an independent clause and a dependent clause, a clause that can’t be a sentence on its own. Know the difference.

Simple sentences are read quickly. Quick readers can get bored.

If you compound together multiple complex sentences, then the reader will have to read slowly, and they can give up.

Don’t let your reader get too hot or too cold. Make them work, but not too hard.

When in doubt, ask: What would Ernest Hemingway do? Unless it’s suicide, do that.

Fuzzy VLookUps http://www.dcfnerds.com/572/fuzzy-vlookups/ Tue, 03 Feb 2015 15:00:47 +0000 http://www.dcfnerds.com/?p=572 As you probably know, there’s a very useful Excel formula called VLOOKUP() which allows you to reference lookup tables and return the appropriate value.

On an Excel user support forum, I had previously linked to some formulas that provided “fuzzy” vlookups. In the event a perfect vlookup match couldn’t be found, the custom formula FUZZYVLOOKUP() returns the closest match available. The post has since 404’d, so I was asked to rehost them.

Click here to download a sample workbook.

If you open up developer mode, you’ll see a code module containing two custom functions: LIKENESS() and FUZZYVLOOKUP(). The former compares two text strings and returns a numerical measure of how similar they are (1 is perfectly similar, 0 is completely dissimilar). The latter iterates the likeness formula across a lookup table and returns the appropriate column of the best match. Both of these functions are demo’d below:


Please note that FUZZYVLOOKUP() uses four arguments:

  1. The lookup value.
  2. The lookup table.
  3. The column from the lookup table you’d like to return.
  4. The minimum acceptable likeness. (In this example, I used 0.2).
Super Bowl Calibration Post http://www.dcfnerds.com/567/super-bowl-calibration-post/ Mon, 02 Feb 2015 18:34:15 +0000 http://www.dcfnerds.com/?p=567 Now that football’s over, I’m about to enter my annual “What should I do with my weekends?” phase. Before that, I’d like to revisit my predictions under the cold light of morning (but not the blue light of mourning). If you’re not interested in the Super Bowl, here’s a video of a Superb Owl. More math posts are on the way.

On January 27th I wrote a six point list entitled “Reasons the Pats will win.” Let’s see how I did in hindsight.

1. Seattle can’t keep up if it turns into a shootout, especially if Revis takes away their WR1. The 3 receiving leaders for the Patriots logged 1124, 972 and 953 yards. The top 3 receiving leaders for the Seahawks logged 825, 537 and 367 yards. Seattle without Baldwin is a mediocre offense.

I’ll give myself half-credit here. I don’t know if that qualifies as a shootout, but under Wilson the Seahawks are now 1-8 in games where the opponent scores more than 24 points. Patriots cornerback Revis took Baldwin out the game. His only catch came when a ref scraped Revis out of coverage. What I didn’t predict was Seahawks receiver Chris “Please Don’t Nickname Him Hardball” Matthews making his first four NFL catches for 109 yards. Seattle has once again transmogrified an absolute no-name into a super star.

2. Brady’s strength comes from quick passes identified before the snap. The ‪#‎LoB‬ is neutralized by the mismatches Brady will find.

I expected Brady to successfully beat the vaunted Legion of Boom. I didn’t expect Seattle to completely stack the box and make it easy. Brady completed 37 of 50 passes for 328 yards and 4 touchdowns. He was aided by the early injury to Lane, but Brady defeated the best secondary in the league to earn his third Super Bowl MVP.

3. Brady is beaten when his progressions are rattled by a strong pass rush, like he experienced in KC. Seattle doesn’t have a pass rush this year. In the NFC Championship, Aaron Rodgers playing on crutches was sacked once. Once!

I deserve to gloat on this one. On one of the first two series, I remember Seattle fielding a hilariously ineffective blitz before Brady casually completed a pass for a first down. High fives were exchanged, and I started counting my chickens. I can only remember the pass rush being effective on two occasions: On Brady’s first interception and on Seattle’s lone sack of the day. Everyone knows how to beat a healthy Patriots team, but few teams can successfully do it.

4. Seattle’s defense is historically great, but it can be beaten by strong TE play. Per ESPN, the Seahawks ranked 15th in fantasy points allowed against TE’s. Admittedly not the best measure ever, but it should give 12s pause. Mr. Fiesta is healthy.

Seattle deserves credit for covering Gronkowski well. On ten targets he was limited to 6 receptions for 68 yards. Unfortunately for Seattle, they were 68 very well-timed yards.

5. In hindsight, Seattle’s schedule doesn’t look as hard as it once did. A lot has been made of their recent winning streak. Since losing to KC, Seattle has beaten twice a headless Cardinals team, twice a 49ers team whose HC was having passive aggressive wars with management, an Eagles team starting a late-season slide, a 6-10 Rams team, the winner of the NFC South and an injured Aaron. Decidedly mediocre.

Nothing tangible to evaluate, so I’ll use this space to talk about the coaching breakdown, since Seattle’s final offensive play-call could be cast as hubris.

Most coaches in Belichick’s situation likely would have taken time outs to preserve as much time as possible for a comeback drive. Instead, BB let the clock run after Lynch put the Seahawks 1.5 yards away from winning the game. With one time out left on 2nd and glory, the Seahawks wanted to throw a pass. Assuming it falls incomplete and stops the clock, they still have time to run the ball, take a time out and then run the ball again. If the Patriots had used one of their two time-outs, they would likely have run the ball three times instead. BB deserves all the credit in the world for seeing how the decision tree laid out and taking the best path to victory. The Seahawks deserve to be blamed for being predictable. Patriots players claim they called the play based on the personnel, and they made a great play on the ball.

What a tremendous finish to an epic game. It’s not every day you get to see a team get thoroughly out-coached in a series of seconds.

6. The real world isn’t fair. Sometimes the villains wins. Despite the public outrage against spygate, psigate, BB’s grumpiness or whatever other rationalization the jealousy provokes.

The Patriots are the most successful franchise of the 21st century. It’s not even close. There’s a cost to winning, and it’s absolute hatred. As a fan of an NFC team, I have a bit more perspective to be objective.

Two weeks ago, after the Patriots demolished the Colts in the AFC Conference Championship, rumors arose the gameballs had been deflated. Outragists predictably tripped over themselves to be the most offended. There’s evidence the discrepancy could have occurred naturally. If the same scandal had occurred to a less hated franchise, it’s hard to imagine the same reaction. Let’s examine the glass house that accused the Patriots of cheating. This season, the Colts have been accused of pumping artificial crowd noise into their stadium. Assuming both clubs cheated in the alleged manner, this chicanery almost surely has a larger effect on the outcome of the game. It’s hard to not think the Patriots are hated out of jealousy.

Or, to turn the spotlight on that other team that played last night, why is their no public outrage over the fact that the Seahawks lead the league in Performance Enhancing Drug suspensions? Let’s leave aside head coach Pete Carroll’s history at USC and just focus on the facts. Best case scenario, the Seahawks players were taking adderrall to improve their film study. Worst case scenario? The drug test doesn’t distinguish between adderrall and other amphetamines. I’ve seen Breaking Bad. I imagine some variants of amphetamines in a game would improve your focus and competitiveness. I imagine they would also make you conduct very emotional media interviews or get into fights after games.

It’s wrong to irresponsibly speculate. I’m not saying Seahawks players definitely outperform their draft position through performance enhancing drugs. It’s not my place to jump to that conclusion.

And yet, no quarter is given to the Patriots who are tarred and feathered by an angry mob because a ball boy took a dozen footballs into a bathroom for 90 seconds. It’s hard to be a winner.

But it sure beats being a loser.


Matrix Multiplication in Excel — Markov Chains http://www.dcfnerds.com/536/matrix-multiplication-in-excel-markov-chains/ Fri, 30 Jan 2015 15:00:08 +0000 http://www.dcfnerds.com/?p=536 This post is part of the “Matrix Multiplication in Excel” series. It’s composed of a math introduction, a silly interlude and an interactive tutorial (you are here). By the end of the series, you’ll learn how to perform Markov Chain calculations, which are used in some damage calculations.

Now that we know some of the basics, I’m going to introduce a toy problem where one would use matrix multiplication, step through how to calculate it in Excel and then give an example used forensic economics.

Click here to download Matrix Multiplication.xlsx.

Scenario 1: Ping Pong Problem

Suppose two ping pong players (labelled left and right) are tied near the end of a game. In order to win, one of them has to have a two point lead. Suppose that, on any given volley, the left player has a 55% chance of winning.

The game can be thought of as having five states:

  1. (2,0) – The left player wins.
  2. (1,0) – The left player is winning by one.
  3. (0,0) – The game is tied.
  4. (0,1) – The right player is winning by one.
  5. (0,2) – The right player wins.

Graphically, the transitions between these states can be seen as follows.


The left player increases his score with the probability p(LW), in this case 55%. How do we calculate the probability that the left player wins?

This problem can be formalized as a Markov Chain, a mathematical system in discrete-time which transitions through various states.

To simulate a Markov Chain, start by creating a matrix P1 of size 1 x s where s is equal to the number of states. Element p1_{1,j} gives the probability the system starts in state j. Next create a transition matrix T of size s x s. Element t_{i,j} gives the probability the system moves from state i to state j.

In this example, we’ve stated the game starts at tied in state (0,0). The starting probability vector and transition matrix are displayed below.


Now we get to the value of matrix multiplication. As discussed previously, multiplying a 1 x s matrix by an s x s matrix produces a 1 x s matrix. If you step through the math of matrix multiplication, you’ll see that multiplying P1 by matrix T produces the probability the system will be in a given state in at the start of the next serve. This process can be iterated indefinitely to generate probability distributions at any given interval of time. The first ten steps are shown below.


Starting with a tie game, after two serves there’s a 30.25\% chance the left player will win, a 20.25\% chance the right player will win and a 49.50\% chance the game will still be tied. With enough iterations, we can see that there’s approximately a 59.90\% chance the left player will win.

Scenario 2: Racquetball Problem

In the Excel book, I also included a second scenario for a racquetball-like scoring system where you only score points if you’ve served. The slightly more complex state diagram and iterations are displayed below.



By changing the inputs, one could use this model to answer questions like “what is the value of serving first?” or “how often does the ‘better’ player win?”

Creating Matrix Multiplication Problems in Excel

Matrix multiplication in Excel is slightly different from standard formulas because the returned result is an array of numbers. Usually, excel formulas return a single result.

Instead of using a standard formula, you will have to use an array formula. To create a normal formula, simply type it into the cell and type “enter.” To create an array formula, instead press “control-shift-enter.” This will add curly braces around the formula to let you know it’s an array formula, as seen in the following screenshot. In some circles, these are called CSE formulas because of the key stroke which creates them.


To see how to create matrix multiplication CSE formula, follow these steps:

  1. Clear the iterated matrix multiplication in scenario 1.
    • Use Ctrl-G to select “‘S1. Matrices’!B14:F62.” Press delete to clear the contents.
  2. Select range B14:F14. Leave B14 as the “active cell.”
  3. Enter the following formula into B14:
    • =MMULT(B4:F4,B7:F11)
    • Press “Control-Shift-Enter” to have this formula applied across the entire selected range.
    • I’ve named the ranges “S1.MA” and “S1.MB”, respectively. Feel free to use these “dynamic range names” in your formula instead.
  4. Repeat the process for the remaining iterations, except replace “S1.MA” with the previous iteration.
    • Make sure you use proper absolute/relative references so the process continues downwards.
    • For row 15: =MMULT($B14:$F14,$B$7:$F$11)
    • For rows 16 and on, you can Copy and Paste-Special Formulas.

If you receive an error while trying to implement matrix multiplication in Excel, you’ve likely specified an incorrect number of dimensions. As we discussed in a previous post: When you multiply an m x p matrix by a p x n matrix, you produce an m x n matrix. The number of columns in the first matrix has to match the number of rows in the second matrix. The resulting matrix will have the number of rows from the first matrix and the number of columns from the second matrix.

Markov Chains in Economic Damage Cases

Markov Chains are commonly used to measure lost earning capacity. In any given year, a subject can be in one of several states (i.e. employed, unemployed, dead). Hopefully the analog to the ping pong problem is clear. Statistical information can give us “transition probabilities” which state the probability of a worker moving from one state to another based on the the current state. A currently employed worker is more likely to be employed the next year than a currently unemployed worker. A dead worker will stay dead in the same way a finished game of ping pong will stay finished.

In every year, we are left with a probability of the subject being in the “employed” state, necessary information for valuing his or her potential income stream.

The ping pong example is memoryless. The game of ping pong doesn’t care if this is the first or thousandth time the right player has been one away from winning. In some more sophisticated Markov Chain calculations, the transition probabilities depend on not only the current state but the state of prior years. For instance, a subject who has been employed for the past two years is more likely to be employed next year than a subject who was gainfully employed for only one year.


We’ve covered a lot of ground in this series. We learned the basics of linear algebra and Markov Chains. We learned how to implement these concepts in Excel and even considered the thermodynamic consequences of living in the Matrix.

If you were intimidated by any of these concepts before, hopefully I’ve unpacked them enough to take the magic out. Like most apparently complex things, matrix multiplication is merely a few simple things done many times over.

Matrix Multiplication in Excel — What is the Matrix? http://www.dcfnerds.com/528/matrix-multiplication-in-excel-what-is-the-matrix/ Fri, 23 Jan 2015 15:00:31 +0000 http://www.dcfnerds.com/?p=528 This post is part of the “Matrix Multiplication in Excel” series. It’s composed of a math introduction, a silly interlude (you are here) and an interactive tutorial. By the end of the series, you’ll learn how to perform Markov Chain calculations, which are used in some damage calculations.

‪‎Trigger Warnings‬: Authorial Self-Insertion, In Medias Res, Movie References, Fake Trigger Warnings


Just a few days ago, I had been lying on my back, surrounded by doctors, atrophied and struggling to gasp for breath. This man wanted billions of humans to experience the same process. A note of discord rang through my heart as I tried to imagine the whole of humanity simultaneously squinting as they adjusted to their new eyes.

Morpheus misinterpreted my discomfort and didn’t miss a beat.

“We don’t know who struck first, us or them. But we do know it was us that scorched the sky.”

Apparently the red pill came with a lot of side effects. I closed my eyes in a vain attempt to make the room stop spinning.

He continued. “At the time, they were dependent on solar power. It was believed they would be unable to survive without an energy source as abundant as the sun.”

This was starting to look like a truly interesting problem. If I stuck with the rebels, I’d have to defeat swarms of killer robots, awaken all of humanity and create a society out of billions of frail and broken humans. And, I wouldn’t even have sunlight because apparently the “good guys” had “scorched the sky.” Something didn’t seem right. My grip on the chair tightened, and I felt myself getting colder.

“Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. The Matrix is a computer-generated dream world built to keep us under control in order to change a human being into this.” Morpheus reached into his jacket and produced a battery.

Words failed me. You can’t give a zygote enough energy to become a human and then expect to get back even more energy by turning him into a battery. To be fair, maybe physics works differently in “the real world,” but…

“No,” I stammered. “I don’t believe it. It’s not possible.”

“I didn’t say it would be easy, Neo. I just said it would be the truth.”

“Woah,” I said out loud. That was the most pretentious thing I’d ever heard.

“You are a slave, Neo. Like everyone else you were born into bondage. Into a prison that you cannot taste or see or touch. A prison for your mind.”

“No. This doesn’t even make sense. If the machines can make batteries out of animals, why would they use humans? Wouldn’t they use chickens or something easier to domesticate?”

“There are fields, Neo. Endless fields where humans are no longer born, but grown. I saw them myself. I don’t know why they use humans, but they do. Man cannot fathom a machine’s mind.”

“Well, we should try. I don’t want to fight an enemy until I understand them. Just give me a second to think.”

I sat in silence and ran through the narrative. Was it possible the machines had set up a retirement program for the enemy that had ruined the planet? I’m not sure I would have been as forgiving.

A literal second later, Morpheus continued. “Neo, you’re here because you were seeking the truth. I had hoped you would be ready for it.”

“About that. I was actually just brushing up on linear algebra.”

“Didn’t you Google search ‘What is the Matrix’?”

“Yeah, that autocompleted. I was looking up ‘What is the Matrix index order?’ I was trying to remember if rows or columns come first.”

Morpheus took off his impossible sunglasses and crumbled on the red leather chair. “It’s rows and then columns. M by N.”

“Thanks, Morpheus! Best of luck with all that other stuff. Really. Rage Against the Machine, or whatever. Anyway, could you please drop me off back in Houston? I have a lot of work to do.”

Matrix Multiplication in Excel — Math Introduction http://www.dcfnerds.com/460/matrix-multiplication-in-excel-math-introduction/ Fri, 16 Jan 2015 15:00:26 +0000 http://www.dcfnerds.com/?p=460 This post is part of the “Matrix Multiplication in Excel” series. It’s composed of a math introduction (you are here), a silly interlude and an interactive tutorial. By the end of the series, you’ll learn how to perform Markov Chain calculations, which are used in some damage calculations.

A matrix (plural matrices) is a rectangular array of numbers, symbols or expressions arranged in m rows and n columns. For matrix A below, the element at row i and column j is indexed as a_{i,j}.


A Few Matrix Operations

Matrices have lots of applications, but it’s probably best to start by thinking of them as an abstract entity with a set of rules to learn. For example:

  1. Multiplying a matrix by a constant multiplies each element of the matrix by that constant.
  2. Matrices can be added or subtracted from each other if they have the same dimensions. The operation is parsed entry by entry.
  3. Transposing a matrix exchanges every row with its column and vice-versa. This is indicated through a superscript capital T.

For instance, suppose you had two matrices, A and B with the following values:


What would be the value of:


If you don’t have experience with matrices and want to learn, I’d recommend working out the answer yourself before clicking here for the answer.

Dot Products

One last operation before we turn to matrix multiplication. Dot products are performed on two equal-length sequences of numbers. In Excel, it is performed through the =sumproduct() function. Dot products are equal to the sum of the products of each corresponding row. For instance:



Matrix Multiplication

With these lemmas out of the way, let’s learn about Matrix Multiplication.

When you multiply an m x p matrix by a p x n matrix, you produce an m x n matrix. The number of columns in the first matrix has to match the number of rows in the second matrix.

Unlike traditional multiplication, matrix multiplication isn’t commutative. Five times seven equals seven times five. However:

  • 5 x 1 matrix times a 1 x 5 matrix produces a 5 x 5 matrix.
  • 1 x 5 matrix times a 5 x 1 matrix produces a 1 x 1 matrix.
  • 2 x 4 matrix times a 4 x 3 matrix produces a 4 x 3 matrix.
  • 4 x 3 matrix times a 2 x 4 matrix produces an error.

Each entry a_{i,j} is equal to the dot product of row i in matrix A and column j in Matrix B.

An example is provided below. In it, a 4 x 3 matrix is multiplied by a 3 x 2 matrix to produce a 4 x 2 matrix. Element 3,2 is stepped out, and the final result is displayed.


At this point, this post may seem exceedingly esoteric. Pardon my platonism. For now, trust me when I say that matrix multiplication, and linear algebra as a whole, are far more useful than they immediately appear. After a brief interlude, I’ll show you how to perform these calculations in Excel and an important application for financial expert witnesses. Stay tuned.

Quora Question: What are the strengths of Coasian Bargaining? http://www.dcfnerds.com/509/quora-question-what-are-the-strengths-of-coasian-bargaining/ Wed, 07 Jan 2015 21:38:40 +0000 http://www.dcfnerds.com/?p=509 I recently answered the following question on Quora:

What are the strengths of Coasian Bargaining?

Coasian Bargaining says that agents can negotiate away the effects of externalities if transaction costs are sufficiently low. Ideally, this will lead to an efficient outcome.

wellwellwellSuppose you want to drill an oil well that will make you $100. Suppose it’ll make the lives of 20 neighbors $1 worse. How is this problem approached in different countries?

  • In Non-Coasian Anacapistan, you drill the well and create $100 of personal utility and $80 of total utility. The twenty neighbors are $1 worse off, but they all read Ayn Rand, flex their forearms, and carry on with their grim resolve to build the kind of buildings they want to build.
  • In Coastopia, the neighbors say you can drill the well iff you pay them $2 each. You drill the well and gain $60 of value. The neighbors gain $1 of value each.
  • In Coasistan, the neighbors demand $6 each. The well doesn’t get drilled. No one wins except for the lawyers who negotiated the failed deal.
  • In StatusQuoVille, the neighbors all vote on whether or not the well should be drilled. Depending on who shows up to the polls, it’s either drilled or not. The winner takes all, and everyone hates each other.

Coastopia is clearly an unrealistic fantasy, but it has some enviable features and real-world take-aways. In my experience, those who spend time thinking about Coasian Bargaining are more likely to be impartial when assessing real-world externalitites. While some are quick to say that fracking should be outlawed because it disturbs the locals, those from the Coasian school of thought will consider other possibilities. Maybe oil companies should pay money to the locals. Maybe locals should pay oil companies to not drill. Maybe oil companies should pay locals to move. Coasian bargainers are more likely to consider creative solutions rather than simply banning productive economic activity of which they disapprove. This leads to more economically efficient outcomes. In my toy example, the drilling clearly should happen. Any outcome that doesn’t result in a new well misses out on $80 of total utility.

All that said, I wouldn’t want to live in Coastopia. Incentives work both ways, and you wouldn’t want to live in a world where the prevalence of Coasian Bargaining encourages potential externalizers to seek out situations to threaten. “That’s an awfully nice stream you have there. It’d be a shame if someone were to dump runoff into it. Perhaps you should pay me to threaten someone from the next town instead.” On net, the average man’s distaste of naked Coasian Bargaining may be a good thing.

In DanielMorganTopia, all questions like these are solved through Pigovian Taxes, an approach which doesn’t require perfect bargaining and has decent efficiency if the government is reasonably competent. But I don’t rule the world. Not yet.