Chronos: An R Script to Analyze the Distribution of Time Between Two Events

If someone asked you about your site’s conversion rates, you could probably tell them what the conversion rates are (right?). But what if someone asked you what % convert within an hour, a day, or a week?

We’ve been looking at this at Automattic and I wound up putting together an R script to help with the analysis. Because everything needs a fancy name, I dubbed it Chronos and you can check it out on Github.

All you need to do to use it is generate a CSV containing two columns: one with the unix timestamp of the first event and another with the unix timestamp of the second event:

1350268044,1408676495
1307322538,1350061315
1307676110,1340667657
1307661905,1337311786
1307758702,1428877904
...

The script will then show you the distribution of time between the two events as well as the percent that occur prior to a few fixed points (30 minutes, 1 hour, etc):

Distribution:
5% within 2 minutes 
10% within 5 minutes 
15% within 1 hour 21 minutes 
20% within 1 day 38 minutes 
25% within 3 days 2 hours 58 minutes 
30% within 6 days 9 hours 20 minutes 
33.33333% within 11 days 
35% within 14 days 
40% within 23 days 
45% within 42 days 
50% within 67 days 
55% within 95 days 
60% within 148 days 
65% within 210 days 
66.66667% within 232 days 
70% within 288 days 
75% within 390 days 
80% within 550 days 
85% within 677 days 
90% within 920 days 
95% within 1288 days 
100% within 1715 days 

Percentage by certain durations:
13% within 30 minutes
14% within 1 hour
17% within 5 hours
20% within 1 day
30% within 7 days

In addition to analyzing conversion rates, you can use this to measure things like retention rates. The data above, for example, looks at how long between when users logged their first beer and last beer in Adam Week‘s handy beer tracking app, BrewskiMe (thank you again Adam for providing the data).

If you run into any issues or have any suggestions for how to improve it just let me know.

My Daily Schedule

I love learning about other people’s daily schedules because it often helps me improve my own. With that in mind, here’s what my typical weekday looks like these days:

7am/8am – I wake up when my 14-month old son Mason wakes up and starts complaining. I experimented with waking up at 6am for the first two weeks of January, but really don’t like getting up earlier than I have to so it didn’t last. My wife is 8 months pregnant so I try to let her sleep in.

 7:30am – 8:30am/9am – Take care of Mason, make breakfast, shower.

9am – 12pm – Work. At Automattic we all work remotely so I’m very fortunate not to have a commute. One day a week I cowork at Canvs in Orlando. Some days I work from local coffee shops, mainly Starbucks. I have 2 to 3 meetings per week (via Zoom or Google Hangouts) all of which usually last less than an hour. Most of the time I’m reading about other things going on at Automattic, participating in discussions relating to whatever I’m working on, or coding.

12pm – 1pm – These days, I take an hour midday to eat lunch (a salad), stretch (via the Yoga Studio app), meditate (via the Calm app), and watch a TED talk (on Netflix).

1pm – 4pm/5pm – Work. Some days I hit the gym around 4pm, but most days I work until around 4:30pm or 5pm.

5pm – 9pm/9:30pm – Family time.

9pm/9:30pm – 10:30pm/11pm – Some mix of reading, side projects, straightening up the house, and TV before heading to bed.

Not every day as structured as this might make it seem, but this is a pretty good approximation for how my weekdays go.

Our second kid is due in mid-March… it will be interesting to see how all of this changes after he or she arrives 🍼.

If you’re open to sharing your schedule, please drop me an email or message me on Slack. Maybe we can get a few ideas from each other to experiment with in our own schedules.

February Fitness Challenge, January Results

January’s Bet

At the beginning of January I posted about my goal to drop 5 pounds by the end of the month and offered to pay my friend Tom $300 if I didn’t reach it.

Today is February 1st and the final number is… down 4.4 pounds. Whomp whomp. The “good” news is that Tom fell short of his goal as well and because I was close, we’re just going call it even.

For February, I’m going to do something similar but iterate on the rules because the ones outlined above have some weaknesses:

  • First, it’s all or nothing. Being down 4.9 pounds or up 10 pounds is the same if the bet says if you don’t drop 5 you lose.
  • Second, my weight tends to fluctuate each day to day, so while I was in the 186s most of last week, I happen to weigh in above 188 today.
  • Third, while not losing money is a powerful incentive, it would be nice if there was the potential to win money as well.

With these in mind, here’s my bet with Tom for February:

My goal is to get to 184 pounds (down 4.6 pounds from this morning). For the last week of the month, I’ll weigh in each morning then we’ll use an average so that the day to day fluctuations even out. For every pound I’m over 184, I’ll pay Tom $50. For every pound under 184, he’ll pay me $50. If I’m successful, that will put me down 9 pounds from the beginning of the year.

Reflecting on January

I’ve been experimenting with a lot of lifestyle and diet changes over the last few weeks.

What went well

  • I’ve checked in on the Way of Life app every day since I started tracking on January 10th. The accountability it provides definitely helps me build good habits and avoid bad ones.
  • Most days I eat a light breakfast (scrambled eggs + guac) + a salad for lunch. I think a big factor in my weight loss in January was due to this.

What went alright

  • I started stretching and medidating several times a week. Ideally I’d like to do it once a day, but I’ve been having trouble fitting it in. At the beginning of January I tried waking up an hour early to start the day off with these and other healthy habits, but I’m not a morning person so it didn’t last. For the second half of the month I tried doing it before I went to sleep which works OK, but when I’m tired staying up an extra 20-30 minutes to stretch and meditate isn’t that appealing. For February, I’m going to try taking some time around lunch to stretch, meditate, eat a salad, and watching a TED talk (a new daily habit I’m starting) which should let me check off 4 of my daily habits in less than an hour.
  • I mostly avoided sugary drinks, but still average about 2/week.

What went poorly

  • I noticed that when I eat out I tend to use it as an excuse to eat whatever I want by telling myself “I eat well most days, I’ll treat myself today”. Going forward, I’m going to try to grab a salad whenever I eat out (I’m adding a “Eating a Salad When Eating Out” to my Way of Life habit list).
  • Between travel and a cold the last week of the month, I only wound up working out about twice per week, short of my goal of 3-4 times per week.
  • I started tracking “Eating Sweets” about a week ago and realized that I wind up eating something sugary most days (ice cream after dinner, etc). This is something I’d like to cut down on in the future.

I’m happy with the progress I made in January and am looking forward to continuing to build healthier habits going forward. Writing about it here helps keep me accountable and lets me share what I’m learning so thank you for reading :). If you have any recommendations that might help, don’t hesitate to drop me a note.