Description Usage Arguments Details Value Note Author(s) References See Also Examples
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.
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, ...)
|
repeatedTrain |
a |
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 |
bs |
the type of splines used. See |
plot |
corresponding argument of |
object |
a |
x |
a |
stimTimeCourse |
|
colStim |
the background color used for the stimulus. |
colCI |
if not |
xlim |
a numeric (default value supplied). See
|
ylim |
a numeric (default value supplied). See |
xlab |
a character (default value supplied). See |
ylab |
a character (default value supplied). See |
main |
a character (default value supplied). See |
lwd |
line width used to plot the estimated density. See |
col |
color used to plot the estimated density. See |
... |
in |
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).
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 |
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 |
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 |
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. |
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
.
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
.
Christophe Pouzat christophe.pouzat@gmail.com
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.
psth
,
plot.psth
,
gam
,
print.gam
,
summary.gam
,
gam.check
,
reportHTML.repeatedTrain
,
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.