Have you ever wondered what makes some instagram photos get a ton of likes, while others can barely hit 10? Why does Selena Gomez have 750 million likes on a photo of her chilling next to a car, while my very best photo of my friend and I at the Beyonce concert maxes out at 50? (I mean obviously she’s famous, so there’s that.) More importantly, is it possible to figure out what makes an image more ‘likeable’ and then max out the likability of that photo? Or are humans so confusing and flaky for our tastes to ever be predictable?

When posting an insta, I’ll look at a variety of pictures from the same event, and I’ll pick one that represents whatever fun thing I did the best and adds variety to my feed (been posting a lot of selfies lately? I’ll post a pic of the friend I hung out with. Tons of group shots? Maybe it’s time for a nice landscape photo. Need a buffer between people posts? I’ll add the pic of that nicely lit dinner I had last week.) I consider a few main characteristics: the time at which I’m posting (Friday night? good luck getting any likes), the human composition (selfie? group shot? am I in it?), and whether it’s a landscape or portrait shot. These, I think, are distinguishing factors of insta posts, which I think will have some effect on the number of likes the post gets. But do they really? Thankfully, I can look at the actual data to find out!

I’ll start with the simpler characteristics of the posts themselves, and later on we’ll revisit variety effects (e.g. will a selfie do better if it’s not preceeded by another selfie?). Now, How ready are you to dive in? (suggested response courtesy of SNL: “Sofa King Ready!”)

Data Collection Method

Ok, so here’s where things get old school. After messing around with instagrams APIs for an ENTIRE day and not being able to download a ton of data, I decided that doing things the “right” way would take WAY too long, and hell, I just want to do a little poking around to see if any trends hold, so I don’t need a ton of high quality data yet. So after work one day I fueled up on 5-Guys cajun fries and decided to - hold on to your hats now - enter data manually. That’s right. I split my screen and entered, by hand, the date, time, number of people, and info on whether it was a selfie or a portrait or a landscape for my most recent 60 photos. If you’re wondering, it actually only took about an hour, but I do not intend on doing it again any time soon. However, now I’ve got some data! Here’s a glimpse at what it looks like raw:

##    date_posted time_posted day_of_week num_people includes_me
## 1:  06-29-2016     3:35 AM   wednesday          1           0
## 2:  06-18-2016       23:44    saturday          3           1
## 3:  06-12-2016       13:22      sunday          2           1
## 4:  06-05-2016       19:12      sunday          2           1
## 5:  06-02-2016        3:21    thursday          2           1
## 6:  05-30-2016       20:25      monday          1           0
##    portrait_v_landscape num_likes
## 1:             portrait         7
## 2:             portrait        24
## 3:            landscape        35
## 4:             portrait        21
## 5:             portrait        24
## 6:             portrait        12

You’ll notice that time posted is a little weird - google sheets loves to inconsistently auto-correct time (ugh). That’s going to be super fun to deal with. Otherwise, things are looking pretty good!

Initial Observations and significance testing

Okay let’s get moving! The first thing I want to do is just look at trends in the data. In the end I’ll want a predictive model, but let’s get our feet wet by testing a few single variable hypotheses before blindly dumping everything into a model. We want to UNDERSTAND the data. FEEL the data. BE the data. OMMMMM.

Portrait vs Landscape

The first hypothesis is that portrait-style images do better than landscapes. I’m defining as a portrait pretty much anything that is not a landscape photo, so this includes close-ups of fun sidewalk art and the ever so famous food-sta-gram (since I tend to stick with the default square insta’s, I won’t define these labels by dimensions). We’ll go ahead and look at the distributions of number of likes by style in box-plot form, side by side:

Wow. I was totally wrong. Not only are the distribution of number of likes very similar for landscape and portrait posts, if anything the median number of likes for landscapes is HIGHER than that of portraits! This could mean one of a few things:

  1. People love landscapes (!)
  2. The fact that there are different types of portraits could mean that the distribution we’re looking at is an average of two populations that are actually different. What I mean by this is that maybe portraits of people do great, but that photo of the sidewalk I took last week is bringing down the average. In the next section, we’ll try to figure out whether this is the case.
  3. Maybe these populations are actually indistinguishable. Portraits and Landscapes look the same, so we should stop worrying about it and leave this variable out of the model.

How do we know whether this could actually be the case? We can determine whether the sample means are statistically different from each other by using a t-test, as long as the right assumptions hold. We’re bending the rules here a little bit because ideally we’d like to have random samples of data, and my samples are systematic, including only my most recent posts. We’d also like to know whether the two samples have similar variances, which we can determine with a quick F-test:

var.test(instaData[portrait_v_landscape=='portrait', num_likes], instaData[portrait_v_landscape=='landscape', num_likes])
## 
##  F test to compare two variances
## 
## data:  instaData[portrait_v_landscape == "portrait", num_likes] and instaData[portrait_v_landscape == "landscape", num_likes]
## F = 1.1956, num df = 44, denom df = 14, p-value = 0.7445
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.449793 2.606084
## sample estimates:
## ratio of variances 
##           1.195568

The p-value on our F statistic is 0.744, meaning we have no evidence that the variances of our two samples are any different from one another. Great! let’s move forward with the t test:

t.test(instaData[portrait_v_landscape=='portrait', num_likes], instaData[portrait_v_landscape=='landscape', num_likes], var.equal=TRUE, paired=FALSE)
## 
##  Two Sample t-test
## 
## data:  instaData[portrait_v_landscape == "portrait", num_likes] and instaData[portrait_v_landscape == "landscape", num_likes]
## t = -0.1533, df = 58, p-value = 0.8787
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -5.622546  4.822546
## sample estimates:
## mean of x mean of y 
##      18.0      18.4

And the winner is number three - the two are indistinguishable! Our t-test results tell us that there’s only a whopping 87% chance we would see the means that we do in our samples given that the two populations actually have different means. AKA there’s no difference between landscape and portrait pics.

Humans like humans

One thing I’m finding in this analysis is that humans (those other guys liking my posts) like other humans (or at least they like pictures of them).

human portrait vs food portrait

Let’s first look at portrait types. Here I’m taking all portraits and splitting them into two categories, those that have zero humans, and those that have one or more. This is testing the difference between a photo like this:

and one like this:

Portrait posts without humans look like they get fewer likes than those with. I don’t find this that surprising. Think about photos you like to look at. Would you rather look back on your facebook photos from 2012 (oh those good old days of college) or the ones you put in that album titled “photography” you made after you spent your entire summer earnings on an SLR? Let’s run a quick test to see whether statistics thinks these are different from one another (we’ll have to do a Mann-Whitney-Wilcoxon test here since the variances appear to be different - trust for now that this is the right test and we’ll come back to this decision in a later post):

## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  instaPortraits[nonHumanPortrait == 1, num_likes] and instaPortraits[nonHumanPortrait == 0, num_likes]
## W = 137, p-value = 0.01171
## alternative hypothesis: true location shift is not equal to 0

And it looks like statistical significance holds! We know this because our p-value is less than 1%, meaning that there’s less than a 1% chance our samples would look as different as they do if in truth they were the same. Damn, we humans sure are nice to look at!

Number of people

So this one is kind of interesting. I’m top-coding my data at 5 people (becuase I’m too lazy to count higher than that… deal with it). Feel free to disregard 3-5 now, though, since each of those categories only account for 2-3 posts.

I’m willing to move forward thinking that the result here being that more people is better, but I’d love to return to this once I have more data and see if results hold. I wonder whether, in the pictures with one person, it depends on if I am the one person (#selfie!) or if it’s someone else. We’ll save that thought for later, since subsetting to single-person photos will pretty severely limit the sample size. I’ll also hold off on any significance testing here, again since sample sizes are pretty small once the data are broken down.

Am I in it?

Although I can’t look JUST at single-image photos, I can subset to images that have some number of people (again, not a sidewalk), and see whether the ones I’m in do better than those I’m not in.

Guys, this might be the most compelling difference I’ve seen all day! My followers love photos of me. This is hardly surprising (she says after she has seen the results). My followers follow me! So likely that means they are my friends and they’re interested in seeing pictures of me.

Let’s do a quick significance test, just to be sure:

## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  instaData[num_people > 0 & includes_me == 1, num_likes] and instaData[num_people > 0 & includes_me == 0, num_likes]
## W = 163, p-value = 0.01494
## alternative hypothesis: true location shift is not equal to 0

And, with a p-value of 0.014, we’re significant at the 5% level!

Timing results are confusing (also, why do I always post on Sundays?)

In addition to characteristics of the photos posted, I have this feeling that the timing of posts is key. Unfortunately, I’m feeling too lazy right now to clean up time of day data, so for a first pass we’ll look at days of the week.

Interesting, most of my posts are on weekends, with Mondays and Thursdays not too far behind. What is it about Friday, Tuesday, and Wednesday that makes me not want to post? I guess I only got into #throwbackthursday and kind of missed the boat on those other themed days of the week.

Okay, now what about likes? Here are distributions of likes for a given post separated into the day of the week they are posted on.

It’s hard to say there are real differences between the different days of the week. Sunday looks higher than monday, and wednesday looks pretty darn low. This is interesting, because one might think that if I implicitly knew the number of likes I was going to get based on the day of the week, I would stop posting so much on certain days. This clearly isn’t the case, though, or I would probably know not to post on a Monday.

I’d love to know whether these populations are significantly different from each other; however, with so little data and such overlapping medians, I doubt any day will be significantly different from another, especially given the small sample sizes.

As I mentioned before, my time/date data is not amazing and right now I don’t feel like finagling with it (let’s be real, I’ll scrape that POSIX time in like a week so y’all can calm down). I can, however, look at month effects for the first 6 months of 2016 (and so can you!)

This isn’t amazingly telling, but does support the claim that as time goes on, the number of likes I get on posts increases (probably because I’m accruing more followers over time).

stay tuned for next time…

Next time we’ll talk about scraping data and getting those good, high quality dates. After that, we’ll think about how to structure our analysis: lots of variables mixed with small sample sizes can make our results seem better than they really are, and we don’t want any of that. The future also predicts that we’ll look at significance and think about further testing and simulating (especially now that our populations will be more complete).