Monday, September 28, 2015

Lines of Code

Here is a list of products:
  • Facebook
  • New luxury car
  • Large Hadron Collider
  • Google
Can you rank order this list in terms of number of lines of code needed to create the product?  I'll give you a minute to think about it.

Ok, time's up.  Here is the rank-ordered list:
  1. Google (2 billion)
  2. New luxury car (100+ million)
  3. Facebook (60 million)
  4. Large Hadron Collider (50 million)
This is pretty remarkable (or mind blasting if you're Indian).  There is something disconcerting about the device we use to peer into the subatomic nature of reality requiring fewer lines of code than a Mercedes C-class or the means by which we find cat videos on the Interwebz.

Wednesday, August 26, 2015

QB Consistency

Wow, a second blog post in as many weeks!  (For yet another reason) I am impressed with myself.

I've been thinking about how to approach my upcoming fantasy football drafts from the quarterback perspective.  Usually, I look for three characteristics in my QB:

  • Score - obviously I'm looking for the highest scoring QB available
  • Consistency - perhaps not so obviously, I'm looking for someone who will guarantee me a certain number of points per week 
  • Value - since I'd rather spend my first few picks on RBs and WRs, I'm looking for someone I can get in later rounds for a good price

So which QBs am I targeting in 2015?  Let's look at some data to help inform my decision.  In the chart below, I plotted each QB's 2014 total fantasy points (FP) against their variance, a statistical measure of how each QB's weekly point total deviated from the mean.  The variance is all about consistency: the lower the variance, the more consistent the QB is in terms of scoring.  Finally, the color scale of each point represents that player's current (as of August 21, 2015) average draft pick (ADP) as determined by FantasyPros.  Green means low ADP (generally selected early in the draft), while red means high ADP (selected later).  Let's see what we get:



Pardon the labeling, I know it's difficult to read.  I didn't feel like messing around too much in R to make the text legible.  In any case, our best QBs should fall to the bottom right (highest fantasy points, lowest variance).  Indeed, we see names down there like Andrew Luck and Drew Brees.  Aaron Rodgers and Peyton Manning are high on the points scale, but show a bit more inconsistency.  Both players had relatively poor stretches (Rodgers in the first few games, Manning in the last few) in 2014, which raises their variance.  But look at how dark green (low ADP) these guys are.  I don't want to spend a high pick on one of them.

What I'm looking for are QBs who are kind of lighter green to yellow (ADP roughly 60-120), someone you can get between rounds 5 and 10 in a 12-team draft.  I also want someone with low variance (say < 100) and high points (say 300 FP for the season).  Drawing an imaginary vertical line at the 300 FP mark, and a horizontal one at 100 for variance, I see a few interesting names pop up in lighter shades of green:

  • Matt Ryan
  • Ryan Tannehill
  • Philip Rivers
  • Tony Romo
All of these guys are excellent prospects who can deliver points consistently for a cheap price.  Tannehill in particular intrigues me.  Here's a guy who's had solid improvement over his last two years in the NFL and seems to be trending upwards.  He's finally got some great weapons at his disposal and is improving his deep ball.  On top of it all, you can get him 40-50 picks after Luck and Rodgers!  I'm probably going to target him in every draft, but I don't think you can go wrong with any of the aforementioned prospects.

Some close outliers with respect to our criteria:
  • Tom Brady
  • Jay Cutler
  • Eli Manning
  • Joe Flacco
I'm not gung-ho on any of these fellows, but I would maybe take Eli in a pinch given the fact that he'll have Beckham and Cruz at his disposal this year.  Brady is clearly the best of the bunch but I'm turned off by his four-game suspension.  I'd rather not have to wrestle with QB backups as that takes up valuable roster spots.

This, of course, should not be construed as proof that you should wait a few rounds before taking a QB.  Rather, this data tells us who to pick assuming this premise is true.  Maybe that's another blog post for another day.

Wednesday, August 19, 2015

Points For First Downs

Here is my attempt at resuscitating this blog.  I don't know why I bother.  I'm bound to quit again after a short, fervent period of writing.

We conducted an experiment in one of my fantasy football leagues last year.  We added one point for every first down for RBs and WRs.  I wanted to know what effect, if any, this would have on scoring.

Points for first downs (PFFD) was negligible for WRs and somewhat impactful for RBs.  In the charts below, I plotted the point differential (% increase in total fantasy points due to PFFD) for the top 100 rushers and receivers in 2014.  I added a loess-smoothed line to each plot to highlight the overall trend.

You can see the trend for WRs remains largely unchanged as you go from high- to low-ranked players, i.e. the percent change is roughly equal across the board.  The hump in the middle indicates that mid-tier WRs were helped slightly more than high- or low-tier WRs in terms of scoring capacity.





For RBs, there is an appreciable difference.  The bottom-end RBs show an overall 15% increase in value if we add PFFD.  The rich stay rich, but the poor get much richer (relative to their non-PFFD-adjusted value).  This creates slightly less of a dichotomy between top- and bottom-tier RBs, and widens the pool of potentially draftable players.  The RBs at the bottom end are backups and 3rd down backs who get rotated into lineups more frequently than backup and special package WRs.




What I don't have is league game data from last season to show that this had a material difference in any of our matchups.  I recall there being some pretty close games, so it would be interesting to see if the change manifested in the overall standings.

So what does this mean overall?  Based on the RB data, I'd suggest we get rid of PFFD (at least at the RB position).  Having a wider pool of draftable players diminishes the Knowledge Advantage, and the game is random enough as it is without introducing more variables.  However, given the extremely casual nature of this particular league (and, I imagine, most fantasy football leagues), I think the difference will be immaterial, so I won't cry if people want to keep it (though I will question their values and reasoning ability).

Wednesday, April 22, 2009

I'm Lovin' It

I posted to Twitter/Facebook earlier with a comment asking if it were worth it to avoid McDonald's despite the fact that I can get a full meal there for $3. While I was being facetious, it sparked an interesting conversation that revealed the many misconceptions I think people have about McDonald's.

In any discussion of the world's largest fast food chain, the documentary Super Size Me is bound to come up. Super Size Me is perhaps one of the most egregious forms of unfounded propaganda of this decade. All Morgan Spurlock proves is that if you eat 5,000 calories a day, you are going to get sick. He chooses to ignore the fact that consuming 5,000 calories a day of any food items is going to make you sick. There is nothing rigorous or scientific about his "experiment". It's merely an exercise in shock value and extreme behavior.

A friend of mine argues that Spurlock was trying to show how McDonald's and all the other fast food restaurants are "socially engineering" people to eat more, crappier foods. I don't think this is correct either. Here's why:

1. If anything, it's quite the opposite. McDonald's has been at the forefront of offering healthier fare for many years. They were selling salads as early as 1987, and low-fat burgers like the McLean Deluxe in 1991. They offer apple sticks in lieu of French fries, and fruit parfait instead of ice cream and shakes. As a matter of fact, they are ranked among the top ten healthiest fast food chains by Health magazine. Let's face it: it's fast food and everyone knows it's not nutritionally optimal. But for what it is, McDonald's should be recognized as an innovator and trend-setter in delivering healthy options well before other comparable fast food chains.

2. Is McDonald's any more guilty of "social engineering" than Burger King, or Safeway, or Cheesecake Factory, or any other food seller in the U.S.? First and foremost, McDonald's is a business. Their goal is to make money, and in order to do that they have to convince people to buy more of their food. It's no different than grocery store tactics that rely on optimal shelf placement for maximizing sales. Making McDonald's a scapegoat for this is ridiculous as it's something that has permeated the entire food industry for decades.

3. Despite what Spurlock asserts in his documentary, McDonald's is much more transparent regarding its nutritional content than most restaurants where one can supposedly get a nutritious meal. My wife and I went to a nice restaurant this evening for dinner. While the food was typical San Francisco fare, and supposedly made fresh with the best ingredients, how am I supposed to figure out the sodium content of my fillet of sole ceviche? There is no easy way to do this, but I know exactly how much sodium was in the McDouble and the McChicken I had for lunch yesterday (1,750 mg... ouch) by simply visiting their website. I can even learn the relevant nutritional information per ingredient and use that information to customize my order.

All that "social engineering" business aside, I will make one final point about the food at McDonald's (or any comparable fast food chain, or anything you eat at all, for that matter): the food is only as bad as the context in which you eat it. In other words, your body needs a certain number of calories; grams of protein, carbohydrates, and fats; and milligrams of sodium and cholesterol per day (among other things). McDonald's food is just fine as long as you are not exceeding these boundaries. If that Big Mac causes you to go over your daily allotment of calories, then it is unhealthy. If you are eating it once per day and are within those bounds, then it's not unhealthy. The context of what you're eating renders it healthy or not, not the food in and of itself.

Tuesday, October 28, 2008

The Candidates on Health Care

The Wall Street Journal has a good summary on the health care plans of both candidates in the upcoming presidential election (thanks to Paul for sharing this on Google Reader; please also congratulate him on his recent nuptials).

Let's be frank: both of these plans suck. Neither deals with the real problem of health care in this country. There is an artificial demand on the health care system created by a dearth of doctors and the restrictions on acquiring prescription drugs, among other things. All these things drive the cost of health insurance and raise it to exorbitant, unaffordable levels. Currently, health care costs in the U.S. are estimated to be approximately 15% of GDP, and expected to rise to 19% by 2017.

According to the Bureau of Labor and Statistics, over one-third of doctors in 2006 worked over 60 hours per week, and there were approximately 633,000 doctors, a mere 1 for every 475 people in this country. And why do we need to see these overworked physicians to get simple prescriptions for penicillin and allergy medicine? While honeymooning in Greece a few years ago, I experienced my first allergic reaction to some bad fish. My face had swollen to twice it's normal girth and I itched all over. My ever resourceful wife ran to the nearest pharmacy and purchased some Zyrtec over the counter, which instantly eliminated my symptoms. Had I suffered from this allergic reaction in the United States, I would have surely perished from an acute case of big red face disease (BRFD) since I wouldn't have been able to get such a simple drug without visiting my family practitioner and getting a prescription. These things drive the cost of health care up as we rely on the few physicians we have to do mundane things. The demand on the health care system is entirely artificial. These two problems could easily be solved by graduating more physicians every year (accounting for the rate of population increase), and easing restrictions on the purchase of simple prescription drugs (an illiterate child in India can get penicillin from the local pharmacy, but a Ph.D. in pharmacology can't in the U.S.).

That being said, neither candidate wants to tackle the root of the problem. Instead, they both want to exacerbate the issue by doling out government lucre in the form of tax credits (McCain) or a federal insurance program (Obama). By giving away money in either form, all they're really doing is feeding into this artificial demand enforced by the current system. The previously uninsured sector of the population will increase the demand on an already-strained insurance industry. Nothing would be done to alleviate the supply issue. To top it all off, both plans would cost trillions of dollars over the next 10 years at a time when the deficit has reached its highest level yet (in unadjusted dollars, though not as a percent of GDP).

If I had to pick one of these odious plans over the other, I'd opt for the McCain plan. It makes some token moves in the right direction, but still falls short of addressing the system's fundamental problems. Deregulation of the health insurance market is one of its more attractive aspects. McCain advocates the removal of the restrictions on purchasing health care plans from companies across state lines. Current law prevents consumers from buying into a plan in another state. Removing this restriction would increase competition between HMOs and help to lower the price of coverage overall, though in light of the aforementioned problems this might have minimal impact on the cost. Still, I can agree with the principle behind it, as deregulation also offers the consumer more in the way of health care choices.

Another positive aspect to the McCain plan is its push away from employer-based insurance by giving a $2,500 tax credit to individuals (or $5,000 for families) to purchase a health care plan. While I'm against giving away this kind of money without addressing the issue of the artificial demand, the side effect of veering away from employer-sponsored health programs is a positive thing. People should not have to base their health insurance status on their employment. Losing your job means losing your health care, and that is something that really shouldn't be dependent on anything. One should be able to secure a health care plan regardless of employment status, a failing system revealed by the fact that about 1 in 7 people don't have health insurance in this country. In this op-ed from the Wall Street Journal, David Gratzer of the Manhattan Institute argues that the employer-based health insurance system has become defunct. (Interestingly enough, one of his references for this assessment is one of Barack Obama's economic advisors, David Cutler).

In any case, both plans are decidedly the wrong course of action, but McCain's has token elements that nudge the industry in the right direction. I will be voting for the lesser of these two evils.