spsth: Smooth Peri Stimulus Time Histogram Related Functions and...

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

Description

Function spsth computes a smooth psth, while method print.spsth prints and summary.spsth summarises the gamObject contained in the returned spsth object and plot.spsth plots it.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
spsth(repeatedTrain, binSize = 0.025, k = 100,
      bs = "tp", plot = TRUE,...)
## S3 method for class 'spsth'
print(x, ...)
## S3 method for class 'spsth'
summary(object, ...)
## S3 method for class 'spsth'
plot(x, stimTimeCourse = NULL, colStim = "grey80",
           colCI = NULL, xlab, ylab, main, xlim, ylim,
           lwd = 2, col = 1, ...)

Arguments

repeatedTrain

a repeatedTrain object or a list which can be coerced to such an object.

binSize

the bin size (in s) used to generate the observations on which the gam fit will be performed. See details below.

k

the dimension of the basis used to represent the smooth psth. See s.

bs

the type of splines used. See s.

plot

corresponding argument of hist. Should a plot be generated or not?

object

a spsth object.

x

a spsth object.

stimTimeCourse

NULL (default) or a two elements vector specifying the time boundaries (in s) of a stimulus presentation.

colStim

the background color used for the stimulus.

colCI

if not NULL (default) a confidence band is plotted with the specified color; two dashed lines are plotted otherwise.

xlim

a numeric (default value supplied). See plot.

ylim

a numeric (default value supplied). See plot.

xlab

a character (default value supplied). See plot.

ylab

a character (default value supplied). See plot.

main

a character (default value supplied). See plot.

lwd

line width used to plot the estimated density. See plot.

col

color used to plot the estimated density. See plot.

...

in spsth, if plot is set to TRUE then the ... are passed to plot.spsth. In plot.spsth they are passed to plot which is called internally. They are not used otherwise.

Details

For spsth, the raw data contained in repeatedTrain are pre-processed with hist using a bin size given by argument binSize. This binSize should be small "enough". That is, the rate of the aggregated train created by collapsing the spike times of the different trials onto a single "pseudo" spike train, should not change too much on the scale of binSize (see Ventura et al (2002) Sec. 4.2 p8 for more details).

Value

When plot is set to FALSE in spsth, a list of class spsth is returned and no plot is generated. This list has the following components:

freq

a vector containing the instantaneous firing rate in the middle of the "thin" bins used for preprocessing.

ciUp

a vector with the upper limit of a pointwise 95% confidence interval. Check predict.gam for details.

ciLow

a vector with the lower limit of a pointwise 95% confidence interval.

breaks

a vector with 2 elements the ealiest and the latest spike in repeatedTrain.

mids

a numeric vector with the mid points of the bins.

counts

a vector with the actual number of spikes in each bin.

nbTrials

the number of trials in repeatedTrain.

lambdaFct

a function of a single time argument returning the estimated intensity (or instantaneous rate) at its argument.

LambdaFct

a function of a single time argument returning the integrale of estimated intensity (or instantaneous rate) at its argument. That is, the integrated intensity. integrate is used by this function.

call

the matched call.

When plot is set to TRUE nothing is returned and a plot is generated as a side effect. Of course the same occurs upon calling plot.spsth with a spsth object argument.

print.spsth returns the result of print.gam applied to the gamObject generated by spsth and stored in the environment of both lambdaFct and LambdaFct.

summary.spsth returns the result of summary.gam applied to the gamObject generated by spsth and stored in the environment of both lambdaFct and LambdaFct.

Note

Most of the components of the list returned by spsth are not of direct interest for the user but they are used by, for instance, reportHTML.repeatedTrain.

Author(s)

Christophe Pouzat christophe.pouzat@gmail.com

References

Ventura, V., Carta, R., Kass, R. E., Gettner, S. N. and Olson, C. R. (2002) Statistical analysis of temporal evolution in single-neuron firing rates. Biostatistics 3: 1–20.

Kass, R. E., Ventura, V. and Cai, C. (2003) Statistical smoothing of neuronal data. Network: Computation in Neural Systems 14: 5–15.

Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press.

See Also

psth, plot.psth, gam, print.gam, summary.gam, gam.check, reportHTML.repeatedTrain,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Get the e070528citronellal data set into workspace
data(e070528citronellal)
## Compute spsth without a plot for neuron 1
## using a cubic regression spline
n1CitrSPSTH <- spsth(e070528citronellal[[1]],plot=FALSE,bs="cr")
## plot the result
plot(n1CitrSPSTH,stim=c(6.14,6.64),colCI=2)
## get a summary of the gam fit
summary(n1CitrSPSTH)
## perhaps get a more complete check wit gam.check
n1CitrSPSTHgo <- gamObj(n1CitrSPSTH)
gam.check(n1CitrSPSTHgo)
## It does not look too bad
## Now take a look at the observation on which the gam
## was actually performed
plot(n1CitrSPSTH$mids,n1CitrSPSTH$counts,type="l")
## put dots at the positions of the knots
X <- n1CitrSPSTHgo$smooth[[1]][["xp"]]
rug(X,col=2)
## Add the estimated smooth psth after proper scaling
theBS <- diff(n1CitrSPSTH[["mids"]])[1]
Y <- n1CitrSPSTH$lambdaFct(n1CitrSPSTH$mids)*theBS*n1CitrSPSTH$nbTrials
lines(n1CitrSPSTH$mids,Y,col=4,lwd=2)

STAR documentation built on May 2, 2019, 4:53 p.m.