gampsth {STAR} | R Documentation |
Function gampsth
computes a smooth psth, while method
print.gampsth
prints and summary.gampsth
summarises the
gamObject
contained in the returned gampsth
object and
plot.gampsth
plots it.
gampsth(repeatedTrain, binSize = 0.025, k = 100, bs = "tp", plot = TRUE,...) ## S3 method for class 'gampsth': print(x, ...) ## S3 method for class 'gampsth': summary(object, ...) ## S3 method for class 'gampsth': plot(x, stimTimeCourse = NULL, colStim = "grey80", colCI = NULL, xlab, ylab, main, xlim, ylim, lwd = 2, col = 1, ...)
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 gampsth object. |
x |
a gampsth 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 gampsth , if plot is set to TRUE
then the ... are passed to plot.gampsth . In
plot.gampsth they are passed to plot which is
called internally. They are not used otherwise. |
For gampsth
, 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 gampsth
, a list of
class gampsth
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.gampsth
with a gampsth
object argument.
print.gampsth
returns the result of print.gam
applied to the gamObject
generated by gampsth
and stored in the environment
of both lambdaFct
and LambdaFct
.
summary.gampsth
returns the result of summary.gam
applied to the gamObject
generated by gampsth
and stored in the environment
of both lambdaFct
and LambdaFct
.
Most of the components of the list returned by gampsth
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
,
## Get the e070528citronellal data set into workspace data(e070528citronellal) ## Compute gampsth without a plot for neuron 1 ## using a cubic regression spline n1CitrGAMPSTH <- gampsth(e070528citronellal[[1]],plot=FALSE,bs="cr") ## plot the result plot(n1CitrGAMPSTH,stim=c(6.14,6.64),colCI=2) ## get a summary of the gam fit summary(n1CitrGAMPSTH) ## perhaps get a more complete check wit gam.check n1CitrGAMPSTHgo <- gamObj(n1CitrGAMPSTH) gam.check(n1CitrGAMPSTHgo) ## It does not look too bad ## Now take a look at the observation on which the gam ## was actually performed plot(n1CitrGAMPSTH$mids,n1CitrGAMPSTH$counts,type="l") ## put dots at the positions of the knots X <- n1CitrGAMPSTHgo$smooth[[1]][["xp"]] rug(X,col=2) ## Add the estimated smooth psth after proper scaling theBS <- diff(n1CitrGAMPSTH[["mids"]])[1] Y <- n1CitrGAMPSTH$lambdaFct(n1CitrGAMPSTH$mids)*theBS*n1CitrGAMPSTH$nbTrials lines(n1CitrGAMPSTH$mids,Y,col=4,lwd=2)