The Student Room Group

Is there any other way to plot frequency data?

I have some data on the number of tweets made during a 24 hour period. Apart from plotting a frequency of tweets for each hour (or each 20min segment, or 10 min....), is there any other way to show how the number of tweets made varies over the 24 period.

I was thinking along the lines of a probability density function, but I don't know how that works. Or a 'normalised' frequency graph, because I do plan on comparing each day of the week.
Original post by lunnndoner
I have some data on the number of tweets made during a 24 hour period. Apart from plotting a frequency of tweets for each hour (or each 20min segment, or 10 min....), is there any other way to show how the number of tweets made varies over the 24 period.

I was thinking along the lines of a probability density function, but I don't know how that works. Or a 'normalised' frequency graph, because I do plan on comparing each day of the week.


The usual way of doing this (if you have enough data, which I would assume you do as it's twitter!) is to use a smoother of some sort. First of all, calculate the cumulative incidence function, then smooth this cumulative function and then use whatever predict function you have available to predict the derivative of the smoothed cumulative function. For example, in "R", the following code generates incident events from a homogeneous Poisson process and then smooths the rate function.

N <- 100
x <- cumsum(rexp(N))
smooth_cumulative <- smooth.spline(x, 1:length(x), df=5)
rate_smooth <- predict(smooth_cumulative, 0 : (N-1)), deriv=1)
plot(rate_smooth, type="l", col="blue", lwd=2)

You'll need to experiment with the degrees of freedom in the smoother.

If you tell me what software you are using, I'll see if I can identify the right command for you.
(edited 7 years ago)
Reply 2
Original post by Gregorius
The usual way of doing this (if you have enough data, which I would assume you do as it's twitter!) is to use a smoother of some sort. First of all, calculate the cumulative incidence function, then smooth this cumulative function and then use whatever predict function you have available to predict the derivative of the smoothed cumulative function. For example, in "R", the following code generates incident events from a homogeneous Poisson process and then smooths the rate function.
N <- 100
x <- cumsum(rexp(N))
smooth_cumulative <- smooth.spline(x, 1:length(x), df=5)
rate_smooth <- predict(smooth_cumulative, 0 : (N-1)), deriv=1)
plot(rate_smooth, type="l", col="blue", lwd=2)
You'll need to experiment with the degrees of freedom in the smoother.

If you tell me what software you are using, I'll see if I can identify the right command for you.



I was actually hoping I could just use excel with this task. I don't know how to use R. How do I calculate the culmulative incidence function from just the frequency?
Original post by lunnndoner
I was actually hoping I could just use excel with this task. I don't know how to use R. How do I calculate the culmulative incidence function from just the frequency?


Exactly what form do you have the data in? As far as I'm aware, the only built-in command in Excel for doing this is "exponential smoothing" which is in the Data Analysis toolpak.
(edited 7 years ago)

Quick Reply