Monthly Archives: December 2020

The equation behind Tinder, J-swipe, and good chess matchups.

Near the beginning of the movie “The social network”, Zuckerberg asks his Harvard roommate, Saverin, to explain the chess rating system. His friend writes an equation on the window, Zuckerberg looks for a while, nods, and uses it as a basis for Facemash, the predecessor of Facebook. The dating site, Tinder said it used this equation to match dates, but claims to have moved on from there, somewhat. The same is likely true at J-swipe, a jewish coating site, and Christian mingle.

Scene from the social network, Saverin shows Zuckerberg the equations for the expected outcome of a chess match between players of different rankings, Ra and Rb.

I’ll explain how the original chess ranking system worked, and then why it works also for dating. If you’ve used Tinder or J-swipe, you know that they provide fairly decent matches based on a brief questionnaire and your pattern of swiping left or right on pictures of people, but it is not at all clear that your left-right swipes are treated like wins and losses in a chess game: your first pairings are with people of equal rating.

Start with the chess match equations. These were developed by Anand Elo (pronounced like hello without the h) in the 1950s, a physics professor who was the top chess player in Wisconsin at the time. Based on the fact that chess ability changes relatively slowly (usually) he chose to change a persons rating based on a logistic equation, sigmoid model of your chances of winning a given match. He set a limit to the amount your rating could change with a single game, but the equation he chose changed your rating fastest when you someone much better than you or lost to someone much weaker. Based on lots of inaccurate comparisons, the game results, you get a remarkably accurate rating of your chess ability. Also, as it happens, this chess rating also works well to match people for chess games.

The knowledge equation, an S curve that can be assumed to relate to the expected outcome of chess matchups or dating opportunities.

For each player in a chess match, we estimate the likelihood that each player will win, lose or tie based on the difference in their ratings, Ra -Rb and the sigmoid curve at left. We call these expected outcome Ea for player A, and Eb for player B where Ea = Eb = is 50% when Ra = RB. It’s seen that Ea never exceeds 1; you can never more than 100% certain about a victory. The S-graph shows several possible estimates of Ea where x= Ra-Rb, and k is a measure of how strongly we imagine this difference predicts outcome. Elo chose a value of k such that 400 points difference in rating gave the higher ranked player a 91% expectation of winning.

To adjust your rating, the outcomes of a game is given a number between 1 and 0, where 1 represents a win, 0 a loss, and 0.5 a draw. Your rating changes in proportion to the difference between this outcome and your expected chance of winning. If player A wins, his new rating, Ra’, is determined from the old rating, Ra as follows:

Ra’ = Ra + 10 (1 – Ea)

It’s seen that one game can not change your rating by any more than 10, no matter how spectacular the win, nor can your rating drop by any more than 10 if you lose. If you lose, Ra’ = Ra – 10 Ea. New chess players are given a start ranking, and are matched with other new players at first. For new players, the maximum change is increased to 24, so you can be placed in a proper cohort that much quicker. My guess is that something similar is done with new people on dating sites: a basic rating (or several), a basic rating, and a fast rating change at first that slows down later.

As best I can tell, dating apps use one or more ratings to solve a mathematical economics problem called “the stable marriage problem.” Gayle and Shapely won the Nobel prize in economics for work on this problem. The idea of the problem is to pair everyone in such a way that no couple is happier by a swap of partners. It can be shown that there is always a solution that achieves that. If there is a singe, understood ranking, one way of achieving this stable marriage pairing is by pairing best with best, 2nd with second, and thus all the way down. The folks at the bottom may not be happy with their mates, but neither is there a pair that would like to switch mates with them.

Part of this, for better or worse, is physical attractiveness. Even if the low ranked (ugly) people are not happy with the people they are matched with, they may be happy to find that these people are reasonably happy with them. Besides a rating based on attractiveness, there is a rating based on age and location; sexual orientation and religiosity. On J-swipe and Tinder, people are shown others that are similar to them in attractiveness, and similar to the target in other regards. The first people you are shown are people who have already swiped right for you. If you agree too, you agree to a date, at least via a text message. Generally, the matches are not bad, and having immediate successes provides a nice jolt of pleasure at the start.

Religious dating sites, J-swipe and Christian Mingle work to match men with women, and to match people by claimed orthodoxy to their religion. Tinder is a lot less picky: not only will they match “men looking for men” but they also find that “men looking for women” will fairly often decide to date other “men looking for women”. The results of actual, chosen pairings will then affect future proposed pairings so that a man who once dates a man will be shown more men as possible dates. In each of the characteristic rankings, when you swipe right it is taken as a win for the person in the picture, if you swipe left it’s a loss: like a game outcome of 1 or 0. If both of you agree, or don’t it’s like a tie. Your rating on the scale of religion or beauty goes up or down in proportion to the difference between the outcome and the predictions. If you date a person of the same sex, it’s likely that your religion rating drops, but what do I know?

One way or another, this system seems to work at least as well as other matchmaking systems that paired people based on age, height, and claims of interest. If anything, I think there is room for far more applications, like matching doctors to patients in a hospital based on needs, skills, and availability, or matching coaches to players.

Robert Buxbaum, December 31, 2020. In February, at the beginning of the COVID outbreak I claimed that the disease was a lot worse than thought by most, but the it would not kill 10% of the population as thought by the alarmist. The reason: most diseases follow the logistic equation, the same sigmoid.

MI hunting: You can arm bears; you just can’t buy bullets.

Large chunks of Michigan shut down for the prime days of hunting season, from the middle of October to early November. About 8% of the state gets a hunting license each year, some 800,000 people, all trying to “Bag a buck.” Michigan is an open carry state for rifles and holstered pistols, something seen recently in the state capitol, I’d say this was an illegal example since there is also a brandishing law, but it gives a sense of things here. About 29% of the state owns at least one gun, and usually more. There are about as many guns as people. Getting bullets, on the other hand, is near impossible, both for handguns and for most rifles, shotguns excluded.

A lot of the attraction of hunting is that you get to eat what you kill. Mot people do this or donate it to a food back. Hunting is also cheaper than golf. Rural farmers also hunt to protect their crops from crows, squirrels, rabbits, rats, snakes, and raccoons. This is legitimate hunting, in my opinion, even though you typically don’t eat crow. Some people do hunt bear, but that’s a different story (I like to be dressed). It’s possible that the bullet shortage is just a hiccup in the supply chain, “supply and demand” but it’s been going on for 12 years now so I suspect it’s here to stay.

Michigan, was once a Republican, pro-gun stronghold. It has swung Democrat and anti-gun for the last few years. Bulletes have been scare for about that long, at least since the Obama election or the Sandy Hook shooting. Behind this is a general trend of urbanization and class-action law suits. At this point, few sporting stores carry guns or bullets, and those that do, tend to hide them in a back room. Amazon carries neither bullets nor guns, and the same holds at e-bay, Craig’s list, and Walmart on line. Dunhams still sells guns but the only bullets, when I visited today were, 17 caliber, 227 and duck-hunting, shotgun shells. Gone were normal handgun calibers: 22, 25, 32, 38, 45, 357, and 9mm. The press seems OK with duck or moose hunting; not so OK with anything else.

The salesman at Dunham’s said that he had moved to bow hunting, something that’s becoming common, but it’s incredibly difficult even with modern bows. I can rarely hit a non-moving target at 50 feet on the first arrow, and I can only imagine the frustration of trying to hit a moving target after sitting in a cold blind for days waiting for one to appear whose distance and placement is unknown, and that might disappear at any moment, or attack me then disappear.

Part of the problem is that arrows travel at only about 250 ft/s, or about 1/6 the speed of a bullet. Thus, an arrow fired from 50 yards takes about 0.6 seconds to hit. In that time it drops about 6 feet and must be aimed 6 feet above the deer if you hope to hit it. A riffle bullet falls only about 2 inches, about 1/36 as much. Whaat’s more, though an arrow is about three times heavier than a hunting bullet, its slow speed means it hits with only about 1/10 the kinetic energy, about the same as hunting with a 22 from a handgun.

There are those who say the bullet shortage will go away on its own because of supply and demand. That’s true until the government steps in in the name of public safety. Though recreational marijuana and moonshine are both legal, government regulation means that prices are high and supply is limited, with a grey market of people buying high and selling higher. I’m seeing the same with ammunition; there is tight supply, a grey market, and a fair number of people trying to reload spent ammunition using match-tips for primers. Talk about white lightning.

R. E. Buxbaum, December 24, 2020.

COVID E. Asian death rate is 1/100th the Western rate.

COVID-19 has a decided racial preference for Western blood, killing Americans and Europeans at more than ten times the rate of people in Japan, China, Hong Kong, Taiwan, Korea, or Vietnam. The chart below shows the COVID-19 death rate per million population in several significant countries countries. The US and Belgium is seen to be more than 100 times worse than China or Hong Kong, etc., based on data from http://www.worldometers.info. IN the figure, the death-rate rank of each country is shown on the left, next to the country name.

For clarity, I didn’t include all the countries of Europe, but note that European countries are the majority of the top ten in terms of deaths per million. Belgium is number one with over 1,400. That is somewhat over 0.14% of the population has died of COVID-19 so far.

Peru has the highest COVID-19 death rate in South America at over 1000 per million, 0.1%. The US rate is similar, 0.082%. These are shockingly high numbers despite our best efforts to stop the disease by mandating masks, closing schools, and generally closing our economies. Meanwhile, in China and Japan, the economies are open and the total death rate is only about 1/100 that of Europe or the Americas. Any health numbers from China are suspect, but here I tend to believe it. Their rates are very similar to those in Hong Kong and Taiwan. At 3 per million, China’s death rate is 1/400 th the rate of the US, and Taiwan’s is lower.

This is not for lack of good healthcare systems in Europe, or lack of preparation. As of December 1-10, Germany, a country of 80 million, is seeing a COVID death rate of 388 per day. Japan, a country of 120 million, sees about 20. These are modern countries with good record keeping; Germany is locked down and Japan is open.

The question is why, and the answer seems to be genetics. A British study of the genetics of people who got the disease particularly severely found a few genes responsible, among these, TYK2. “It is part of the system that makes your immune cells more angry, and more inflammatory,” explained Dr Kenneth Baillie, a consultant in medicine at the Royal Infirmary in Edinburgh, who led the Genomicc project. He’s theory is that versions of this gene can allow the virus to put your immune response “into overdrive, putting patients at risk of damaging lung inflammation.” If his explanation is right, a class of anti-inflammatory drugs could work. (I’d already mentioned data suggesting that a baby aspirin or two seems helpful).

As reported in Nature this week, another gene that causes problems is IFNAR2. IFNAR2 is linked to release of interferon, which helps to kick-start the immune system as soon as an infection is detected.

It could be accidental that Asians are just lucky interns of not having the gene variations that make this disease deadly. Alternately, it could be that the disease is was engineered (in China?) and released either as a bio-attack, or by accident. Or it could be a combination. Whatever the cause of the disease, that east Asians should be spared this way is really weird.

Suggesting that this is not biowarfare is the observation that, in San Francisco, the Asian, per case fatality rate is as high as for white people or higher. One problem with this argument is that there is a difference between death rate per confirmed case and death rate per million population. It is possible that, for one reason or another Chinese people in San Francisco do not seek to be tested until they are at death’s door. Such things were seen in Iran and North Korea, for example. It pushed up the per-case death rate to 100%. Another possibility is that the high death rates in the west reflect disease mutation, or perhaps eastern exposure to a non-deadly variant of COVID that never made it west. If this is the case, it would be just as odd as any other explanation of a100x difference in death rates. Maybe I’m being paranoid here, but as the saying goes, even paranoids have enemies.

I think it’s worth noting this strange statistical pattern, even if I have no clear explanation. My advice: take vitamin D and a baby aspirin; and get a pneumonia shot,. I plan to take the vaccine when it’s offered. If a home test becomes available, I’d use that too. Stay safe folks. Whatever the source, this disease is a killer.

Robert Buxbaum, December 16, 2020.

A pacifist’s personal protection, a 22 revolver.

Before a pacifist buys a gun, there are two critical questions to ask: One is ‘how would I feel if I killed a criminal?” The other is ‘how would I feel if I missed and killed someone else? In my case, I’d feel awful either way. My thinking, even with the criminal, is that I tried my best to do more good than bad, and part of that is to minimize the chance of killing needlessly. Statistics suggest that gun carrying, in general, does good by deterring violent criminals. To be able to stop a deadly attack, while minimizing the chance of killing– particularly an innocent bystander — I’m inclined to a low power gun that’s easy to conceal and easy to aim well. This leads me to suggest a 22 revolver with a barrel that’s not too long to conceal, nor too short for good aiming, 2.5-4″ seems ideal.

An analysis of what percent of people stop attacking when hit by one bullet of different calibers. The 32 and shotgun are the best, in part because the shooter tends to stop shooting at one shot. With a 9 mm, the shooter keeps on shooting, likely doing more damage than necessary.

At this point I’d like to say that I am not a gun expert. I’ve fired perhaps 15 guns in my life including 5 revolvers. The easiest of these to shoot was a Glock 9mm, heavy, large and powerful, but it think it would be too large to carry or draw in a deadly situation, and the Glock was not cheap. The 22s were all smaller guns, and the 22 cartridges, especially the 22lr, are dirt cheap, costing 8 to10¢ each, or $40-$50 for a box of 500. It’s not the 9mm are super expensive, but they cost 25-30¢ each or $25 to $30 for a box of 100. The price is higher today, over $1 each, because of an ammo shortage, but it’s coming down.

Another advantage of the 22 is that the kill power is lower. A 9mm round will go through the person you are shooting at, and kill the person behind, and can kill on a riccoshet. I like that the 22 won’t do this. I also like that the 22, more effective than almost any other round at stropping a criminal, and getting him to go away. As the chart above shows, there is a 60% stop after the perpetrator is hit once, and that’s my goal — getting him to go away. A shotgun is far more effective as a deterrence, over 80%, but it is much more likely to kill, and much harder to conceal carry. The chart above is from a wonderful analysis of the effect of different calibers used in crimes, read it here. The author, Greg Ellifritz, suggests that the reason the 22 is so effective at stopping a criminal is psychological: criminals stop if shot even once, especially from a civilian, and only civilians use 22s. Larger calibers are better appear to be less effective, though they will be better at stopping a really determined attacker, e.g. someone on PCP. But that’s not the environment I work in, and I suspect it’s not the majority of crime. Overall, one shot from a 9mm does not do a good job stopping an attacker. Another good option is a 32. It was the choice of Theodore Roosevelt and J. Edgar Hoover. It tends to be used by detectives and other professionals, but the bullets are expensive.

I’ve done a meta-analysis of Greg Ellifritz’s death data, and confirm that the 22 is the second least deadly of all bullet types, after the .25. Of 154 people hit with 22 bullets, there 28% fatalities, 43 deaths. The 9mm is more deadly: of those hit with a 9 mm bullet, 44% died, in part because people shooting 9mm tend to shoot more bullets, nearly twice as many as 22 shooters in danger situations.

It takes two hands to cock a semi-automatic, that is to draw the first round into the chamber. Gif from ammuniotndepot.com

Handguns for 9mm rounds tend to be semi-automatic with light triggers and large magazines. Guns for 22 tend to be revolvers with heavier triggers and small loads, 5 to 7 rounds. I suspect that a light trigger leads to more missed shots and misfires, and I notice that many folks with semiautomatics, find they jam in danger situations. In the famous duel between Hamilton and Burr, Hamilton hit the branch above Burr’s head, likely because he’d set his trigger very light. Burr’s trigger was set heavy, and he shot straight. When you are nervous, gun with a light trigger can go off early and miss or kill the wrong person. A lot of the people killed with guns in Detroit, I notice, were killed by mistake, because the shooter missed, or because of a ricochet (I did an analysis of Detroit crime early on in this blog). A ricocheting 22 has very little kill power left.

A single action revolver requires cocking by that can be done with one hand; a double action doesn’t need any cocking. Gif from ammuniotndepot.com

Every semi-automatic I’ve tried required a two handed, “racking” step, see above. Thus, unless you leave a cartridge in the chamber while walking around, you need two free hands and an extra second or two to rack the first bullet before you can shoot. That’s OK on a range, but in a danger situation racking is a problem. Even trained policemen with semi-automatics have been killed by knife-wilding criminals because the criminal didn’t need the extra second or two while the policeman racked the first round.

Racking takes strength and coordination, plus an awareness of legal isuess. If you rack too soon and the situation de-escalates, you could be charged with “brandishing.” In most states it’s illegal to brandish a weapon in a non-deadly situation. You have to wait with your gun in your pocket or holster until you are in mortal danger. With a revolver, you don’t need to rack. Even a single action revolver can be cocked with one hand while the weapon is in your pocket. See the process in the figure above. Double-action revolvers don’t require cocking, and that can be a plus. On the other hand, I figure that the sound of a gun cocking might be useful to signal to a criminal that you are serious without getting you into the problems of brandishing.

De-cocking a single action revolver.

Revolvers have another interesting plus in that it’s easy to un-cock revolver, even using one hand, see gif. With semi-automatic pistols, there rarely a graceful way to remove the bullet from the chamber, certainly not with one hand. In theory, you can shoot from your pocket too; it’s something I’ve seen in the movies, but a semi-automatic will almost certainly jam if you try. If the assailant grabs your arm, or otherwise attacks you, you have every right to fire, but you don’t want a jam, or to hit yourself. Most defensive shootings are from close range.

Speaking of jamming, even experts get jams on a fairly regular basis, and beginners have this problem a lot. They forget to hold the gun tightly enough, or they buy rounds that don’t quite match the gun. Rounds that are too weak or powerful cause problems for semi-automatics. I’ve never seen a revolver jam, and if the round doesn’t fire, you can click again, and another round will appear. With a semi-automatic, clearing a jam is a lot of work: more than I can expect in a danger situation.

I should mention that the folks from ammunition depot, the place I got the gifs, recommends 9mm semi-automatics for personal protection because of the extra “stopping power”. Read their opinion here. I disagree, and here is one last reason: Like many other suppliers, they are out of 9mm cartridges, and have been for months. Perhaps it’s panic buying like with toilet paper, or a manufacturing disruption; 22 lr cartridges are still in stock. Supply problems will likely go away, but it’s another reason to look at the 22.

Robert Buxbaum, December 11, 2020. Some vocabulary words: a bullet is the projectile that comes out the barrel. A round = a cartridge. It’s the thing that you put in the gun before shooting. There are several 22s, all with the same size (diameter) bullet, 0.223″ OD, but with different lengths and power, from short to wmr. Different guns can use different cartridges. Meir Kahane was killed by a 22, as was Bobby Kennedy.

Thanksgiving thoughts for Christmas dinner.

Enjoy those loaves and fishes. Even the ones from the store are miracles.

Enjoy dinner with your family and friends, even if it’s awkward. It’s the awkwardness of your friends that makes you love them. No one really loves perfection. And enjoy your dinner. No one really likes a prig, not even God.

My cousin and his wife are coming to dinner. They’re both Bugs Bunny fans. He proposed via a WhatsApp.doc

In terms of the holiday ham; Jesus was Jewish. No ham. When doing with the disciples, he probably ordered falafel and 13 glasses of water.

Relatives are easier if you don’t have to look at them.

Robert Buxbaum, November 2, 2020