rateEvolution {STAR} | R Documentation |
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.
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, ...)
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 . |
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.
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.
Christophe Pouzat christophe.pouzat@gmail.com
as.spikeTrain
,
density
,
plot.density
,
mkREdf
## 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)