Browse Subject Areas

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

Emergent User Behavior on Twitter Modelled by a Stochastic Differential Equation

Emergent User Behavior on Twitter Modelled by a Stochastic Differential Equation

  • Anders Mollgaard, 
  • Joachim Mathiesen


Data from the social-media site, Twitter, is used to study the fluctuations in tweet rates of brand names. The tweet rates are the result of a strongly correlated user behavior, which leads to bursty collective dynamics with a characteristic 1/f noise. Here we use the aggregated "user interest" in a brand name to model collective human dynamics by a stochastic differential equation with multiplicative noise. The model is supported by a detailed analysis of the tweet rate fluctuations and it reproduces both the exact bursty dynamics found in the data and the 1/f noise.


In the online era, humans are connected in real time on global scales. Local or seemingly local information is instantaneously shared across geographical boundaries. In particular, social online media have become an important platform for the sharing of information and have allowed for detailed studies of the coherent behavior of humans on a global scale [16]. The popular microblogging platform Twitter is a good source for such studies for two reasons. First, Twitter is more about providing news updates than developing social networks [7, 8]. User behavior is therefore to a large extent influenced by information available via other information channels in society. Secondly, users respond to available information by submitting short public messages, “tweets”, of up to 140 characters that may be seen as proxies for the public interest. Recent research on Twitter has used the activity levels in forecasting real-world events including fluctuations of stock market prices [9], real-time detection of the location and spread of earthquakes hitting populated areas [10], and for sentiment analysis and opinion mining [11].

In a recent paper [4], fluctuations in the tweet rates of 92 brand names are shown to be distributed with a power law tail with an exponent of −2.9±0.4(SD). The broad tail of the distribution is characteristic for bursty activity levels. It is moreover found that the power spectral density of the tweet rate signals are described by a power law with an exponent of −1.0±0.4(SD). This so called, “1/f noise”, is found in a range of complex systems including heartbeats [12], DNA base sequences [13] and condensed matter systems [14], and it is interpreted as a sign of a pronounced memory in the systems [15]. We attribute the power spectral density and the broad distribution in the tweet rate fluctuations to a strong correlation on a global scale in the collective human dynamics.

In this paper we consider the global user interest in a brand, which in our definition is the likelihood for a tweet to mention the brand name. The global interest in a topic is expected to change in a continuous and random fashion as the result of many independent events in society. We shall therefore describe the global user interest by a stochastic differential equation (SDE), which we derive by analyzing the fluctuations in the tweet rate. The SDE predicts simultaneously the power law exponents of the tweet rate distribution and the strong memory in the temporal variation of the tweet rates.

The paper is organized as follows, first we briefly describe the data acquired from Twitter and explain how the data is turned into a tweet rate. Then we introduce a method for analyzing the fluctuations in the tweet rate and demonstrate how it works on a generic signal. Our method is applied to data and supports an SDE with multiplicative noise. Finally, we show that the noise term in the SDE reproduces the power law distribution of the tweet rate as well as the power spectral density of the temporal signal.


Data collection and time signals

We used the public REST API by Twitter to collect tweets containing one of seven brand names during a time period in the fall 2012 and the spring 2014 (see Supporting Information sections S1 Supporting Information and S2 Supporting Information for data and a description of time periods). The brand names considered are “Samsung”, “Pepsi”, “Heineken”, “Gucci”, “Starbucks”, “BMW”, and “Google”. In the analysis, we chose to use international brand names for a number of reasons. First, the brand names are used globally and the users posting tweets about the brands in general transcend local communities. Secondly, the brands are sufficiently popular that a continuous and robust stream of tweets exists.

From the tweets collected, we save the time ti where a tweet is posted. The index i refers to the identification number of a given tweet. From the individual tweets, we form a time signal by summing over all tweets mentioning a given brand, where δ(tti) is the Dirac delta function. The time signal is turned into a tweet rate, x(t), by dividing the time axis into windows of length, ΔT, and summing the events in each window, (1) A plot of tweet rate signals is shown for a few brands in Fig 1, where both a regular daily variation and an irregular bursty behavior on top are distinctly visible. Burstiness is known to be inherent to individual human dynamics [16] and to have an impact on information spreading [17]. Here we see that bursts also appear in the aggregated interest level of many users in a large-scale social organization.

Fig 1. Tweet rate signals.

We show the number of tweets measured in a time window, ΔT = 10min, for a few brands. Note the regular daily variation and the irregular bursty behavior.

The algorithm

We now introduce a method to uncover the underlying stochastic properties of a time signal [18]. The method is based on the assumption that a signal, γ(t), is generated by a stochastic differential equation (SDE) on the form (2)

Here dW is a random Gaussian variable with mean, ⟨dW⟩ = 0, and variance, ⟨dW2⟩ = dt. The first term in Eq (2) gives the deterministic drift, while the second term gives the random diffusion. The differential equation will here be handled using Ito calculus. Note that the above equation is assumed to describe the dynamics of the global user interest and not the observed tweet rates given in Eq (1). Below we shall relate the two quantities.

It may be shown in the Fokker-Planck formalism [19] that if the variable takes the value, γ0, at time, t, then at some small time step, dt, later, it will be a random variable from a Gaussian distribution with mean, γ0+f(γ0)dt, and spread, g(γ0)dt1/2 (see Fig 2). It is therefore possible to get an estimate of f(γ0) and g(γ0) by binning all the signal values close to γ0 and then construct the corresponding distribution of signal values one time step later. From this distribution one may read off the mean and the spread to get the estimates of f(γ0) and g(γ0). The procedure is then repeated over the whole range of realized signal values in order to estimate the functional forms of f(γ) and g(γ), respectively.

Fig 2. Interpretation of the update formula in Eq (2).

If the signal at some point takes the value γ0, then a small time step, dt, later, its value will be realized from a Gaussian with a mean determined by f(γ0) and a spread determined by g(γ0). By performing statistics over many such realizations we may therefore obtain the drift and diffusion.

In Fig 3 we show the result of applying the analysis to a signal generated by (3) Comparing the analytical functions with the estimates, we get R2-values of 0.98 and 0.97 for the drift and diffusion respectively. The functional form of the drift and diffusion used here are equivalent to the ones fitted for “Samsung” below, and to make the comparison complete, we have also used the same signal length, N = 74,646, and time step, dt = 1. Note that bins with less than 20 data points have not been included, due to the otherwise poor statistics, and therefore γ only assumes values between 0.26 and 2.35.

Fig 3. Application of the algorithm to a generic signal.

A time series generated according to Eq (3) is shown in (A) and below we show the analytic drift, (B), and diffusion, (C), along with the functional forms estimated by the algorithm.



The stochastic differential equation, Eq (2) is formulated in the probability, γ(t), for a random tweet to mention a specific brand and not in the tweet rate. We call γ(t) for the “global user interest”. In fact, the expected number of tweets on a given topic, ⟨x(t)⟩P, in a time window, Δt, is given by the full number of tweets posted on Twitter within this time window, A(t), times the probability for any such tweet to mention the given topic γ(t), (4) Here the expectation value, ⟨⋅⟩P, refers to the Poisson weighted average of all the possible realizations of the tweet rate. The actual tweet rate signal is one such realization drawn from a Poisson distribution (5) The above equation summarizes the basic structure of our model: the observed signal, x(t), is realized from a Poissonian with a mean given by the product between the user interest, γ(t), and the activity, A(t).

Within the activity, A(t), we also include any factors depending on regional differences, since the global composition of active users is changing during a daily cycle. We will assume that A(t) may be approximated as a deterministic and periodic function of time and that γ(t) is reasonably described by the SDE in Eq (2). The goal of the following data analysis is to find the functional form of the drift, f(γ), and diffusion, g(γ), of the SDE.

Data analysis

It is problematic to apply the algorithm introduced in the methods section to the tweet rate signals, x(t), since we only expect it to apply to the underlying tweet probability, γ(t). We may reduce noise from the Poisson statistics by increasing the time window, Δt, thereby increasing the expected number of tweets and reducing the relative size of the Poisson noise. However, if we increase the time window too much, then we enter the domain of the mean field theory, where the time resolution is too low to see the dynamics of the γ(t)-fluctuations since they for larger times are dampened by the drift term. Also, for a limited time series we do not want to lower the time resolution, since it reduces the number of data points available for the analysis. In the following, we have chosen a time window of 30 seconds giving us approximately 80,000 data points for each brand. Unfortunately, this window size does not allow us to ignore the Poisson noise for any of the brands. We do however expect the time window to be small enough to resolve the important dynamics of the user interest.

The second problem that we face by applying the algorithm is the presence of the activity, A(t), relating the observed signal, x(t), to the signal of interest, γ(t). In the following analysis we will assume that the activity is a deterministic function of time with a daily period. One would naturally expect it to also have a weekly variation along with a variation on slower time scales, but here we will be interested in time scales below the resolution of a day, why it makes sense to approximate the activity by a daily period.

We may estimate the daily variation by averaging x(t) over many days to obtain a variable that is proportional to the activity (6) Here we introduced two more expectation values: ⟨⋅⟩D is the average of repeated measurements at the same time of day and ⟨⋅⟩T is the general time average. We have used that Poissonians sum to a Poissonian with an expectation value that is the sum of the individual expectation values. We have also used that A(t) and γ(t) are uncorrelated in our model, that γ(t) is independent of absolute time and that A(t) is a periodic function. In practice, the average is performed over 20 to 62 days of measurements and by smoothening data to a time resolution of 15 minutes. Using the obtained information, we may construct the variable (7) which is proportional to γ(t) if one averages out the Poisson noise (8)

The variable γ˜(t) is the closest approximation we get of γ(t) by our analysis. To see the effect of the Poisson statistics on our analysis, we have also generated the signal (9) and applied the algorithm to both γ˜(t) and x˜(t). The variable x˜(t) is equivalent to γ˜(t), but with the dynamics of γ(t) replaced by the mean value ⟨γT (compare Eqs (7) and (8)). By applying the algorithm to both γ˜(t) and x˜(t), we hope to be able to separate the effect of the daily variation and the Poisson statistics from the actual dynamics of γ(t).

In Fig 4A we show γ˜(t) and the corresponding instance of x˜(t) for “Samsung”. Note that the Poisson noise of x˜(t) is not enough to explain the bursty behavior observed for the tweet rates. The resulting drift (Fig 4B) and diffusion (Fig 4C) terms are estimated using our algorithm on the two signals shown below. The drift of γ˜(t) has been fitted with a function on the form (10) A best fit yields the coefficients af = 0.47 and bf = 0.43. Similarly, the diffusion has been fitted using a function on the form (11) with ag = 0.31 and bg = 0.23. The analysis has been performed in dimensionless time, ttt, such that dt = 1. We have been unable to estimate the error bars in the presence of the Poisson statistics.

Fig 4. Application of the algorithm to γ˜(t) and x˜(t) for the brand name “Samsung”.

The two signals are shown in A and below we see the drift terms, B, and diffusion terms, C, estimated by the algorithm. Also shown are the fits of the functions in Eqs (10) and (11) to the estimated drift and diffusion of γ˜(t).

Our algorithm estimates a linear drift term for both the data, γ˜(t), and for the synthetic signal, x˜(t). For x˜(t), we find a coefficient bf = 1, which is expected from a Poisson process. The fact that we find bf = 0.43 for γ˜(t) shows that the data is more rich than a simple homogeneous or a weakly inhomogeneous Poisson process. In other words, the fluctuations of γ(t) are comparable or stronger than the fluctuations generated by the superimposed Poisson process. While we cannot quantify the influence of the Poisson process on the linear drift, we are confident that γ˜ = 1 is the only stationary point of γ˜, corresponding to a potential, V(γ) = ∫γ f(γ′)′, with just a single minimum. Furthermore, we do not expect the drift to depart significantly from a linear form around and above the fix point. A drift term of this form limits the signal and allows bursts to be generated by the multiplicative diffusion term.

In the plot showing the diffusion terms, we find that the effect of the Poisson statistics is very distinctly visible as a constant background noise. It indeed matches the size of the coefficient ag pretty well. We therefore propose that the this first term is due Poisson noise and therefore that the underlying variable γ(t) is described solely by the second term, g(γ) = 3/2.

We apply the same analysis to the other brand names and provide in Table 1 the length of the fitted data series, Ndata, the mean tweet rate, ⟨x⟩, the ratio between the maximum and minimum of the daily variation, DV ≡ max[⟨xD(t)]/min[⟨xD(t)], and the goodness-of-fit values for the diffusion term, R2. We find that the fit captures the observed diffusion well for 4 of the 7 brand names, but it performs poorly for the last 3. We believe that this is the result of applying the algorithm to a limited time series under the effects of daily variation and Poisson noise. As an example of this, we show in Fig 5 the result of applying the algorithm to the tweet rate signal of “Starbucks”. We see that a Poisson process captures most of the fluctuations found in the dynamical signal, i.e. the diffusion terms of γ˜ and x˜ are approximately equal. We therefore conclude that the average interest, ⟨γ⟩, the big daily variation, A(t), and the Poisson noise is enough to explain most of the signal for “Starbucks”. This leaves very little room in the analysis to capture the dynamics of γ(t) (compare with Fig 4) and may explain the poor performance of the fit.

Fig 5. Estimated diffusion for the signals γ˜(t) and x˜(t) for “Starbucks”.

Note that the diffusion estimated for the two signals is almost equal for this brand name, therefore making it hard to filter out the effect of the dynamical interest γ(t) present in the signal of γ˜(t).

In general, however, we find that the analysis of γ˜(t) provides support to the hypothesized noise exponent of 3/2. We therefore propose that the global user interest is described by the following model (12) where f(γ) is a slowly decreasing drift term derived from a single well potential. We emphasize that in order to derive this result, we assume that γ(t) is described by the stochastic differential equation, Eq (2), and that A(t) can be approximated by a periodic function with a daily period. Finally, our method works best when the Poisson fluctuations are not too strong.

In the next section we show that if the single well potential defining f(γ) is approximated by an infinite well, we obtain a probability distribution with a power law exponent of -3 and a power spectrum with a power law exponent of -1. This is in agreement with the characteristic behavior of the brand name signals analyzed in [4].

Distribution and power spectrum from model

To derive the probability distribution and power spectrum for the model proposed in Eq (12) we switch from the Langevin equation to the corresponding Fokker-Planck formulation (13) Here we have approximated the drift potential by an infinite well. This yields a vanishing drift in the region γ ∈ [γmin, γmax] and reflective boundaries at the effective potential walls γmin and γmax. One finds the stationary distribution (14) where N is the normalization constant. The same asymptotic power law is found in the case of a linear drift, which is promising since it matches the behavior of the data.

Eq (13) may be solved using the method of eigenfunctions as explained in [20]. One finds that for an intermediate range of frequencies the power spectrum scales as (15) which is also the case for the data.

The model proposed for the dynamics of interest, Eq (12), is therefore successful at simultaneously explaining the scaling exponents of the signal distribution and the corresponding power spectrum. To show the validity of the infinite well approximation, we conclude the paper with a simulation of the model with a linear drift (16) An efficient and accurate numerical integration may be performed by considering the inverse variable, τ = 1/γ, which may be integrated using the splitting up method [21]. In Fig 6 we show the distribution and power spectrum for the simulated signal, and we observe that the linear drift is consistent with the power laws observed in the data. The exponent of the distribution is fitted to α1 = −2.961±0.002 using the maximum likelihood routine introduced in [5]. The exponent of the power spectrum is found to be α2 = −0.98±0.03 using a logarithmic binning and a least squares fit. The corresponding errorbars are estimated by bootstrapping.

Fig 6. Plots of the probability density function (A) and power spectrum (B) for a simulation of the model in Eq (16).

Note that the power law exponents of -1 and -3 match those of the data.


In this paper we have studied the dynamics of interest in global brands by analyzing tweet rates on the online social media site Twitter. As a result of the correlations in the user behavior, the rates are found to be bursty and distributed as a power law with an exponent of -3 and have a power spectrum inversely proportional to the frequency. Since the global interest in a brand name is the result of many random events, we have proposed to model it by a stochastic differential equation with a simple drift and a diffusion like term. By analyzing the fluctuations in the tweet rate signals, we find that the diffusion term scales like a power with an exponent of 3/2. The derived diffusion term may explain the pronounced burstiness and the 1/f noise observed for the tweet rate signals.

It remains an open question whether the dynamics observed for the brand names on Twitter can also be observed for the occurrence of other keywords or even in other large social organizations? Another interesting question, which we have not addressed with our model is, what is the detailed behavior of individual humans that leads to correlated behavior given by our model? In general, the growing information available on human behavior in global-scale social organizations has helped answer parts of these questions and further analysis along the lines of this paper might provide a more complete picture.

Author Contributions

Conceived and designed the experiments: AM JM. Performed the experiments: AM JM. Analyzed the data: AM JM. Contributed reagents/materials/analysis tools: AM JM. Wrote the paper: AM JM.


  1. 1. King G. Ensuring the data-rich future of the social sciences. Science(Washington). 2011;331(6018):719–721.
  2. 2. Osborne M, Dredze M. Facebook, Twitter and Google Plus for Breaking News: Is There a Winner? In: Proceedings of the International Conference on Weblogs and Social Media; 2014.
  3. 3. Hermida A, Lewis SC, Zamith R. Sourcing the Arab Spring: A case study of Andy Carvinś sources on Twitter during the Tunisian and Egyptian Revolutions. Journal of Computer-Mediated Communication. 2014;19(3):479–499.
  4. 4. Mathiesen J, Angheluta L, Ahlgren PT, Jensen MH. Excitable human dynamics driven by extrinsic events in massive communities. Proceedings of the National Academy of Sciences. 2013;110(43):17259–17262.
  5. 5. Alstott J, Bullmore E, Plenz D. powerlaw: a Python package for analysis of heavy-tailed distributions. PloS one. 2014;9(1):e85777. pmid:24489671
  6. 6. Garas A, Garcia D, Skowron M, Schweitzer F. Emotional persistence in online chatting communities. Scientific Reports. 2012;2. pmid:22577512
  7. 7. Kwak H, Lee C, Park H, Moon S. What is Twitter, a social network or a news media? In: Proceedings of the 19th international conference on World wide web. ACM; 2010. p. 591–600.
  8. 8. Myers SA, Sharma A, Gupta P, Lin J. Information network or social network?: the structure of the twitter follow graph. In: Proceedings of the companion publication of the 23rd international conference on World wide web companion. International World Wide Web Conferences Steering Committee; 2014. p. 493–498.
  9. 9. Sakaki T, Okazaki M, Matsuo Y. Earthquake Shakes Twitter Users: Real-time Event Detection by Social Sensors. In: Proceedings of the 19th International Conference on World Wide Web. WWW ’10. New York, NY, USA: ACM; 2010. p. 851–860. Available from:
  10. 10. Bollen J, Mao H, Zeng XJ. Twitter mood predicts the stock market. CoRR. 2010;abs/1010.3003.
  11. 11. Asur S, Huberman BA. Predicting the Future with Social Media. CoRR. 2010;abs/1003.5699.
  12. 12. Kobayashi M, Musha T. 1/f fluctuation of heartbeat period. Biomedical Engineering, IEEE Transactions on. 1982;(6):456–457.
  13. 13. Voss RF. Evolution of long-range fractal correlations and 1/f noise in DNA base sequences. Physical review letters. 1992;68(25):3805. pmid:10045801
  14. 14. Weissman M. 1/f noise and other slow, nonexponential kinetics in condensed matter. Reviews of modern physics. 1988;60(2):537.
  15. 15. Keshner MS. 1/f noise. Proceedings of the IEEE. 1982;70(3):212–218.
  16. 16. Barabasi AL. The origin of bursts and heavy tails in human dynamics. Nature. 2005;435:207. Available from: = pmid:15889093
  17. 17. Horváth DX, Kertész J. Spreading dynamics on networks: the role of burstiness, topology and non-stationarity. New Journal of Physics. 2014;16(7):073037.
  18. 18. Siegert S, Friedrich R, Peinke J. Analysis of data sets of stochastic systems. Physics Letters A. 1998;243(5):275–280.
  19. 19. Gardiner C. Stochastic Methods: A Handbook for the Natural and Social Sciences. Springer Series in Synergetics. Springer; 2009. Available from: = otg3PQAACAAJ.
  20. 20. Ruseckas J, Kaulakys B. 1/f noise from nonlinear stochastic differential equations. Phys Rev E. 2010 Mar;81:031105. Available from:
  21. 21. Bensoussan A, Glowinski R, Raşcanu A. Approximation of some stochastic di erential equations by the splitting up method. Applied Mathematics and Optimization. 1992;25(1):81–106.