mkREdf: Evaluates RateEvolutions for spikeTrain Lists and Returns...

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

View source: R/rateEvolution.R

Description

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.

Usage

1
2
3
4
mkREdf(x, longitudinal, across, bw,
       kernel=c("gaussian", "epanechnikov", "rectangular",
                "triangular", "biweight", "cosine", "optcosine"),
       n=512, from, to, na.rm=FALSE, minusMean=FALSE)

Arguments

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?

Details

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.

Value

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.

Note

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.

Author(s)

Christophe Pouzat christophe.pouzat@gmail.com

See Also

as.spikeTrain, as.repeatedTrain, data.frame, factor, rateEvolution,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
## 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)

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