rateEvolution: Evaluates and Plots a Spike Train Firing Rate's Evolution

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/rateEvolution.R

Description

rateEvolution evaluates and plot.rateEvolution plots the firing rate evolution of a spikeTrain object. The evaluation is done by convolving the spike train with a kernel like in density estimation.

Usage

1
2
3
4
5
6
7
rateEvolution(x, bw, kernel = c("gaussian", "epanechnikov",
                                "rectangular", "triangular",
                                "biweight", "cosine", "optcosine"),
              n = 512, from, to, na.rm = FALSE, ...)
## S3 method for class 'rateEvolution'
plot(x, main = NULL, xlab = NULL, ylab = "Rate (Hz)",
                   type = "l", zero.line = TRUE, ...)

Arguments

x

a spikeTrain object or an object which can be coerced to it for rateEvolution or a rateEvolution object for plot.rateEvolution.

bw

the kernel bin width in seconds. If missing it is set to 10 times the median inter-spike interval of x.

kernel

see density.

n

see density.

from

see density.

to

see density.

na.rm

see density.

main

see plot.density.

xlab

see plot.density.

ylab

see plot.density.

type

see plot.density.

zero.line

see plot.density.

...

see density and plot.density.

Details

rateEvolution is mainly a wrapper for density which also adjusts the result of the latter such that the y component of the returned list is an instantaneous firing rate. If the length of x is smaller or equal to 1 and if from or to is (are) missing the returned object has then each of its components set to NA except data.name (see below). If the length of x is smaller or equal to 1 and if both from and to are specified a missing bw is then set to 3 times the spacing between the points of the regular grid on which the density is evaluated.

plot.rateEvolution is also a wrapper for plot.density which only adjust the default value of some arguments.

Value

rateEvolution returns a LIST of class rateEvolution which inherits from class density.

x

the n coordinates of the points where the density is estimated. See density.

y

the estimated rate (in 1/s). These will be non-negative, but can be zero.

bw

the bandwidth used.

n

the sample size after elimination of missing values.

call

the call which produced the result.

data.name

the deparsed name of the x argument.

has.na

logical, for compatibility (always FALSE).

plot.rateEvolution is called for its side effect: a plot is generated.

Author(s)

Christophe Pouzat christophe.pouzat@gmail.com

See Also

as.spikeTrain, density, plot.density, mkREdf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## load Purkinje cell data recorded in cell-attached mode
data(sPK)
## coerce sPK to a spikeTrain object
sPK <- lapply(sPK, as.spikeTrain)
## get the rate evolution in ctl condition
sPKreCTL <- rateEvolution(sPK[["ctl"]])
## plot the result
plot(sPKreCTL)
## check the bin width which was actually used
sPKreCTL$bw
## look at the effect of a 10 times larger bw
plot(rateEvolution(sPK[["ctl"]],bw=10*sPKreCTL$bw))
## look at the effect of a 10 times smaller one
plot(rateEvolution(sPK[["ctl"]],bw=sPKreCTL$bw/10))
## get the rate evolution in bicuculline conditions
sPKreBICU <- rateEvolution(sPK[["bicu"]])
## plot results
plot(sPKreBICU,col=2)
## add the ctl rate evolution
lines(sPKreCTL)

Example output

Loading required package: survival
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-28. For overview type 'help("mgcv-package")'.
Loading required package: R2HTML
Loading required package: gss
Loading required package: codetools
[1] 1.304

STAR documentation built on May 2, 2019, 11:44 a.m.