[R-SIG-Finance] histogram, sd and mean questions

donahchoo at me.com donahchoo at me.com
Wed Dec 30 03:09:58 CET 2009


Hi,

I'm trying to plot the histogram, sd and mean of some range data I  
have collected and I have several questions.  First off, my statistics  
is ancient at best, so if I get things wrong forgive me.

What I'm trying to do is determine the range of the YM for 30 minute  
periods throughout the day.  I've got the code the determining range  
working, but my standard deviation plots appear to be off.

In the graph below the orange dotted line is the mean and the dotted  
red lines are +/- 1sd.  What I want to determine what ranges are  
within 1 sd of the mean and this graph looks off to me.

Can anyone confirm that I have (not) done this correctly?  Is there a  
way I can get a finer scale on the x axis? So far I haven't found a  
way to set tick marks on the charts...

Here's my R code:

 > hist(range_tmp, breaks=250, xlim=c(0,250))
 > abline(v=mean(range_tmp), col='orange', lty=2, lwd=2.5)
 > abline(v=mean(range_tmp) + sd(range_tmp), col='red', lty=2, lwd=2.5)
 > abline(v=mean(range_tmp) - sd(range_tmp), col='red', lty=2, lwd=2.5)

Thanks!







-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.png
Type: image/png
Size: 30726 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20091229/f0687b31/attachment.png>


More information about the R-SIG-Finance mailing list