[R] Equal Standard Error bar

David L Carlson dc@r|@on @end|ng |rom t@mu@edu
Tue Sep 4 22:58:04 CEST 2018


Thank you for the reproducible data, but it is not the data used in the plot you attached and does not plot anything with the code you included. The ylim= argument must be modified:

plot(-5:10, oomean, type="b", ylim=c(40000, 120000),
  xlab="days (epoch is the day of Fd)", ylab="strikes/day",
  main="Superposed Epoch of all the Events")
dispersion(-5:10, oomean, oose, arrow.cap=.01)

On the plot of these data it is clear that the error bars are different sizes:

range(oose)
[1] 1728.234 6890.916

What was the range of oose values for the data in the plot you included with your message?

----------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Ogbos Okike
Sent: Tuesday, September 4, 2018 2:35 PM
To: r-help <r-help using r-project.org>
Subject: [R] Equal Standard Error bar

Dear List,

I have a dataset of high variability. I conducted epoch analysis and attempted to plot the standard error bar alongside.

I am, however, surprised that the error bars are of equal length. I do not think that the variability in the data is captured, except there is a kind of averaging that smooths out the differences in daily variations. Should that be the case, I don't know how and as such need your assistance to explain what is going on.

The plot is attached. 71 events are represented in the plot.

The code I use to generate the plot is:
oodf<-data.frame(A,B)
library(plotrix)
std.error<-function(x) return(sd(x)/(sum(!is.na(x))))
oomean<-as.vector(by(oodf$B,oodf$A,mean))
oose<-as.vector(by(oodf$B,oodf$A,std.error))
plot(-5:10,oomean,type="b",ylim=c(145000,162000),
 xlab="days (epoch is the day of Fd)",ylab="strikes/day",main="Superposed
Epoch of all the Events")
dispersion(-5:10,oomean,oose).

The sample data is:
-5 64833
-4 95864
-3 82322
-2 95591
-1 69378
0 74281
1 103261
2 92473
3 84344
4 127415
5 123826
6 100029
7 76205
8 105162
9 119533
10 106490
-5 82322
-4 95591
-3 69378
-2 74281
-1 103261
0 92473
1 84344
2 127415
3 123826
4 100029
5 76205
6 105162
7 119533
8 106490
9 114771
10 55593
-5 85694
-4 65205
-3 80995
-2 51723
-1 62310
0 53401
1 65677
2 76094
3 64035
4 68290
5 73306
6 82176
7 75566
8 89762
9 88063
10 94395
-5 80651
-4 81291
-3 63702
-2 70297
-1 64117
0 71219
1 57354
2 62111
3 42252
4 35454
5 33469
6 38899
7 64981
8 85694
9 79452
10 85216
-5 71219
-4 57354
-3 62111
-2 42252
-1 35454
0 33469
1 38899
2 64981
3 85694
4 79452
5 85216
6 81721
7 91231
8 107074
9 108103
10 75768


You kind help will be greatly appreciated.

Many thanks

Ogbos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.png
Type: image/png
Size: 7334 bytes
Desc: plot.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180904/8f32584f/attachment-0002.png>


More information about the R-help mailing list