Skip to content

Histogram and moving average

2 messages · Vallat Morgan, Dieter Menne

#
Hi everyone,

I have a 'basic' issue and hope someone has a bit of code to solve it. I
have two populations plotted as histograms on the same figure. Basically I want to add the moving average (based on hist) for both populations on my graph. I'm also interested in the x coordinate of the curves intersection. Any thoughts?

Your help would be much appreciated!
Thanks,

Gan
#
Vallat Morgan <morgan.vallat <at> epfl.ch> writes:
want to add the moving average
coordinate of the curves
Moving averages are fine if you do not have future data (such as stock markets
or temperatures), but suboptimal for densities.

R has powerful methods for these: If you have MASS (the book, check ch. 5.6). Or
the examples in library/MASS/scripts/ch05.R

Dieter