Friday, June 26, 2020

Drunk and disorderly: not funny at company events

Loutishness isn't funny

Maybe I'm getting more puritanical as I get older, but I'm finding myself less and less tolerant of drunken loutishness at corporate events. I've seen too many instances where people have got away with poor behavior to the detriment of others and to the detriment of the organization as a whole. Let me tell you my stories; I've disguised some of the details to protect the guilty.


(Great when enjoyed responsibly, not so great when it leads to bad behavior on company time. Image credit: Wikimedia Commons (klimkin). License: Creative Commons Zero)

Ruining the lawn

One fine summer evening, the company I worked for held a large-scale open-air event. The aim was to play summer outdoor games and enjoy a drink or two in the company of our colleagues. The venue was extremely proud of its grounds and had obviously spent a lot of money creating and maintaining immaculate grass playing surfaces. Some of my colleagues realized there was no limit at the bar and set out to get drunk on company money; a task they succeeded at admirably. One of them decided it would be really funny to plant his glass in the middle of the grass. He turned his glass upside down and stomped it into the lawn. His friends thought this was funny, so they did it too. The next day, the groundskeepers discovered the stomped glasses and had to fix the damage, which meant the venue was unavailable for others. Net result? The company paid a penalty to repair the lawn and was banned from the venue (the only venue like it for miles). Everyone knew who the stompers were, but they got away with it.

The Christmas party

Christmas time seems to bring out the worst in some people at corporate events. I was at a large-scale company Christmas lunch where a lot of alcohol had been consumed. One of the employees decided it would be fun to start throwing food at other tables. The food fight escalated until someone soaked a small tablecloth in water, screw it up into a ball, and threw it at another table. It hit the other table like a bomb, exploding a carafe of red wine, splattering everyone in red wine and glass fragments. This was plainly very upsetting for the people on the table and brought the event to an end. Obviously, the company was banned from the venue, but this time I believe someone did have a word with one of the perpetrators and there was managerial discussion of curtailing bad behavior.

The overseas trip

Corporate events held away from home can be a lot of fun, but there can be problems too. I was at a corporate event held in a resort venue and I witnessed some unfortunate things. There was a mix of company people, who were getting everything for free, and vacationers, who had paid to stay at the resort. It was not a happy combination. The company people were away from family, off the leash, and with unlimited free alcohol. On the whole, their behavior towards paying guests was disrespectful at best. At one of the resort bars, I got chatting to a vacationing couple who complained to me about poor treatment from my work colleagues. The vacationers were very unimpressed by the rude and drunken behavior they saw. This was not a good company image to project.

Company culture and drunkenness

I'm happy to say, I haven't seen drunken behavior at my current employer and I think I know why. The company has taken great pains with recruitment and boorish behavior just isn't part of company culture. As a manager, I would be on top of drunken misbehavior immediately, and I believe my fellow managers would do the same too.

Advice to managers: stop it dead

Along with most managers, I've read my fair share of legal documents, case studies, and guidance. Pulling all this together, here are my thoughts:

  • You are never off-the-clock if you're at a company event or with company people. Even if a few work colleagues go out for a drink, it's still a company event.
  • Loutish behavior is not tolerable and there have to be consequences. Just as the workplace must be safe, it must be safe to be with work colleagues. It must be safe for non-employees to be around employees too. Managers need to jump on instances of bad behavior immediately.
  • Everyone must know what the rules are and there must be reminders. Managers must make it clear to new employees what's acceptable and what isn't. It's only fair that everyone knows what's expected of them.

I'm not against people having a drink at company events, I'm not even against people getting drunk at events, but I am against harmful behavior toward others. I want everyone to feel safe and to be safe.

Saturday, June 20, 2020

Being more persuasive in speech: anaphora

There are a host of rhetorical techniques known since antiquity to make you more persuasive and compelling as a speaker. Anaphora is one of them and it's in my top three convincing rhetorical techniques. It’s been used by everyone from Charles Dickens to Winston Churchill to Chance the Rapper. I’m going to tell you what it is and how you can use it.

Anaphora is the repetition of the same phrase at the start of adjacent clauses in a sentence or paragraph. Here’s an example from Charles Dickens' ‘A Tale of Two Cities’. The anaphora is in bold.

It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair…
-Charles Dickens – A Tale of Two Cities

Another good example of anaphora is the poem ‘If’ by Rudyard Kipling, here’s an extract:

If you can dream—and not make dreams your master;
   If you can think—and not make thoughts your aim;
If you can meet with triumph and disaster
   And treat those two impostors just the same;
If you can bear to hear the truth you’ve spoken
   Twisted by knaves to make a trap for fools,…
-If – Rudyard Kipling

Pretty much the entire poem is anaphora which he uses to build towards his point at the end.

Anaphora works by the repetition of the same words to link ideas into a coherent and memorable flow. It reinforces the point in an elegant way.

As you've seen, anaphora is effective in writing, but it also works well in speeches too. It can have a compelling and convincing effect as we’ll see. I’m going to play you an example of one of the most famous examples of anaphora. This time, I’ll give you some context for the speech before providing the audio link.

The year is 1940. France had fallen to the Nazi hordes and the disaster at Dunkirk had just occurred. The British people expected Hitler’s armies to cross the channel and invade imminently. Britain stood alone.

The place is the House of Commons in London. MPs too expected an invasion and expected Britain to fall. They knew many of their constituents, families, and friends would die.

And the person is Winston Churchill, the new Prime Minister. His job was to rally the nation and prepare the country for invasion and an existential fight.

Here’s the most famous piece of his speech - YouTube. Listen to the anaphora.


(Image credit: WikiMedia Commons - open source)

We shall fight… we shall never surrender.

The effect of this speech was electrifying. A friend told Churchill his speech was worth 1,000 guns. Opposition politicians openly wept and pledged support for Churchill. And this speech changed the national mood from one of defeat to one of defiance in the face of disaster.

So how might you use anaphora? Let’s imagine you’re giving a talk where you’re trying to persuade your company to spend resources on training, you could say:

The research shows that investing in training gives returns on staff retention, recruitment, and efficiency.

Or you could use anaphora to say:

Investing in training leads to higher staff retention and greater employee engagement,
Investing in training makes it easier to recruit good-quality people,
Investing in training lets us do our jobs more efficiently,
It’s time to invest in training.

I’ve used anaphora in speeches and in writing. You can too. It’s a great device to use when you have multiple points you want to make and you need to link them together.

Let’s listen to how Chance The Rapper used anaphora to link his points together: YouTube. The 'Oh now' anaphora allows him to construct a series of lyrical points and link them together with the same structure to make them work together in a catchy way. (As an aside, rap and hip-hop artists make incredibly inventive use of language - something they never get credit for.)

If anaphora is good enough for Charles Dickens, Winston Churchill, and Chance The Rapper, surely, it’s good enough for you too?

Reading more

This blog post is one in a series of posts on practical rhetoric. Here's the series:

Saturday, June 13, 2020

Death by rounding

Round, round, round, round, I get around

Rounding errors are one of those basic things that every technical person thinks they're on top of and won't happen to them, but the problem is, it can and does happen to good people, sometimes with horrendous consequences. In this blog post, I'm going to look at rounding errors, show you why they can creep in, and provide some guidelines you should follow to keep you and your employer safe. Let's start with some real-life cases of rounding problems.


(Rounding requires a lot of effort. Image credit: Wikimedia Commons. License: Public Domain)

Rounding errors in the real world

The wrong rounding method

In 1992, there was a state-level election in Schleswig-Holstein in Germany. The law stated that every party that received 5% or more of the vote got a seat, but there were no seats for parties with less than 5%. The software that calculated results rounded the results up (ceil) instead of rounding the results down (floor) as required by law. The Green party received 4.97% of the vote, which was rounded up to 5.0%, so it appeared the Green party had won a seat. The bug was discovered relatively quickly, and the seat was reallocated to the Social Democrats who gained a one-seat majority because of it [Link]. 

Cumulative rounding

The more serious issue is cumulative rounding errors in real-time systems. Here a very small error becomes very important when it's repeatedly or cumulatively added.

The Vancouver Stock Exchange set up a new index in January 1982, with a value set to 1,000. The index was updated with each trade, but the index was rounded down to three decimal places (truncated) instead of rounding to the nearest decimal place. The index was calculated thousands of times a day, so the error was cumulative. Over time, the error built up from something not noticeable to something very noticeable indeed. The exchange had to correct the error; on Friday November 25th, 1983 the exchange closed at 524.811, the rounding error was fixed, and when the exchange reopened, the index was 1098.892 - the difference being solely due to the rounding error bug fix [Link].

The most famous case of cumulative rounding errors is the Patriot missile problem in Dharan in 1991. A Patriot missile failed to intercept a Scud missile, which went on to kill 28 people and injured a further 98. The problem came from the effects of a cumulative rounding error. The Patriot system updated every 0.1s, but 0.1 can't be represented exactly in a fixed point system, there's rounding, which in this case was rounding down. The processors used by the Patriot system were old 24-bit systems that truncated the 0.1 decimal representation. Over time, the truncation error built up, resulting in the Patriot missile incorrectly responding to sensor data and missing the Scud missile [Link].  

Theoretical explanation of rounding errors

Cumulative errors

Fairly obviously, cumulative errors are a sum:


E = ∑e

where E is the cumulative error and e is the individual error. In the Vancouver Stock Exchange example, the mean individual rounding error when rounding to three decimal places was 0.0005. From Wikipedia, there were about 3,000 transactions per day, and the period from January 1st 1982 when the index started to November 25th, 1983 when the index was fixed was about 473 working days. This gives an expected cumulative error of about 710, which is in the ballpark of what actually happened. 

Of course, if the individual error can be positive or negative, this can make the problem better or worse. If the error is distributed evenly around zero, then the cumulative error should be zero, so things should be OK in the long run. But even a slight bias will eventually result in a significant cumulative error - regrettably, one that might take a long time to show up.

Although the formula above seems trivial, the point is, it is possible to calculate the cumulative effect of rounding errors.

Combining errors

When we combine numbers, errors can really hurt depending on what the combination is. Let's start with a simple example, if:


z = x - y 

and:
 
sis the standard error in z
sis the standard error in x
sis the standard error in y

then

sz  = [s2x + s2y]1/2

If x and y are numerically close to one another, errors can quickly become very significant. My first large project involved calculating quantum states, which included a formula like z = x - y. Fortunately, the rounding was correct and not truncated, but the combination of machine precision errors and the formulae above made it very difficult to get a reliable result. We needed the full precision of the computer system and we had to check the library code our algorithms used to make sure rounding errors were correctly dealt with. We were fortunate in that the results of rounding errors were obvious in our calculations, but you might not be so fortunate.


Ratios are more complex, let's define:

z = x/y

with the s values defined as before, then:

sz /z = [(sx/x)2 + (sy/y)2]0.5

This suffers from the same problem as before, under certain conditions, the error can become very significant very quickly. In a system like the Patriot missile, sensor readings are used in some very complex equations. Rounding errors can combine to become very important.

The takeaway is very easy to state: if you're combining numbers using a ratio or subtracting them, rounding (or other errors) can hurt you very badly very quickly.

Insidious rounding errors

Cumulative rounding errors and the wrong type of rounding are widely discussed on the internet, but I've seen two other forms of rounding that have caught people out. They're hard to spot but can be damaging.

Rounding in the wrong places - following general advice too closely

Many technical degrees include some training on how to present errors and significant digits. For example, a quantity like 12.34567890 ∓ 0.12345678 is usually written 12.3 ∓ 0.1. We're told not to include more significant digits than the error analysis warrants. Unfortunately, this advice can lead you astray if you apply it unthinkingly.

Let's say we're taking two measurements:


x = 5.26 ∓0.14
y = 1.04 ∓0.12

following the rules of representing significant digits, this gives us

x = 5.3 ∓0.1
y = 1.0 ∓0.1

If :

z = x/y

then with the pre-rounded numbers:

z = 5.1 ∓ 0.6

but with the rounded numbers we have:

z = 5.3 ∓ 0.5

Whoops! This is a big difference. The problem occurred because we applied the advice unthinkingly. We rounded the numbers prematurely; in calculations, we should have kept the full precision and only shown rounded numbers for display to users.

The advice is simple: preserve full precision in calculations and reserve rounding for numbers shown to users.

Spreadsheet data

Spreadsheets are incredible sources of errors and bugs. One of the insidious things spreadsheets do is round numbers, which can result in numbers appearing not to add up. 

Let's have a look at an example. The left of the table shows numbers before rounding. The right of the table shows numbers with rounding (suppressing the decimal places). The numbers on the right don't add up because of rounding (they should sum to 1206). 


  No round   Round
 Jan121.4   Jan  121
 Feb 251.4  Feb 251
 Mar 311.4  Mar 311
 Apr 291.4  Apr 291
 May 141.4  May 141
 Jun 91.4  Jun 91
 TOTAL 1208.4  TOTAL 1208

An insidious problem occurs rounded when numbers are copied from spreadsheets and used in calculations - which is a manifestation of the premature rounding problem I discussed earlier.

1.999... = 2, why 2 != 2, and machine precision

Although it's not strictly a rounding error, I do have to talk about the fact that 1.999... = 2. This result often surprises people, but it's an easy thing to prove. Unfortunately, on machines with finite precision, 1.9999... == 2 will give you False! Just because it's mathematically true, doesn't mean it's true on your system.  

I've seen a handful of cases when two numbers that ought to be the same fail an equality test, the equivalent of 2 == 2 evaluating to False. One of the numbers has been calculated through a repeated calculation and machine precision errors propagate, the other number has been calculated directly. Here's a fun example from Python 3:

1 == (1/7) + (1/7) + (1/7) + (1/7) + (1/7) + (1/7) + (1/7)

evaluates to False!

To get round this problem, I've seen programmers do True/False difference evaluations like this:

abs(a - b) <= machine_precision

The machine precision constant is usually called epsilon.

What to watch for

Cumulative errors in fixed-point systems

The Patriot missile case makes the point nicely: if you're using sensor data in a system using fixed-point arithmetic, or indeed in any computer system, be very careful how your system rounds its inputs. Bear in mind, the rounding might be done in an ADC (analog-to-digital converter) beyond your control - in which case, you need to know how it converts data. If you're doing the rounding, you might need to use some form of dithering.

Default rounding and rounding methods

There are several different rounding methods you can use; your choice should be a deliberate one and you should know their behavior. For example, in Python, you have:

  • floor
  • ceil
  • round - which uses banker's rounding not the school textbook form of rounding and was changed from Python 2 to Python 3.

You should be aware of the properties of each of these rounding methods. If you wanted to avoid the Vancouver Stock Exchange problem, what form of rounding would you choose and why? Are you sure?

A more subtle form of rounding can occur when you mix integers and floating-point numbers in calculations. Depending on your system and the language you use, 7.5/2 can give different answers. I've seen some very subtle bugs involving hidden type conversion, so be careful.

Premature rounding

You were taught to only present numbers to an appropriate numbers of decimal places, but that was only for presentation. For calculations, use the full precision available.

Spreadsheets

Be extremely careful copying numbers from spreadsheets, the numbers may have been rounded and you may need to look closer to get extra digits of precision.

Closing thoughts

Rounding seems like a simple problem that happens to other people, but it can happen to you and it can have serious consequences. Take some time to understand the properties of the system and be especially careful if you're doing cumulative calculations, mixed floating-point and integer calculation, or if you're using a rounding function.

Saturday, June 6, 2020

(De)motivational speakers

I’ve heard motivational speakers give messages completely contrary to company values and I’ve heard a motivational speaker encourage people to resign. I’ve heard speakers that made me feel good to be a part of the company and I’ve heard speakers that made me think. 

It might seem like a good thing for a company to bring in a motivational speaker, but it needs thought as we’ll see. Let’s start with the bad because that’s always more fun.

(Motivational speaking, old school. Image credit: Wikimedia Commons)

At one company I worked at, we had a talk given by a mountaineer who had climbed Mount Everest. They vividly described the struggle of the team to get to the top; the cold, the physical demands, the oxygen deprivation. The expedition got close to the summit, but some of the team were struggling and it was difficult to move forward together. The leadership made the decision to leave some of the team behind and make for the summit with just a handful. The small group made it to the summit and took their pictures at the top of the world. They celebrated their glorious achievement and the speaker spoke movingly of the elation they felt. Then they started to make their way down, meeting up with their colleagues they’d left behind. The speaker told us how bitterly disappointed the people who were left behind were. The leadership had to carefully manage relationships with those they’d left behind to get everyone off the mountain and safely back to base camp. Once they were back at base camp, it didn’t matter anymore because everyone dispersed.

It was a great talk delivered well, but…

The company I worked for at the time had a big thing about teamwork and carrying everyone with you. It was all about the collective way forward. But the talk seemed to have a couple of underlying themes; you need a big team to get to the top and if people are holding you back, you cut them loose so the high performers can achieve their goals. It seemed to me that the talk was completely at odds with the company’s values. Was the company now advocating that we leave people behind? As I heard this story, I wondered about the people in the audience, did they all identify with the group that made it to the summit, or did they think they might be in the group left behind? What does it mean to work in a company where you might be left behind so others can get to the summit?

A different company I worked for was having some trouble retaining staff but wanted to grow. At a company meeting, we had a speaker who had sailed in a major race. The speaker was great, he spoke about his impoverished background, how he stumbled across sailing but loved it. He told us how he sacrificed a great deal to afford to sail and how after years of struggle, he qualified for a major sailing event. He told us how hard the race was and the deprivations he suffered during it. But he also told us how elated he was when he finished and achieved his life’s ambition. His closing message was, you should never be content with where you are and that you should stretch yourself to achieve new goals, do new things, and go to new places. But...

One of my colleagues turned to me and said “did he just tell us to leave the company and go somewhere else?” I said that he’d just told us we could do better elsewhere. Both of us left the company within six months to get better jobs.

Let’s turn to more positive speakers.

I had the great fortune to hear Mark Cuban and Adam Savage (from Mythbusters) speak at a company event for customers. They didn’t say anything that supported the company’s values but they didn’t say anything to contradict them either - they talked about their own subjects, Mark Cuban spoke about innovation and management and Adam Savage spoke about Mythbusters and what happened on set. It was great to hear them speak and great to get some insight into who they are. I left the event with a good feeling about the company - I was happy I’d had this experience and felt gratitude to my employer for providing it for me.

Recently, I heard a speaker talk about how their family had built a clothing company chain of stores around exemplary customer service. Their stores are extremely high-end, serving CEOs and others at the top of their professions. He told stories of associates driving to customer’s houses to deliver items, of clothing shipped out overnight across America so a CEO could give a TV interview looking his best, of tailoring services provided free to high-end customers to win their business. It was an awe-inspiring talk and fascinating to see how the family had consistently built their business. As you can tell, I loved the talk. I was fascinated by how well they’d aligned their tactical activities towards their strategic business goals; for me, it wasn’t about customer service, it was about aligning incentives and actions towards a clear end goal.

I’ve had the opportunity to think about the motivational speakers I’ve heard and the effect they’ve had on people. On the face of it, it seems like a great idea to bring in a compelling speaker, but as we’ve seen, it can go wrong. I recommend motivational speakers, but with qualifications.

  • Listen to them speak and hear the entirety of their talk. Does it support your company values? Is there anything in the talk that might encourage behavior you don’t want (leaving people behind, encouraging people to quit)?
  • Brief your speaker on your company values and ask them to avoid undermining them. Speakers can choose to focus on parts of their story, and they could choose the parts that support your values.
  • Understand why you’re bringing in a speaker and the effect you want to have on your audience. Bringing in celebrities is fun and makes people feel good. Bringing in business people can make people think. Bringing in people who have a powerful story to tell can be moving. But what’s your goal?
  • Reinforce the message by having an executive point out the pieces they want the audience to take away. Never leave it to the audience or the speaker to decide the takeaways.

Saturday, May 30, 2020

Inventory: your job may depend on how it's managed

Why should you care about inventory?

For your own job security, you need to understand the financial position of your employer; their true financial position will govern your pay and promotion prospects. Long before they affect your job, you can spot looming signs of trouble in company financial statements. Learning a little of accounting will also help you understand news stories as we'll see. In this blog post, I'm going to talk about one of the easiest signs of trouble to spot, inventory problems. Because it's always fun, I'm going to include some cases of fraud. Bear in mind, innocent people lose their jobs because of inventory issues; I hope you won't be one of them. 


Inventory
(Is inventory good or bad? It depends. Image credit: Wikimedia Commons. License: public domain.)

Inventory concepts

Inventories are items held for sale or items that will be used to manufacture products. Good examples are the items retailers hold for sale (e.g. clothes, food, books) and the parts manufacturers hold (e.g. parts for use on a car assembly line). On a balance sheet, inventory is listed as a current asset, which means it's something that can be turned into cash 'quickly'. There are different types of accounting inventory, but I won't go into what they are.

Inventory changes can be benign but can be a sign of trouble. Let's imagine a bookseller whose inventory is increasing. Is this good or bad?

  • If the bookseller is expanding (more sales, more shops), then increasing inventory is a sign of success.
  • If the bookseller is not expanding, then increasing inventory is deeply concerning. The bookseller is buying books it can't sell.

There are two ways of valuing inventory, which opens the door to shenanigans. Let's imagine you're a coal-burning power station and you have a stockpile of coal. The price of coal fluctuates. Do you value your stockpile of coal at current market prices or the price that you paid for it? There are two ways of evaluating inventory: FIFO and LIFO.

  • FIFO is first-in, first-out - the first items purchased are the first items sold. Inventory is valued at current market prices.
  • LIFO is last-in, first-out - the last items purchased are the first items sold. Inventory is valued at historic market prices.

If prices are going up, then LIFO increases the cost of goods sold and reduces profitability, conversely, FIFO reduces the cost of goods sold and increases profitability. There are also tax implications for the different inventory evaluation methods. 

Obviously, things are more complex than I've described here but we have enough of the basic ideas, so let's get to the fraud stories.

Inventory shenanigans

OM Group produced specialty chemicals from raw materials, including cobalt. In the early 2000s, cobalt was mostly sourced as a by-product from mines in the Democratic Republic of the Congo, a very unstable part of the world. The price of cobalt was going down and OM Group saw a way of making that work to their advantage. Their first step was to use the LIFO method of valuing their cobalt inventory. The next step was to buy up cheap cobalt and keep buying as the price dropped. Here's what that meant; because they used LIFO, for accounting purposes, the cobalt they used in production was valued at the new (low) market price, so the cost of goods sold went down, so profitability went up! The older (and more expensive) cobalt was kept in inventory. To keep the business profits increasing, they needed the price of cobalt to go down and they needed to buy more of it, regardless of their manufacturing needs. The minute prices went up, or they started eating into inventory, or they stopped buying more cobalt, profitability would fall. To put it simply, the boost to profits was an accounting shell game.

OM Group logo at the time. Image credit: Wikimedia Commons. License: Public Domain.)

As you might expect, the music eventually stopped. The SEC charged some of the executives with fraud and reached a settlement with the company, and there was a class-action lawsuit from some company investors. Unsurprisingly, the company later changed its name when the dust settled. If you want to understand how you could spot something like this, there's a very readable description of the accounting fraud by Gary Mishuris, an analyst who spotted it.  

Manufacturing plants run best when producing at a constant rate, but market demands fluctuate. If demand reduces, then inventory will increase, something that will be obvious in a company's financial statements. How can a company disguise a drop in demand? One illegal way is through something called 'channel stuffing', which is forcing your distributors and resellers to take your unsold inventory so you can record it as sales. 

Semiconductor companies are manufacturers and typically have large distribution networks through resellers covering different geographies or markets. For example, a semiconductor company may sell directly to large electronics companies but may serve smaller electronics companies through resellers, who may, in turn, resell to other distributors and so on.

Between 1995 and 2006, Vitesse Semiconductor used channel stuffing extensively to manage its earnings. It had an arrangement with its distributors that they could unconditionally sell back any chips they had bought and not sold. Here's how channel stuffing worked; if Vitesse needed to increase profits in a quarter, they would require their distributors to buy Vitesse' inventory. This would show up as an increase in Vitesse's sales for that quarter. At some point in the future, the resellers could sell the chips back to Vitesse. The chips themselves might never leave the warehouse, but might have been 'owned' by several different companies. In other words, short-term increases in profitability were driven by an accounting scam.

(Vitesse Semiconductor chip. Image credit: Raimond Spekking via Wikimedia Commons. License: Creative Commons)

Of course, this is all illegal and the SEC took action against the company; the executives were indicted for fraud. Vitesse had to restate their earnings substantially downwards, which in turn triggered a class action lawsuit. This fraud has even made it into fraud textbooks.

I want to stop for a minute and ask you to think. These are entertaining stories, but what if you were an (innocent) employee of OM Group or Vitesse Semiconductor? When the SEC arrests the leadership, what are the implications for employees? When the accounts are restated and profitability takes a nose dive, what do you think the pay and job prospects are like for the rank-and-file workers?

Inventory and politics - Brexit

A while back, I was chatting to a Brexit supporter, when a news report came on the TV; UK economic output had increased, but the increase had gone into inventory, not sales. Manufacturers and others were assuming Brexit would disrupt their supply chain, so they'd increased output to give them a buffer. I was horrified, but the Brexit supporter thought this was great news. After chatting some more, I realized they had no understanding of how inventory worked. Let's talk through some scenarios to understand why the news was bad.

  • Scenario 1: no Brexit supply chain disruption.  UK firms have an excess of inventory. They can either keep the inventory indefinitely (and pay higher costs than their overseas competitors) or they can run down inventory which means fewer hours for their workers.
  • Scenario 2: Brexit supply chain disruption.  UK firms can't get parts, so they run down inventory until supply chain issues are fixed. Selling inventory means fewer hours worked by the workers.

In both scenarios, UK firms have incurred production costs earlier than their overseas competitors, which reduces their cash flow.


(Image credit: Wikimedia Commons - Tim Reckmann. License: Creative Commons.)

This is obviously highly simplified, but you get the point. None of these scenarios are good for firms or for workers.

If increasing inventory without sales is so good, why don't firms do it all the time? In fact, why bother with the pesky business of selling at all when you can just produce for inventory? The question seems silly, but answering it leads you to consider what an optimum level of inventory is. The logic pushes you towards just in time, which leads to an understanding of why supply chain interruptions are bad.

Closing thoughts

Your job security depends on the financial stability of your employer. If you work for a company that produces public accounts, you have an opportunity to make your own risk assessment. Inventory is one factor among many you should watch. Here are some things you should look out for:

  • Changes to inventory evaluation methods (LIFO, FIFO).
  • Increases in inventory not matched to growth.
  • Increasing sales to distributors not matched to underlying market demand (especially when the inventory never leaves the company).

Yes, some companies do produce fraudulent accounts, and yes, some do hide poor performance, but you can still take steps to protect your career based on the cold hard reality of financial statements, not on hype.

Saturday, May 23, 2020

Finding electoral fraud - the democracy data deficit

Why we need to investigate fraud

In July 2016, Fox News' Sean Hannity reported that Mitt Romney received no votes at all in 59 Philadelphia voting precincts in the 2012 Presidential Election. He claimed that this was evidence of vote-rigging - something that received a lot of commentary and on-air discussion at the time. On the face of it, this does sound like outright electoral fraud; in a fair election, how is it possible for a candidate to receive no votes at all? Since then, there have been other allegations of fraud and high-profile actual incidents of fraud. In this blog post, I’m going to talk about how a citizen-analyst might find electoral fraud. But I warn you, you might not like what I’m going to say.

 National Museum of American History, Public domain, via Wikimedia Commons

Election organization - the smallest electoral units

In almost every country, the election process is organized in the same way; the electorate is split into geographical blocks small enough to be managed by a team on election day. The blocks might contain one or many polling stations and may have a few hundred to a few thousand voters. These blocks are called different things in different places, for example, districts, divisions, or precincts. Because precinct seems to be the most commonly used word, that's what I'm going to use here. The results from the precincts are aggregated to give results for the ward, county, city, state, or country. The precinct boundaries are set by different authorities in different places, but they're known. 

How to look for fraud

A good place to look for electoral shenanigans is at the precinct level, but what should we look for? There are several easy checks:

  • A large and unexplained increase or decrease in the number of voters compared to previous elections and compared to other nearby precincts. 
  • An unexpected change in voting behavior compared to previous elections/nearby precincts. For example, a precinct that ‘normally’ votes heavily for party Y suddenly voting for party X.
  • Changes in voting patterns for absentee voters e.g. significantly more or less absentee votes or absentee voter voting patterns that are very different from in-person votes.
  • Results that seem inconsistent with the party affiliation of registered voters in the precinct.
  • A result that seems unlikely given the demographics of the precinct.

Of course, none of these checks is a smoking gun, either individually or collectively, but they might point to divisions that should be investigated. Let’s start with the Philadelphia case and go from there.

Electoral fraud - imagined and real

It’s true that some divisions (precincts) in Philadelphia voted overwhelmingly for Obama in 2012. These divisions were small (averaging about 600 voters) and almost exclusively (95%+) African-American. Obama was hugely popular with the African-American community in Philadelphia, polling 93%+. The same divisions also have a history of voting overwhelmingly Democratic. Given these facts, it’s not at all surprising to see no or very few votes for Mitt Romney. Similar arguments hold for allegations of electoral fraud in Cleveland, Ohio in 2012

In fact, there were some unbalanced results the other way too; in some Utah precincts, Obama received no votes at all - again not surprising given the voter population and voter history. 

Although on the face of it these lopsided results seem to strongly indicate fraud, the allegations don't stand up to analytical scrutiny.

Let’s look at another alleged case of electoral fraud, this time in 2018 in North Carolina. The congressional election was fiercely contested and appeared to be narrowly decided in favor of Mark Harris. However, investigators found irregularities in absentee ballots, specifically, missing ballots from predominantly African-American areas. The allegations were serious enough that the election was held again, and criminal charges have been made against a political operative in Mark Harris’ campaign. The allegation is ‘ballot harvesting’, where operatives persuade voters who might vote for their opposition to voting via an absentee ballot and subsequently make these ballots disappear.

My sources of information here are newspaper reports and analysis, but what if I wanted to do my own detective work and find areas where the results looked odd? How might I get the data? This is where things get hard.

Democracy’s data - official sources

To get the demographics of a precinct, I can try going to the US Census Bureau. The Census Bureau defines small geographic areas, called tracts, that they can supply data on. Tract data include income levels, population, racial makeup, etc. Sometimes, these tracts line up with voting districts (the Census term for precincts), but sometimes they don’t. If tracts don’t line up with voting districts, then automated analysis becomes much harder. In my experience, it takes a great investment of time to get any useful data from the Census Bureau; the data’s there, it’s just really hard finding out how to get it. In practice then, it’s extremely difficult for a citizen-analyst to link census data to electoral data.

What about voting results? Surely it’s easy to get electoral result data? As it turns out, this is surprisingly hard too. You might think the Federal Election Commission (FEC) will have detailed data, but it doesn’t. The data available from the FEC for the 2016 Presidential Election is less detailed than the 2016 Presidential Election Wikipedia page. The reason is, Presidential Elections are run by the states, so there are 51 (including Washington DC) separate authorities maintaining electoral results, which means 51 different ways of getting data, 51 different places to get it, and 51 different levels of detail available. The FEC sources its data from the states, so it's not surprising its reports are summary reports.  

If we need more detailed data, we need to go to the states themselves. 

Let's take Massachusetts as an example, Presidential Election data is available for 2016, down to the ward level (as a CSV), but for Utah, data is only available at the county level (as an Excel file), which is the same as Pennsylvania, where the data is only available from a web page. To get detail below the county level may take freedom of information requests, if the information is available at all. 

In effect, this puts precinct-level nationwide voting analysis from official sources beyond almost all citizen-analysts.

Democracy’s data - unofficial sources

In practice, voting data is hard to come by from official sources, but it is available from unofficial sources who've put the work into getting the data from the states and make it available to everyone.

Dave Leip offers election data down to detailed levels; the 2016 results by country will cost you $92 and results by Congressional District will cost you $249, however, high-level results are on his website and available for free. He's even been kind enough to list his sources and URLs if you want to spend the time to duplicate his work. Leip’s data is used by the media in their analysis, and probably by political campaigns too. He’s put in a great deal of work to gather the data and he’s asking for a return on his effort, which is fair enough. 

The MIT Election Data and Science Lab (MEDSL) collects election data, including down to the precinct level and the data is available for the most recent Presidential Election (2016 at the time of writing). As usual with this kind of data, there are all kinds of notes to read before using the data. MIT has also been kind enough to make tools available to analyze the data and they also make available their website scrapping tools.

The MIT project isn't the only project providing data. Various other universities have collated electoral resources at various levels of detail:

Democracy’s data - electoral fraud

What about looking for cases of electoral fraud? There isn't a central repository of electoral fraud cases and there are multiple different court systems in the US (state and federal), each maintaining records in different ways. Fortunately, Google indexes a lot of cases, but often, court transcripts are only available for a fee, and of course, it's extremely time-consuming to trawl through cases.

The Heritage Foundation maintains a database of known electoral fraud cases. They don't claim their database is complete, but they have put a lot of effort into maintaining it and it's the most complete record I know of. 

In 2018, there were elections for the House of Representatives, the Senate, state elections, and of course county and city elections. Across the US, there must have been thousands of different elections in 2018. How many cases of electoral fraud do you think there were? What level of electoral fraud would undermine your faith in the system? In 2018, there were 65 cases. From the Heritage Foundation data, here’s a chart of fraud cases per year for the United States as a whole.

Electoral fraud cases by year
(Electoral fraud cases by year from the Heritage Foundation electoral fraud database)

It does look like there's been an increase in electoral fraud up to about 2010, but bear in mind the dataset cover the period of computerization and the rise of the internet. We might expect a rise in fraud cases because it's easier to find case records. 

Based on this data, there really doesn’t seem to be large-scale electoral fraud in the United States. In fact, in reading the cases on their website, most of them are small-scale frauds concerning local elections (e.g. mayoral elections) - in a lot of cases, the frauds are frankly pathetic. 

Realistic assessment of election data

Official data is either hard to come by or not available at the precinct level, which leaves us using unofficial data. Fortunately, unofficial data is high quality and from reputable sources. The problem is, data from unofficial sources aren't available immediately after an election; there may be a long delay between the election and the data. If one of the goals of electoral data analysis is finding fraud, then timely data availability is paramount.

Of course, this kind of analysis I'm talking about here won't find small-scale fraud, where a person votes more than once or impersonates someone. But small-scale fraud will only affect the outcome of the very tightest of races. Democracy is most threatened by fraud that might affect the results, which in most cases is larger-scale fraud like the North Carolina case. Statistical analysis might detect these kinds of fraud.

Sean Hannity's allegation of electoral fraud in Philadelphia didn't stand up to analysis, but it was worth investigating and is the kind of fraud we could detect using data - if only it were available in a timely way. 

How things could be - a manifesto

Imagine groups of researchers sitting by their computers on election night. As election results at the precinct level are posted online, they analyze the results for oddities. By the next morning, they may have spotted oddities in absentee ballots, or unexplained changes in voting behavior, or unexpected changes in voter turnout - any of which will feed into the news cycle. Greater visibility of anomalies will enable election officials to find and act on fraud more quickly.

To do this will require consistency of reporting at the state level and a commitment to post precinct results as soon as they're counted and accepted. This may sound unlikely, but there are federal standards the states must follow in many other areas, including deodorants, teddy bears, and apple grades, but also for highway construction, minimum drinking age, and the environment. Isn't the transparency of democracy at least as important as deodorants, teddy bears, and apples?

If you liked this post, you might like these ones

Saturday, May 16, 2020

The Emperor's new objects: a two-year failed project

It’s a sad thing when people you admire turn out not to be what you thought they were andwhen you find out your heroes have feet of clay. I had an experience like that a few years ago and it taught me a lot.

(Image credit: Old Book Illustrations)

I worked for a company that decided to go for object-oriented technology in a big way. They hired a team of people to design and build components that the lesser people (e.g. me and my colleagues) would snap together to build systems more quickly. Let’s call this team Team X and the team leader Mr. Y. Team X was to be a team of superstars leading the company forward.

I admired Team X and Mr. Y greatly. They had all the skills I wanted and every time I walked past them, they were diligently designing systems; I was impressed by their energy. I used to chat to them once a week and they used to like it because I was so clearly in awe of what they were doing. Mr. Y was at great pains to show me their work, though it was plain I didn’t understand it.

Some time passed and I had the opportunity to learn object-oriented programming. I did a design course on UML, and I learned C++ and became familiar with all the key tools. I put a huge amount of effort in and went from knowing nothing to knowing a lot in a short space of time.

It had been a while since I dropped in on Team X and Mr. Y, so I said hello. As before, Mr. Y showed me their designs and work. This time, I knew about object-oriented design. Unfortunately, I immediately spotted several mistakes in their design and several places where their approach would have been very inefficient. I was foolish enough to point them out. At first, Mr. Y conceded I was right, but as I pointed out more problems, he got irritated. Eventually, I realized I wasn’t welcome anymore and left. I didn’t stop by and chat again.

After this, Team X locked down their designs and prevented anyone from viewing them, they even angled their screens away from people passing by so no-one could see their work. They stopped communicating. In the meantime, after chatting with my boss, I realized Team X didn’t know what they were doing. My boss counseled me to keep quiet and say nothing, which I did after some moaning. He told me my chances of getting real change were zero and that I would just damage my reputation by speaking out.

About six months later, Team X was all laid off. The company gossip was, they’d been employed for two years and produced absolutely nothing of value, not a single piece of executable code. The company got nothing for several people’s efforts over the entire time.

Ironically, the only group that actually produced an object-oriented system was the group I was in. We used C++ to create useful systems that actually did something, and we produced the systems in a few months with just a handful of people, none of whom claimed to be a superstar. We didn't do the huge analysis Team X did, we just built systems to meet our customers' needs.

What were my takeaways from all of this?

  • Results are what counts.
  • If you have a team working for you using a technology, make sure you understand it well enough to measure their progress.
  • Deliverables are important and you should manage projects to have some results at checkpoints throughout the project. This is the soundest way of measuring progress. Never, ever leave long gaps between deliverables.
  • A team that hides its work is a major red flag.
  • Choose your battles and only choose ones you can win or that are important. Companies do silly things all the time, but eventually, they get corrected, whether you intervene or not.