if (FALSE) {
dat <- read.bin(system.file("binfile/TESTfile.bin", package = "GENEAread")[1]
, calibrate = TRUE)
#look for the epochs that exceed a certain threshold 50% of the time
plot(apply.epoch( dat, epoch.size = 3 ,
FUN = function(t) mean(abs(svm(t) -1)>0.2)> 0.5 ), type = "l")
plot(dat[,1], svm(dat), log = "y", pch = ".")
lines(mean.epoch(dat, incl.date = TRUE), lwd = 2)
lines(mean.epoch(dat, epoch.size = 30, incl.date = TRUE), col = 2, lwd = 2)
# This should give all the same results, but by a different way
lines(apply.epoch(dat, epoch.size = 30,
FUN = function(A) mean(svm(A, FALSE)), incl.date = TRUE), col = 3)
epsize = 30
lines(apply.epoch(dat, epoch.size = epsize,
FUN = function(t) median(t[,1])),
apply.epoch(dat, epoch.size = epsize,
FUN = function(A) mean(svm(A, FALSE))), col = 4)
#note this is different
lines(apply.epoch(dat, epoch.size = epsize,
FUN = function(t) median(t[,1])),
apply.epoch(dat, epoch.size = epsize,
FUN = function(A) mean(svm(A, sqrt = TRUE)))^2,
col = 5)
#plot some statistics
par(mfrow = c(5,1), mar = c(1,4.5,1,1))
plot(sd.epoch(dat), type="l")
plot(median.epoch(dat), type= "l")
plot(mad.epoch(dat), type= "l")
plot(acf.epoch(dat), type = "l")
plot(autocor.epoch(dat), type= "l")
tmp = quantile.epoch(dat, quantiles= c(0.1, 0.25, 0.5, 0.75, 0.9)); matplot(tmp, type = "l")
}
Run the code above in your browser using DataLab