"Counterfactuals and Causal Inference" by Morgan and Winship
Chris Prosser
Mainly projects.
Sunday, February 21, 2016
Causal Inference Resources
"Counterfactuals and Causal Inference" by Morgan and Winship
Saturday, March 22, 2014
Date Based Cohort Analysis for Adobe SiteCatalyst using R
Then I learned R and have even more reason to avoid Excel.
Recently I needed to implement date based cohorts in SiteCatalyst. While there are a few blog posts on how to do this in Excel using Report Builder (http://adam.webanalyticsdemystified.com/2013/03/07/conducting-cohort-analysis-with-adobe-sitecatalyst/ , http://blogs.adobe.com/digitalmarketing/mobile/what-is-mobile-cohort-analysis-and-why-should-you-use-it/) they didn't work for me. My team is all on MacOS, and Report Builder isn't.
In this example I'm going to use events tracked by the Mobile Library lifecycle stats. One plus of this solution is it doesn't require any SAINT classifiers to convert mobileinstalldate to a month/year.
The idea here is you use QueueTrended to chunk together uniqueusers by month, with mobileinstalldate as the counted event. If you look at the data output from QueueTrended is makes more sense. The rest is then using plyr and reshape2 to beat the data into the form we want. It works just fine with segments.
I'm not sharing my code that generates percentages yet because I'm not particularly happy with it yet. Drop me a line if you are interested.
And yes, the data is small, this is from a private unreleased product I am working on.
Saturday, October 5, 2013
The Lean Startup Movement from a Decision Science perspective
First off, my apologies to actual Decision Scientists. I have no formal training and just recently learned that the area I'm fascinated by actually has a name.
There are a lot of anecdotes out there about how wonderful all the different Lean Startup methodologies are. If you go and read the Amazon book reviews, you'll see lots of comments about how it changed someones life.
What you won't see is any data showing they actually help.
I'm a skeptic at heart. Studies on businesses are notoriously difficult to do, and while I could see value in the tools and techniques, I really wanted a deeper scientific basis for all the hype.
I finally managed to find it within the Decision Science literature. Daniel Kahneman has done a great survey of key ideas and concepts in "Thinking, Fast and Slow". It's a long book, but for the purposes of this discussion we really care about part 3: Overconfidence. "The Signal and the Noise" by Nate Silver also talks a fair amount about our inability to do forecasts well. Lastly, "Naked Statistics" provides another view.
The Lean Startup Methodologies (LSM) are designed to help you answer two questions:
1) Should I even bother building a full product?
2) If I do build the product, should I continue with incremental changes, or pitch the whole thing and start over?
As an entrepreneur with a product or business idea you are going be subject to three different cognitive illusions. These are things that are common to all of humanity, and there is little you can do to train them away. The three illusions I see as being the most problematic are Optimism Bias, Domain Expertise Confidence; Confidence in Prediction in an unstable environment.
Optimism Bias
Humans in general tend to think they perform better then average. In particular, entrepreneurs tend to be even more optimistic then the general population about their ability to beat the odds. For instance the base rate of failure for a new business is 65%. But the vast bulk of entrepreneurs consider their chance of failure at 40%. This delusion can help us make it through the day, but it can also cause you to stick with something for far too long. (Kahneman, Daniel (2011-10-25). Thinking, Fast and Slow (p. 256). Farrar, Straus and Giroux. Kindle Edition. )
Domain Expert Overconfidence
Everyone is over-confident about their ability to predict the future. Doesn't matter how much of an expert you are in your field, you are overconfident. Time and time again we see research that shows a crappy mathematical model that is informed by expert opinion is almost always better than either one alone. (http://www.rff.org/Events/Documents/Lin_Bier.pdf, all of "The Signal and the Noise").
The second part here is apropos to a problem I'm wrangling with at work. I'm working on a product that is all about market creation. By definition, my ability to research and learn about my market is terribly limited since the market doesn't exist. Learning the Lean Startup tools improves your metacognitive ability to see your own weakness in expertise and therefore adapt to it. (http://gagne.homedns.org/~tgagne/contrib/unskilled.html)
Confidence of Prediction
When you ask yourself "Do I need this feature in my product?", the question you are really asking is "Will adding this feature to my product add enough value to my business in the future to justify the (opportunity) cost now?". That is attempting to forecast the future, something humans can be good or bad at depending on how quickly they get feedback about their decisions. Firefighters and nurses, who get almost instantaneous feedback on the quality of their forecasting are able to build a great amount of skill in this area. Those of us running in longer time scales fall prey to building confidence in our predictions, but not actually improving our accuracy. Think of how much that sucks for a moment. You can be in a field for years, making forecasts, assuming you are getting better, but in reality, you aren't. (Kahneman, Daniel (2011-10-25). Thinking, Fast and Slow (p. 240). Farrar, Straus and Giroux. Kindle Edition.)
Essentially it all boils down to the fact that you are going to feel really confident about your idea and plans, but that confidence is not based on actual hard data. It is instead an illusion being fed on how we perceive and think about the world. You can't use your gut 'Confidence' check to know if you really have a product or not at the get go, we're just not wired that way.
But by acknowledging our limitations, we can figure out ways to work around them.
So how do you deal with this trifecta of Overconfidence in your idea?
To quote Steve Blank: "GET OUT OF THE BUILDING" and go talk to customers.
That's it.
All the different LSM out there have different suggestions on how to go about defining a market segment, finding customers, and how to talk to them. But it boils down to talking directly to customers to counteract your overconfidence. They all reccomend a progressive approach in how you do your research. You start with wide open investigational interviews, and as you learn more (and validate or invalidate your overconfident beliefs) you start using more structured interviews to gather more accurate data (but less wide ranging) including things like surveys and prototypes. You can even run A/B value prop testing with a mock web site and google adwords.
That said, you need to be cautious about over-generalizing your results. We humans love to see patterns and over value things we see and measure, even if they have low confidence.
(Patrick Leach (2006-09-15). Why Can't You Just Give Me The Number? (Kindle Locations 1911). Probabilistic. Kindle Edition. )
Launching - Answering the "Persevere or Pivot" question
These pre-launch experiments have a whole range of cost, accuracy, and specificity. On the low end you have informal unstructured interviews. This is great for proving things our early on, and also allowing you to find a better business idea then the one you thought of originally. On the high end of cost and complexity, you have large scale polling that you do right (i.e. random distribution of customers, proper question wording to avoid bias, etc). These aren't going to find you that better business idea, but can provide a very accurate and specific answer to the question you pose.
At some point though (and this will be very specific to you and your circumstances) you'll need to sit back and decide to stop pre-launch experments. When do you stop? When failing in market will be better then continuing to run experiments. For example, if you have a large existing business (lets say $100M in annual revenue) that you are thinking of disrupting with a new revenue model, you probably want to do the more formal methods since spending $50,000 on a polling firm and taking the time is small relative to the risk. But a 6 person startup with no actual revenue yet? Depends on the size of your market. If you only have 100 customers, you may want to do more upfront work because running experiments on customers can cause them to get grumpy and leave. But if you have a larger target market, it's fine to lose some customers while you work things out. If you are looking for a more decision science based approach, see Chapters 11 and 12 in Patrick Leach (2006-09-15). Why Can't You Just Give Me The Number?. The different market sizes account for the different approaches in the LSM books.
Once you get a product in market, you are still subject to the same overconfidence illusions around forecasting. This is where the second part of the LSM stuff kicks in: Analytics and Rapid iteration.
I'm totally thrilled to watch market after market get disrupted by rapid prototyping. On the hardware side we had FPGA's come along in the 90's that allowed really interesting products to be built without the capital outlay needed for an ASIC. On the SaaS side, AWS/DevOps/Harware as software movement has added nimbless to that field. Outside of computing, the revolution around rapid prototyping, 3D printing, and cheap CNC tools (like CNC plywood routers) has drastically changed things. Even the repatriation of hard goods manufacturing is occuring because it allows businesses to iterate faster (http://www.nytimes.com/2011/10/13/business/smallbusiness/bringing-manufacturing-back-to-the-united-states.html?pagewanted=all ).
How can overconfidence get you after launch? Go read the opening chapters of "The Startup Owners Manual" to learn about how Webvan's overconfidence caused them to ignore the metrics they were getting and fail big.
The steps at this point are:
1) Ship iteration of business (this includes ad copy, market segment, marketing webite and materials, actual product)
2) Observe behavior using quantitative metrics
3) Use that to drive qualitative discussions with customers
4) Make a hypothesis and modify product/web site/ad copy
5) Repeat
It's easy to get analytics wrong. Eric Ries labeled these 'Vanity Metrics'. These are metrics that are pretty much guaranteed to give you the answer you want (generally up and to the right). But much like qualitative interviews, there is a broad spectrum of accuracy and complexity around implementation. For that first launch you don't need much. Just a retention chart that is keyed off the activity that drives your engine of growth is enough to shake your confidence. You are looking for analytics that help you detect the huge problems in your overconfident assumptions. You aren't at the point where you care about 3% improvement in a number or running a linear regression on your data.
Don't know what metrics to track? Grab a copy of Lean Analytics (http://leananalyticsbook.com/). They breakdown a large number of different business models and what you should be looking at to decide if you should throw in the towel or not.
How quick should your iterations be? As quick as possible without pissing off your customers or partners. For instance, if you are growing rapidly you should iterate quickly (daily even?). As a portion of your customer base, those people irritated by all the change will always be a shrinking proportion of your total base since you are getting new customers at a very fast rate. I personally (overconfidentaly and untested of course) think you need to be willing to lose your early customers and therefore shouldn't worry about them.
One last moment of reflection. These are all really cool tools. But if you've already decided on a course of action, the value of any new information may be zero since it will not change your mind. In that case, just make your decision and go on. I like these tools (in particular stochastic modeling), but in all honesty, if you crack open Bayesian theory and run the numbers, they only help increase your odds of a good outcome by a small amount. This is due to the huge amount of raw luck and chance that exists in the world. A lot of this is outside of our scope of control (I feel for everyone who launched a new business right before the great recession).
So have fun and enjoy yourself!
Books:
"The Lean Startup"
http://theleanstartup.com/
"Lean Analytics"
http://leananalyticsbook.com/
"Thinking, Fast and Slow"
http://www.amazon.com/Thinking-Fast-Slow-Daniel-Kahneman/dp/0374533555
"Naked Statistics"
http://www.amazon.com/Naked-Statistics-Stripping-Dread-Data/dp/0393071952
"The Signal and the Noise"
http://www.amazon.com/The-Signal-Noise-Many-Predictions/dp/159420411X
"Why Can't You Just Give Me The Number? …Guide to using Probabilistic Thinking to Manage Risk and to Make Better Decisions"
http://www.amazon.com/Guide-Probabilistic-Thinking-Decisions-ebook/dp/B0029F2STA
"The Startup Owners Manual"
http://www.amazon.com/The-Startup-Owners-Manual-Step-By-Step/dp/0984999302
Tuesday, August 27, 2013
The Lean Startup Movement and the Quant Uprising
Tuesday, August 20, 2013
Recovery from CFS/Post Exercise Syndrome
I'm happy to say I no longer suffer from it.
While it was a slow slide, it hit me hard in the fall of 2008. I just had my first big release as a new engineering manager; planned a wedding and got married; and I started flight training that summer. By the time the wedding rolled around I was beat in a way I had never been tired before. No amount of coffee or sleep would help.
It took me 4 years to figure out all the contributing factors and rehabilitate myself. During that time I met with 7 different doctors trying to get a handle on all the different causes that would contribute to being run down.
I can be a tenacious bastard when I have a goal in sight.
At one point I was working with an endocrinologist and still couldn't handle aerobic exercise. 10 minutes with my heart rate above 105 bpm and I would need to sleep a couple of hours later. I had to ask him "Do you have any more ideas, is there anything else _you_ can do for me now?" after a long pause he admitted no.
Which was a good thing because then I went searching for more answers. In the end I had to address the following things to get my energy back:
- Allergies
- Sleep Apnea
- Stress Management
- Sleep Quality
- Vitamin D levels (I was near the level that causes rickets)
- Stress response to exercise
Saturday, August 17, 2013
Lean Startup Book Roundup
Monday, December 31, 2012
Thoughts on flying the Cessna 162
Yesterday I had a chance to fly the Cessna 162/Skycatcher. This isn't a review, just some thoughts on the experience. We just had almost 75 days straight of rain in Seattle. My drive to renton looked like: Joy; Despair; Joy; Despair; Joy as I drove through alternating spots of fog and sun. Luckily for me KRNT ended up in a spot of very clear skies centered around the Lake Young area. Pretty much everyone else looked socked in.
A little about my perspective: I've got about 70 hours, all in J-3 Cubs or Champs, only the first six were in a round gauge Evektor Sportstar. I got to the point in my training where I could take the sport pilot checkride back in August 2011, life intervened and I couldn't. This was my first flight since then.
I'm also out to fly as many different flying contraptions as I can. Gyroplane, weight shift trike, powered parachute, glider, motor-glider, balloon, did I miss any?. Therefore my training is biased heavily towards fundamental stick and rudder skills and learning a lot about aeronautics and aerodynamics. I'm not very focused on getting from point A to point B in an easy and quick manner.
I have a love hate relationship with the classic taildraggers. They definitely made me a much better stick and rudder pilot, hands down. But I occasionally wish for some creature comforts, like cabin heat, and not being passed by a big rig when following I-5 with a small headwind. Or an electrical system. Had I not stopped to explore what the rudder exists for, I'm pretty sure I would have my license by now.
RFS has three 162's on the line, and they do most of their primary flight training for private pilot in them. They are currently renting at $99/hr wet with no fuel surcharge. I met with John Miller, one of their full time instructors who recently moved here from Arizona.
The 162 is well thought out for life in a flight training environment. It's barren inside. In their desire to maximize useful load with the 1320 pound LSA gross weight limit, there is a lot of bare metal and unadorned plastic. I like the Mad Max look and a rattle can of flat black would get you there in a heartbeat :). Nice thing about barren? There isn't any upholstery to get stained and ugly looking. The only fabric was the carbon fiber seats done in a black cloth.
Fuel management is very reliable. There are fuel gauges in the wing roots that are just floating plastic balls in a tube of fuel. They are only calibrated for in-flight level reading. But the filler necks in both tanks are marked with little holes at 1/2, 3/4, and Full. RFS keeps the planes at 3/4 tanks to improve the available load for students and instructors. That's around 18 gallons, or 3 hours fuel. Fuel is just on or off and is always fed from both tanks via gravity.
I'm torn about the glass cockpit. So far in my training I've chosen to eschew use of a hand-held gps to try and hone my map reading skills. This has been a lifelong weakness for me, so I really wanted to learn how to do it better.
Surprising things for me about the glass:
- no need to slave the HSI to the 'compass'
- the compass is driven by a magnetometer. That means no whiskey compass errors. Ever.
- You can set heading and altitude bugs and the computer will announce on your headset as you approach them and deviate
- It shows TAS too (derived from the OAT prove and pressure from the kollsman window).
- It has synthetic vision, supposedly useful for accidental VMC->IMC. I fear that it will breed more deliberate flying through a layer by non IFR rated pilots.
The plane was pretty easy to fly. Very little adverse yaw, and man, I'm a little jealous of tricycle gear pilots right now. Takeoff was easy, with none of the excitement when the tail comes off the ground. I think density altitude was approaching -2000 feet, so we launched pretty quickly.
Landing was also straightforward, though it was a very different experience for me as we did a power on approach and had flaps to use. It was a little confusing, with power off abeam the numbers and no flaps (my comfort zone), there aren't too many variables to play with, pitch to set airspeed, add power if you are short, slip or go around if you are too high. We did full stall landings, so felt very familiar from that angle. It theoretically has a higher wing loading than a champ (11lbs vs ~8lbs), but aside from a very gentle crosswind I didn't get a chance to test that. Another day.
One big problem I had with the landing? I stayed off the heel brakes like was drummed into me. That means I was applying brakes on touchdown with those handy toe brakes... Even with that abuse the plane refused to depart the runway and groundloop (did I mention I'm a little jealous of the physics of tricycle gear). I'm a little worried about retraining myself when I fly a taildragger with toe brakes.
In flight? Not much to say. Doesn't buffet as hard as the champ before dropping a wing when stalling, but the horn screams for quite a long time. Departure stalls were more exciting as the pitch was held at 25 degrees until stall. Steep turns were easy, though I had a tendency to lose some altitude there. Site picture being 6'4" tall was difficult with steep turns to the left.
I'm 6'4" tall and weigh 170 lbs. Most of my height is in my torso. Comfort was about what I expect. Much more roomy than a 152. The stoke (stick/yoke) just barely hit my knees on full aileron deflection. Better than the back seat of a cub (but really, what isn't), more cramped than the Champ, though getting in and out was easier. I'm finding that high wing tandem works best for me. While in all cases I stare into the wing root, the tandem gets me further away from it and gives me more sky to look at.
The 162 looks like a nice addition to the planes used for training. I know if I was just starting (and didn't get bitten by the taildragger bug), going for the 162 with the glass would be a pretty straightforward decision for me.
Am I going to jump ship for the rest of my training? Unlikely. I'm a sentimentalist at heart. Not only does the slow drafty Champ have a long history, this particular one was owned by my friends father back in the 50's before it was sold to Snohomish Flying Service. I expect I'll get checked out in the 162 at some point (and the Evektor Sportstar) so those days when I'm looking for something a little more snappy I'll have choices.
Now if only I could find a SportCub to rent... (http://www.cubcrafters.com/sportcubs2).