How I Attempted to Mathematically Model the Spread of Memes on the Internet, pt 2.
Welcome back! If you’re new to my blog and haven’t read part 1 of this series, you can find it here.Â
Now we know enough about Markov chains to start using them to model the spread of memes! This part of the series will primarily involve setting up the model. Here’s a brief outline:
From SIR Model to Meme Model
In my first post, I stated that my project was originally focused on using Markov chains in disease modeling. My plan was to take SIR Models and adapt them to Markov chains. I ultimately ended up taking this same Markov chain adaptation and using it for my meme model.
I’ll start by discussing SIR Models in general and then we’ll get into Markov chain stuff.
SIR Models are typically used with differential equations to model the spread of infectious diseases. The name comes from the three equations that are used in the model.Â
S(t) = SÂ - for susceptible. This function plots the number of individuals that have not become infected with the disease.Â
I(t) = IÂ - for infected. This function plots the number of individuals that are currently infected with the disease.Â
R(t) = RÂ - for recovered. This function plots the number of individuals that have recovered from having the disease.Â
I won’t go into the differential equation version of these, but I definitely encourage you to delve more into them if you’re interested.Â
How do these correspond to Markov chain states?
Good question. For my Markov chain adaptation of these equations, my three states come from those three equations. My states are:Â susceptible ( S ), infected ( I ), and recovered ( R ).Â
From SIR Model to Meme Model
What do SIR Models and memes have to do with each other?
Here’s how I connected the two. I’m essentially viewing the spread of a meme over the Internet as if the meme were a disease and the Internet was a population. It’s this connection that drives the rest of this project. We can see that the spread of a meme behaves like the spread of a disease when we look at some graphs.Â
First, take a gander at this typical SIR Model graph, paying special attention to I(t). I(t) is the equation that models the population that is infected, which is what we’re really concerned with.Â
This I(t) has a strong sharp peak at first and then decreases. This is typical with what we expect with diseases: we have the initial “outbreak” corresponding to the sharp peak, and then as the population begins to recover, I(t) decreases.Â
Compare the shape of this I(t) to the shape of the Google Trends graph for the search term “dat boi”. Let’s quickly note that Google Trends plots the popularity of the search term and not the meme, but I think it’s safe to assume that the popularity of the search term is directly related to the popularity of the meme itself.Â
Well, hey, they look pretty similar! This is nice because it means we can attempt to use our Markov chain adaptation of SIR Models to try and model this behavior!Â
Before we go more in depth, let’s talk about what the states of my Markov chain are in context with memes.Â
Susceptible - an individual is in this state if they have not seen the meme in question.Â
Infected - the individual is in this state if they have seen the meme and are actively sharing it among peers.Â
Recovered - an individual is in this state if they are no longer interested in the meme and are no longer sharing it.Â
What does the Markov chain look like?
Here’s a visual for my Markov chain for the SIR Models.
This requires a bit of explaining. S, I, and R are the susceptible, infected, and recovered states respectively. The arrows indicate moving from one state to the next, and the probabilities of moving are written next to the arrows.Â
For example, an individual moves from the susceptible state to the infected state with a probability $\alpha$. If an individual does not move to the infected state, they stay at the susceptible state with a probability $1-\alpha$. Let’s define our probabilities really quick:
$\alpha$ - the probability of moving from susceptible to infected.
$\beta$ - the probability of moving from infected to recovered.
$\gamma$ - the probability of moving from recovered to infected.Â
Using what we learned in the last post, we come up with the following transition matrix, $M$:
Our columns are organized S, I, R from left-to-right. Our rows are similarly organized from top-to-bottom. Â
Each $M_{i,j}$ is the probability of going from state $j$ to state $i$.Â
Now that we have our transition matrix, we can do ~really cool things~ with it.Â
What are these “really cool things”?
The transition matrix itself doesn’t tell me a whole lot of information unless I know what my probabilities are. Because we’re looking at this in general, our specific probabilities are unknown. However, not all hope is lost because I can do some cool tricks that will tell me more.Â
Recall that if I want to find the probability of being in state $i$ after starting in state $j$ after n time steps, I just find $M_{i,j}^n$.Â
So how can we find $M^n$ without knowing the probabilities?Â
Here’s the trick: we diagonalize $M$. That is, I want to find matrices $P$ and $D$ such that $M = PDP^{-1}$. Then when I raise both sides to the nth power, the right side will cancel out so that I’m left with $M^n = PD^nP^{-1}$. $P$ is the matrix of our eigenvectors and $D$ is the diagonal matrix of our eigenvalues. We obtain:
Because $D$ is diagonal, it makes the matrix multiplication a bajillion times simpler. Raising $D$ to the nth power just raises each individual entry in the diagonal to the nth power.Â
The entries of $M^n$ that I’m concerned with are the entries in the first column. These are the probabilities of being in each state after starting from the susceptible state. So, I’m only going to perform the matrix multiplication enough to get the first column of $M^n$ (but you’re more than welcome to perform the whole thing if you’d like).Â
Additionally, I want to think of these entries as continuous functions (instead of with discrete time steps). This is an extension of the model and will allow me to me to do more ~cool things~. Therefore, I will use the continuous variable t instead of the discrete variable n.Â
You can check for yourself, but by multiplying these matrices out, we obtain the following functions (these are the first column entries of $M^n$):
where S(t) is the probability of being in the susceptible state at time t, and the same for I(t) and R(t) for the infected and recovered states respectively.Â
If you’re interested, here is a link to a graph on Desmos with sliders for $\alpha$ ( a ), $\beta$ ( b ), and $\gamma$ ( c ) you can play with.Â
Now that we have these equations, we can attempt to model the spread of a meme! However, for the sake of length, we’ll save this for next time.
Next, we’ll talk a little bit more about these equations, specifically I(t). Additionally, we’ll take data from Google Trends and attempt to find the $\alpha$, $\beta$, and $\gamma$ that will best fit our I(t) equation to the data. We’ll also try to see if there is any way we can predict what $\alpha$, $\beta$ and $\gamma$ could be from an initial set of data points. Stay tuned!
As always, if there are any questions/comments/concerns, feel free to send an ask.Â
Update: Here is Part 3 (The Final Chapter) of this series.Â
Where I Got My Pictures From
Google Trends (which is actually super fun to just play around with)