rethomics / zeitgebr

Circadian rhythm analysis and visualisation in R
11 stars 7 forks source link

use pvalues instead of significance levels #6

Closed qgeissmann closed 6 years ago

qgeissmann commented 6 years ago

Most tools we use for periodogram can associate each power to a p-value rather that expressing independently a significance threshold. It would be advantageous to return p-values instead of a mere threshold for multiple reasons:

  1. We can change alpha post-hock
  2. We can find peaks according to probabilities
  3. We can make weighted averages of spectra base on probability (almost in a Bayesian manner)
  4. It is compatible with setting a heard threshold
qgeissmann commented 6 years ago

So now we should be able to plot the p-values itself. e.g. as a point size:

data(dams_sample)
dd <- dams_sample[id=="2017-01-16 08:00:00|dams_sample.txt|01"]

per <- periodogram(activity, dd, FUN=ls_periodogram)
ggetho::ggperio(per)  +
  geom_line() +
  geom_point(aes(size= -log10(p_value))) +
  geom_line(aes(y=signif_threshold), colour="red")

image

The red line is the significance threshold that we still have (the only info that was present before)

qgeissmann commented 6 years ago
per <- periodogram(activity, dd, FUN=chi_sq_periodogram)

image

qgeissmann commented 6 years ago
per <- periodogram(activity, dd, FUN=ac_periodogram)

image