mkREdf {STAR} | R Documentation |
Given a list of spikeTrain
or repeatedTrain
objects
mkREdf
evaluates the rate evolution of each train and returns a
data frame suitable for use with coplot
, xyplot
and qplot
.
mkREdf(x, longitudinal, across, bw, kernel=c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), n=512, from, to, na.rm=FALSE, minusMean=FALSE)
x |
a named list of spikeTrain or
repeatedTrain objects. |
longitudinal |
a character vector with the names of the
different "conditions" applied to each neuron like "ctl", "bicu" or
"stim. 1", "stim. 2", ..., "stim. 20". Default provided. |
across |
a character vector with the names of the
different neurons. Default provided. |
bw |
see rateEvolution . This can be a vector. |
kernel |
see rateEvolution . |
n |
see rateEvolution . |
from |
see rateEvolution . |
to |
see rateEvolution . |
na.rm |
see rateEvolution . |
minusMean |
should the mean of the rate evolution along the across "dimension" be subtracted from each individual rate evolution along this dimension? |
mkREdf
calls rateEvolution
on every
spikeTrain
in x
. If from
and to
are
missing, they are internally set to the floor
of the global
minimal spike time contained in x
and to the ceiling
of
the global maximal time.
A data frame with the following variables:
time |
The time (in s) at which the rate was evaluated. |
rate |
The rate (in 1/s). |
longitudinal |
A factor corresponding to the argument with the same name. |
across |
A factor corresponding to the argument with the same name. |
argument minusMean
is now here as an "experimental"
feature. The idea is that it could be used to detect
non-stationarities of the reponses (in a repeated stimulation context)
which would be correlated across different neurons. I'm not sure yet
if this will be useful or not.
Christophe Pouzat christophe.pouzat@gmail.com
as.spikeTrain
,
as.repeatedTrain
,
data.frame
,
factor
,
rateEvolution
,
## load Purkinje cell data recorded in cell-attached mode data(sPK) ## coerce sPK to a spikeTrain object sPK <- lapply(sPK, as.spikeTrain) ## get a rate evolution data frame sPKreDF <- mkREdf(sPK) ## display result using coplot coplot(rate ~ time | longitudinal,data=sPKreDF,panel=lines,show.given=FALSE) ## Not run: ## make it prettier with with xyplot of package lattice library(lattice) xyplot(rate ~ time | longitudinal, data=sPKreDF,panel=panel.lines) ## if ggplot2 is installed, try it out library(ggplot2) qplot(time,rate,data=sPKreDF,geom="line",colour=longitudinal) ## End(Not run) ## load Purkinje cell data recorded with the NeuroNexus probes data(mPK) mPK <- lapply(mPK, as.repeatedTrain) ## get a rate evolution data frame mPKreDF <- mkREdf(mPK) ## use coplot to display result coplot(rate ~ time | longitudinal * across,data = mPKreDF,panel=lines) ## Not run: ## make it prettier with with xyplot of package lattice library(lattice) xyplot(rate ~ time | across,data = mPKreDF,groups=longitudinal,panel=panel.lines) xyplot(rate ~ time | across * longitudinal,data = mPKreDF, panel=panel.lines) ## if ggplot2 is installed, try it out library(ggplot2) qplot(time,rate,data=mPKreDF,geom="line",colour=longitudinal,facets=across ~ .) ## End(Not run) ## another example with the CAL1V data set data(CAL1V) CAL1V <- lapply(CAL1V,as.repeatedTrain) ## generate the data frame specifying the longitudinal argument ## to end up with a clearer display CAL1VreDF <- mkREdf(CAL1V,longitudinal=paste(1:20)) coplot(rate ~ time | across * longitudinal,data=CAL1VreDF,panel=lines,show.given=FALSE) ## Not run: ## if ggplot2 is installed, try it out library(ggplot2) qplot(time,rate,data=CAL1VreDF,geom="line",facets=longitudinal ~ across) ## End(Not run) ## another example with the CAL2C data set data(CAL2C) CAL2C <- lapply(CAL2C,as.repeatedTrain) ## generate the data frame specifying the longitudinal argument ## to end up with a clearer display CAL2CreDF <- mkREdf(CAL2C,longitudinal=paste(1:20)) coplot(rate ~ time | across * longitudinal,data=CAL2CreDF,panel=lines,show.given=FALSE) ## Not run: ## if ggplot2 is installed, try it out library(ggplot2) qplot(time,rate,data=CAL2CreDF,geom="line",facets=longitudinal ~ across) ## End(Not run)