
find_difference(mean, se, xVals = NULL, f = 1, as.vector = FALSE)
xVals
is provided, the regions are returned in terms of x-
values, otherwise as indices.se
with, to convert the se
into confidence intervals. Use 1.96 for 95% CI and 2.58 for 99%CI.start
) and end points of each region (end
). The logical
xVals
indicates whether the returned values are on the x-scale
(TRUE) or indices (FALSE).addInterval
;
alphaPalette
; alpha
;
color_contour
; dotplot_error
;
emptyPlot
; errorBars
;
fadeRug
; fill_area
;
getCoords
; getFigCoords
;
gradientLegend
; horiz_error
;
plot_error
data(simdat)
# Use aggregate to calculate mean and standard deviation per timestamp:
avg <- aggregate(simdat$Y, by=list(Time=simdat$Time),
function(x){c(mean=mean(x), sd=sd(x))})
head(avg)
# Note that column x has two values in each row:
head(avg$x)
head(avg$x[,1])
# Plot line and standard deviation:
emptyPlot(range(avg$Time), c(-20,20), h0=0)
plot_error(avg$Time, avg$x[,'mean'], avg$x[,'sd'],
shade=TRUE, lty=3, lwd=3)
# Show difference with 0:
x <- find_difference(avg$x[,'mean'], avg$x[,'sd'], xVals=avg$Time)
# Add arrows:
abline(v=c(x$start, x$end), lty=3, col='red')
arrows(x0=x$start, x1=x$end, y0=-5, y1=-5, code=3, length=.1, col='red')
Run the code above in your browser using DataLab