Previous Entry Share Next Entry
11:58 am, 30 Jan 05

a better graph

I finally figured out something that I've been fighting with forever: I have a bunch of data that I want to get the general trend of. My weak stats background makes me think of Kernel Smothing [that looks like a pretty good overview] but in statsland you're always doing it over probability distributions and not counts, like I have above.

The solution is do do it effectively manually: the R dnorm function is the density function of a normal distribution, and then the filter function effectively, uh, convolves that kernel against the data. But I'm not quite sure this is yet correct: does it, for each data point, sum in all the contributions of the points around it using the normal distribution? Or does each point contribute a normal distribution's worth of density to the points around it? I'm shamefully poor at this stuff.

In any case, the above was generated with:
plot(d$date, filter(d$count, dnorm(-40:40,sd=20)), type='l', main='Average Posts per Day', ylab='Posts', xlab='Year', frame.plot=F, lwd=2)