R: Related Functions and Methods for Joint-PSTHs and Joint...
jpsth
R Documentation
Related Functions and Methods for Joint-PSTHs and Joint Scatter Diagrams
Description
Some mainly graphical tools to probe interactions between 2 neurons
recorded in the presence of a repeated stimulation.
Usage
jsd(xRT, yRT, acquisitionWindow, xlab, ylab,
main, pch = ".", ...)
jpsth(xRT, yRT, xBreaks, yBreaks,
acquisitionWindow, nbEvtPerBin = 50)
## S3 method for class 'jpsth'
contour(x, xlab, ylab, main, ...)
## S3 method for class 'jpsth'
image(x, xlab, ylab, main, ...)
## S3 method for class 'jpsth'
persp(x, xlab, ylab, main, ...)
jpsth2df(object)
Arguments
xRT
a repeatedTrain object whose spike times will
appear on the abscissa of the plots.
yRT
a repeatedTrain object whose spike times will
appear on the ordinate of the plots. It must have the same length as xRT.
x, object
jpsth objects.
xBreaks, yBreaks
A single number (the bin width) or a vector defining
bins boundaries on the X and Y axis. If missing a default is provided.
acquisitionWindow
a 2 elements vector specifying the begining
and the end of the acquisition. If missing values are obtained using
the floor of the smallest spike time and the
ceiling of the largest one.
nbEvtPerBin
If both xBreaks and xBreaks are
missing a bin width, bw, is computed such that the expected
value of the count per cell (2 dimensional bin) would be
nbEvtPerBin assuming a stationary Poisson discharge for both
neurons.
xlab
a character (default value supplied). See plot.
ylab
a character (default value supplied). See plot.
main
a character (default value supplied). See plot.
pch
the type of "points" displayed by jsd. See plot.
...
additional arguments passed to plot by
jsd and to respective generic methods by
contour.jpsth, image.jpsth and persp.jpsth.
Details
The joint scatter diagram was introduced by Gerstein and Perkel
(1972). The joint peristimulus time histogram is a binned version of
it (Aertsen et al, 1989). jpsth2df allows the reformating of a jpsth object in
order to compute a smooth version of it with
gssanova, gssanova0 or gam.
Value
jsd is used for its side effect, a plot is generated and
nothing is returned.
jpsth2df returns a data.frame with the following
variables: Count, the counts per cell; X, the position
of the cell on the X axis; Y, the position of the cell on the Y
axis;
and attributes: xBreaks, yBreaks, xTotal,
yTotal, nbTrials, acquisitionWindow corresponding
to the components of its argument with the same name and
originalCall corresponding to component call.
jpsth returns a list of class jpsth with the following
components:
counts
a matrix storing the counts per cell.
density
a matrix storing the density in each cell.
xMids
a vector containing the X positions of the cells.
yMids
a vector containing the Y positions of the cells.
xBreaks
a vector containing the bin boundaries of the cells
along the X axis.
yBreaks
a vector containing the bin boundaries of the cells
along the X axis.
xTotal
the total number of spikes of the "X" neuron.
yTotal
the total number of spikes of the "Y" neuron.
xFreq
the mean freqency of the "X" neuron.
yFreq
the mean freqency of the "Y" neuron.
nbTrials
the number of trials of xRT (and yRT).
acquisitionWindow
the boundaries of the acquisition window.
call
the matched call.
Note
I use "joint scatter diagram" for what Gerstein and Perkel (1972) more
properly call a "joint peristimulus time scatter diagram".
Aertsen, A. M., Gerstein, G. L., Habib, M. K., Palm, G. (1989)
Dynamics of neuronal firing correlation: modulation of "effective
connectivity". J Neurophysiol61:
900–917. http://jn.physiology.org/cgi/content/abstract/61/5/900
## load e070528citronellal data
data(e070528citronellal)
## plot a jsd with neuron 1 on X and neuron 2 on Y
jsd(e070528citronellal[[1]],e070528citronellal[[2]])
## now make the jpsth
j1.2 <- jpsth(e070528citronellal[[1]],e070528citronellal[[2]])
## make a contour plot
contour(j1.2)
## make an image plot
image(j1.2)
## make a persp plot
persp(j1.2)
## Not run:
## fit a gss model with interactions
## use a larger bin width for the jpsth
j1.2 <- jpsth(e070528citronellal[[1]],e070528citronellal[[2]],0.2,0.2)
## get a data frame
j1.2DF <- jpsth2df(j1.2)
## To save computation time start analyzing
## just before the stimulation time
j1.2DF <- j1.2DF[j1.2DF$X > 6 & j1.2DF$Y>6,]
gf <- gssanova(Count ~ X*Y, family="poisson", data=j1.2DF,seed=20061001)
## Use the project function of gss to check the significance
## of the interaction term
project(gf2,inc=c("X","Y"))
## End(Not run)
## Not run:
## fit a gam model assuming no interaction
## get a data frame
j1.2DF <- jpsth2df(j1.2)
fitNoI <- gam(Count ~ s(X,k=100,bs="cr") + s(Y,k=100,bs="cr"),data=j1.2DF,family=poisson())
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(STAR)
Loading required package: survival
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
Loading required package: R2HTML
Loading required package: gss
Loading required package: codetools
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/STAR/jpsth.Rd_%03d_medium.png", width=480, height=480)
> ### Name: jpsth
> ### Title: Related Functions and Methods for Joint-PSTHs and Joint Scatter
> ### Diagrams
> ### Aliases: jpsth jsd contour.jpsth image.jpsth persp.jpsth jpsth2df
> ### Keywords: models
>
> ### ** Examples
>
> ## load e070528citronellal data
> data(e070528citronellal)
> ## plot a jsd with neuron 1 on X and neuron 2 on Y
> jsd(e070528citronellal[[1]],e070528citronellal[[2]])
> ## now make the jpsth
> j1.2 <- jpsth(e070528citronellal[[1]],e070528citronellal[[2]])
> ## make a contour plot
> contour(j1.2)
> ## make an image plot
> image(j1.2)
> ## make a persp plot
> persp(j1.2)
> ## Not run:
> ##D ## fit a gss model with interactions
> ##D ## use a larger bin width for the jpsth
> ##D j1.2 <- jpsth(e070528citronellal[[1]],e070528citronellal[[2]],0.2,0.2)
> ##D ## get a data frame
> ##D j1.2DF <- jpsth2df(j1.2)
> ##D ## To save computation time start analyzing
> ##D ## just before the stimulation time
> ##D j1.2DF <- j1.2DF[j1.2DF$X > 6 & j1.2DF$Y>6,]
> ##D gf <- gssanova(Count ~ X*Y, family="poisson", data=j1.2DF,seed=20061001)
> ##D ## Use the project function of gss to check the significance
> ##D ## of the interaction term
> ##D project(gf2,inc=c("X","Y"))
> ## End(Not run)
> ## Not run:
> ##D ## fit a gam model assuming no interaction
> ##D ## get a data frame
> ##D j1.2DF <- jpsth2df(j1.2)
> ##D fitNoI <- gam(Count ~ s(X,k=100,bs="cr") + s(Y,k=100,bs="cr"),data=j1.2DF,family=poisson())
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>