| gsspsth {STAR} | R Documentation |
Function gsspsth and gsspsth0 compute a smooth psth, while method
print.gsspsth and print.gsspsth0 print and
summary.gsspsth or summary.gsspsth0 summarize the
gssanova / gssanova0 objects contained in the returned gsspsth or
gsspsth0 objects,
plot.gsspsth or plot.gsspsth0 plot them and
simulate.gsspsth or simulate.gsspsth0 simulate data from
fitted objects.
gsspsth(repeatedTrain, binSize = 0.025, plot = FALSE, ...)
gsspsth0(repeatedTrain, binSize = 0.025, plot = FALSE, ...)
## S3 method for class 'gsspsth':
print(x, ...)
## S3 method for class 'gsspsth0':
print(x, ...)
## S3 method for class 'gsspsth':
summary(object, ...)
## S3 method for class 'gsspsth0':
summary(object, ...)
## S3 method for class 'gsspsth':
plot(x, stimTimeCourse = NULL, colStim = "grey80",
colCI = NULL, xlab, ylab, main, xlim, ylim,
lwd = 2, col = 1, ...)
## S3 method for class 'gsspsth0':
plot(x, stimTimeCourse = NULL, colStim = "grey80",
colCI = NULL, xlab, ylab, main, xlim, ylim,
lwd = 2, col = 1, ...)
## S3 method for class 'gsspsth':
simulate(object, nsim = 1, seed = NULL, ...)
## S3 method for class 'gsspsth0':
simulate(object, nsim = 1, seed = NULL, ...)
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 gss fit will be performed. See details below. |
plot |
corresponding argument of hist. Should a
plot be generated or not? |
object |
a gsspsth or a gsspsth0 object. |
x |
a gsspsth or a gsspsth0 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. |
nsim |
number of repeatedTrain objects to simulate. Defaults to 1. |
seed |
see simulate. |
... |
in gsspsth, respectively gsspsth0, the
... are passed to the internally called gssanova, repectively
gssanova0. In
plot.gsspsth and plot.gsspsth0 they are passed to
plot which is
called internally. They are not used otherwise. |
gsspsth calls internally gssanova while
gsspsth0 calls gssanova0. See the respective
documentations and references therein for an explanation of the differences.
For both gsspsth and gsspsth0, 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). Argument nbasis of
gssanova called internally by gsspsth is set
to the number of bins of the histogram resulting from the
preprocessing stage.
simulate.gsspsth and simulate.gsspsth0 perform exact
simuations of inhomogenous Poisson processes whose (time dependent)
rate/intensity function is accessible through the componenent
lambdaFct of objects of class gsspsth and
gsspsth0. The inhomogenous Poisson processes are simulated with
the thinning method (Devroye, 1986, pp 253-256).
When plot is set to FALSE in gsspsth, repectively
gsspsth0, a list of
class gsspsth, respectively gsspsth0, is returned and no plot
is generated. These list have 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.gss 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.gsspsth with a gsspsth object argument or
plot.gsspsth0 with a gsspsth0.
print.gsspsth returns the result of print.ssanova
applied to the gssanova object generated by gsspsth
and stored in the environment of both lambdaFct
and LambdaFct. The same goes for print.gsspsth0.
summary.gsspsth returns the result of summary.gssanova
applied to the gssanova object generated by gsspsth
and stored in the environment of both lambdaFct
and LambdaFct. The same goes for summary.gsspsth0.
simulate.gsspsth and simulate.gsspsth0 return a
repeatedTrain object if argument nsim is set to one and
a list of such objects if it is greater than one.
Most of the components of the list returned by gsspsth and
gsspsth0 are not of
direct interest for the user but they are used by, for instance,
reportHTML.repeatedTrain.
Christophe Pouzat christophe.pouzat@gmail.com
Gu C. (2002) Smoothing Spline ANOVA Models. Springer.
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.
Devroye Luc (1986) Non-Uniform Random Variate Generation. Springer. Book available in pdf format at: http://cg.scs.carleton.ca/~luc/rnbookindex.html.
psth,
plot.psth,
gssanova,
gssanova0,
summary.gssanova,
summary.gssanova0,
reportHTML.repeatedTrain,
simulate
## Get the e070528citronellal data set into workspace data(e070528citronellal) ## Compute gsspsth without a plot for neuron 1 ## using a smmothing spline with gssanova0, and default bin size of 25 ms. n1CitrGSSPSTH0 <- gsspsth0(e070528citronellal[[1]]) ## plot the result plot(n1CitrGSSPSTH0,stim=c(6.14,6.64),colCI=2) ## get a summary of the gss fit summary(n1CitrGSSPSTH0) ## Now take a look at the observation on which the gss ## was actually performed plot(n1CitrGSSPSTH0$mids,n1CitrGSSPSTH0$counts,type="l") ## Add the estimated smooth psth after proper scaling theBS <- diff(n1CitrGSSPSTH0[["mids"]])[1] Y <- n1CitrGSSPSTH0$lambdaFct(n1CitrGSSPSTH0$mids)*theBS*n1CitrGSSPSTH0$nbTrials lines(n1CitrGSSPSTH0$mids,Y,col=4,lwd=2) ## Not run: ## check the (absence of) effect of the pre-binning by using a smaller ## and larger one, say 10 and 75 ms n1CitrGSSPSTH0_10 <- gsspsth0(e070528citronellal[[1]],binSize=0.01) n1CitrGSSPSTH0_75 <- gsspsth0(e070528citronellal[[1]],binSize=0.075) ## plot the "high resolution" smoothed-psth plot(n1CitrGSSPSTH0_10,colCI="grey50") ## add to it the estimate obtained with the "low resolution" one Y_75 <- n1CitrGSSPSTH0_75$lambdaFct(n1CitrGSSPSTH0_10$mids) lines(n1CitrGSSPSTH0_10$mids,Y_75,col=2,lwd=2) ## End(Not run) ## simulate data from the first fitted model s1 <- simulate(n1CitrGSSPSTH0) ## look at the result s1 ## Not run: ## Do the same thing with gsspsth n1CitrGSSPSTH <- gsspsth(e070528citronellal[[1]]) plot(n1CitrGSSPSTH,stim=c(6.14,6.64),colCI=2) summary(n1CitrGSSPSTH) plot(n1CitrGSSPSTH$mids,n1CitrGSSPSTH$counts,type="l") theBS <- diff(n1CitrGSSPSTH[["mids"]])[1] Y <- n1CitrGSSPSTH$lambdaFct(n1CitrGSSPSTH$mids)*theBS*n1CitrGSSPSTH$nbTrials lines(n1CitrGSSPSTH$mids,Y,col=4,lwd=2) ## check the (absence of) effect of the pre-binning by using a smaller ## and larger one, say 10 and 75 ms n1CitrGSSPSTH_10 <- gsspsth(e070528citronellal[[1]],binSize=0.01) n1CitrGSSPSTH_75 <- gsspsth(e070528citronellal[[1]],binSize=0.075) ## plot the "high resolution" smoothed-psth plot(n1CitrGSSPSTH_10,colCI="grey50") ## add to it the estimate obtained with the "low resolution" one Y_75 <- n1CitrGSSPSTH_75$lambdaFct(n1CitrGSSPSTH_10$mids) lines(n1CitrGSSPSTH_10$mids,Y_75,col=2,lwd=2) ## simulate data from the first fitted model s1 <- simulate(n1CitrGSSPSTH) ## look at the result s1 ## End(Not run)