Installation and initialization of the package

To install UnitEvents, you need to download the archive package and to install the package as a usual package. For example, using the command line, for version 0.0.1

install.packages('UnitEvents_0.0.1.tar.gz', repos=NULL, type="source")

The \(\textrm{neuro-stat}\) code is downloaded and compiled during the installation process. \(\textit{Subversion}\), \(\textit{git}\), \(\textit{CMake}\) and a C++ compiler are required. The compilation of \(\textrm{neuro-stat}\) on Mac OS should complete despite several warnings.

To initialize the package, do as usual for an R package

library('UnitEvents')

Time windows

Creation of time windows

The time windows of reference examples in papers (Albert et al. 2016) and (Tuleau-Malot et al. 2014) are defined by the \(\textit{compute_windows}\) function for Neurons 13 and 40 as follows

\(\textit{compute_time_windows}\) function is the main function to create time windows.

TW1 = compute_time_windows(0, 2.05, 0.1, 0.05)
print(TW1$len)
## [1] 40
print(TW1$A[,c(1:5,36:40)])
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,]  0.0 0.05  0.1 0.15  0.2 1.75  1.8 1.85  1.9  1.95
## [2,]  0.1 0.15  0.2 0.25  0.3 1.85  1.9 1.95  2.0  2.05

Representation of time windows

\(\textit{draw_windows}\) function allows to represent time windows.

draw_windows(TW1, yrange=c(-0.5,0), density=c(0), col='black')
Time windows for interval $[0,2]$ from *compute_time_windows* function

Time windows for interval \([0,2]\) from compute_time_windows function

MTGAUE tests

Some results are presented here for MTGAUE (Multiple Tests based on a Gaussian Approximation of the Unitary Events method with delayed coincidence count) (see (Tuleau-Malot et al. 2014)).

MTGAUE tests with neuro-stat code

Neuron 13

Result for \(\simeq\) 40 time windows

TW = compute_time_windows(0, 2.05, duration=0.1, spacing=0.05)
removefirstandlast7col <- function(v) { return(v[-c(1,(length(v)-6):length(v))])}
scaling <- 1/10000
fNeur1_13 <- system.file("extdata", "Neur1_c13.txt", package="UnitEvents")
fNeur2_13 <- system.file("extdata", "Neur2_c13.txt", package="UnitEvents")
DN13 = DNeur(list(fNeur1_13, fNeur2_13),
                listOptions=list('removeCols'=removefirstandlast7col, 'scaling'=c(scaling)))
## [1] ""
## [1] "The neuron file is /home/gscarella/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/extdata/Neur1_c13.txt"
## [1] ""
## [1] "The neuron file is /home/gscarella/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/extdata/Neur2_c13.txt"
xns = UnitEvents(delay=0.02, TW=TW, DataNeur=DN13, DName="Neur_c13")
## Figure title is
## Raster plot for Neur_c13
## type = MTGAUE, delay=0.02, level=0.05, nw=40, Rtest=all
## [1] ""
## [1] "The value of delay for coincidences (denoted by delta in MTGAUE paper) is 0.02"
## [1] "The level value in Benjamini-Hochberg procedure is 0.05"
## [1] ""
## [1] "Plotting figures ..."
## [1] ""
## [1] "WINK: Loading ~/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/neuro-stat/v3/src/wink_mam4//wink.so"
## [1] ""
## [1] "There are 40 time windows"
## [1] "Both upper and lower tests"
MTGAUE test for neuro-stat code. Neuron 13 - 40 time windows, $\delta=0.02$

MTGAUE test for neuro-stat code. Neuron 13 - 40 time windows, \(\delta=0.02\)

save(xns, file='MTGAUE-nw=40-ns.RData')

Result for \(\simeq\) 2000 time windows

TW = compute_time_windows(a=0.001, b=1.973, duration=0.1, spacing=0.001)
xns_nw2000 = UnitEvents(delay=0.02, TW=TW, DataNeur=DN13, DName="Neur_c13")
## Figure title is
## Raster plot for Neur_c13
## type = MTGAUE, delay=0.02, level=0.05, nw=1873, Rtest=all
## [1] ""
## [1] "The value of delay for coincidences (denoted by delta in MTGAUE paper) is 0.02"
## [1] "The level value in Benjamini-Hochberg procedure is 0.05"
## [1] ""
## [1] "Plotting figures ..."
## [1] ""
## [1] "WINK: Loading ~/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/neuro-stat/v3/src/wink_mam4//wink.so"
## [1] ""
## [1] "There are 1873 time windows"
## [1] "Both upper and lower tests"
MTGAUE test for neuro-stat code. Neuron 13 - $\simeq 2000$ time windows, $\delta=0.02$

MTGAUE test for neuro-stat code. Neuron 13 - \(\simeq 2000\) time windows, \(\delta=0.02\)

save(xns_nw2000, file='MTGAUE-nw=2000-ns.RData')

Neuron 40

Result for 40 time windows and upper test only

TW = compute_time_windows(0, 2.05, 0.1, 0.05)
fNeur1_40 <- system.file("extdata", "Neur1_c40.txt", package="UnitEvents")
fNeur2_40 <- system.file("extdata", "Neur2_c40.txt", package="UnitEvents")
DN40 = DNeur(list(fNeur1_40, fNeur2_40),
                listOptions=list('removeCols'=removefirstandlast7col,'scaling'=c(scaling)))
## [1] ""
## [1] "The neuron file is /home/gscarella/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/extdata/Neur1_c40.txt"
## [1] ""
## [1] "The neuron file is /home/gscarella/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/extdata/Neur2_c40.txt"
xns_nw40_up = UnitEvents(delay=0.02, TW=TW, Rtest="upper", DataNeur=DN40, DName="Neur_c40")
## Figure title is
## Raster plot for Neur_c40
## type = MTGAUE, delay=0.02, level=0.05, nw=40, Rtest=upper
## [1] ""
## [1] "The value of delay for coincidences (denoted by delta in MTGAUE paper) is 0.02"
## [1] "The level value in Benjamini-Hochberg procedure is 0.05"
## [1] ""
## [1] "Plotting figures ..."
## [1] ""
## [1] "WINK: Loading ~/R/x86_64-redhat-linux-gnu-library/3.4/UnitEvents/neuro-stat/v3/src/wink_mam4//wink.so"
## [1] ""
## [1] "There are 40 time windows"
## [1] "upper test with neuro-stat code"