Learn R Programming

STAR (version 0.3-7)

gamlockedTrain: Function to Smooth a lockedTrain Object and Related Methods: The Penalized Regression Spline Approach

Description

Smooths a lockedTrain object using a gam model with the Poisson family after binning the object.

Usage

gamlockedTrain(lockedTrain, bw = 0.001, bs = "cr", k = 100, ...) "print"(x, ...) "summary"(object, ...) "plot"(x, xlab, ylab, main, xlim, ylim, col, lwd, ...)

Arguments

lockedTrain
a lockedTrain object.
bw
the bin width (in s) used to generate the observations on which the gam fit will be performed. See details below.
bs
the type of splines used. See s.
k
the dimension of the basis used to represent the smooth psth. See s.
x
an gamlockedTrain object.
object
an gamlockedTrain object.
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.
...
additional arguments passed to gam in gamlockedTrain. Not used in print.gamlockedTrain and summary.gamlockedTrain. Passed to plot in plot.gamlockedTrain.

Value

A list of class gamlockedTrain is returned by gamlockedTrain. This list has the following components:
gamFit
the gamObject generated.
Time
the vector of bin centers.
nRef
the number of spikes in the reference train. See hist.lockedTrain.
testFreq
the mean frequency of the test neuron. See hist.lockedTrain.
bwV
the vector of bin widths used.
CCH
a logical which is TRUE if a cross-intensity was estimated and FALSE in the case of an auto-intensity.
call
the matched call.
print.gamlockedTrain returns the result of print.gam applied to the component gamFit of its argument.summary.gamlockedTrain returns the result of summary.gam applied to the component gamFit of its argument.

Details

gamlockedTrain essentially generates a smooth version of the histogram obtained by hist.lockedTrain. The Idea is to build the histogram first with a "too" small bin width before fitting a regression spline to it with a Poisson distribution of the observed counts.

References

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

See Also

lockedTrain, plot.lockedTrain, gam

Examples

Run this code
## Not run: 
# ## load e070528spont data set
# data(e070528spont)
# ## create a lockedTrain object with neuron 1 as reference
# ## and neuron 3 as test up to lags of +/- 250 ms
# lt1.3 <- lockedTrain(e070528spont[[1]],e070528spont[[3]],laglim=c(-1,1)*0.25)
# ## look at the cross raster plot
# lt1.3
# ## build a histogram of it using a 10 ms bin width
# hist(lt1.3,bw=0.01)
# ## do it the smooth way
# slt1.3 <- gamlockedTrain(lt1.3)
# plot(slt1.3)
# ## do some check on the gam fit
# summary(slt1.3)
# gam.check(gamObj(slt1.3))
# ## End(Not run)

Run the code above in your browser using DataLab