## Not run:
# ## Let us consider neuron 1 of the CAL2S data set
# data(CAL2S)
# CAL2S <- lapply(CAL2S,as.spikeTrain)
# CAL2S[["neuron 1"]]
# renewalTestPlot(CAL2S[["neuron 1"]])
# summary(CAL2S[["neuron 1"]])
# ## Make a data frame with a 4 ms time resolution
# cal2Sdf <- mkGLMdf(CAL2S,0.004,0,60)
# ## keep the part relative to neuron 1
# n1.cal2sDF <- cal2Sdf[cal2Sdf$neuron=="1",]
# ## remove unnecessary data
# rm(cal2Sdf)
# ## Extract the elapsed time since the second to last and
# ## third to last for neuron 1. Normalise the result.
# n1.cal2sDF[c("rlN.1","rsN.1","rtN.1")] <- brt4df(n1.cal2sDF,"lN.1",2,c("rlN.1","rsN.1","rtN.1"))
# ## load mgcv library
# library(mgcv)
# ## fit a model with a tensorial product involving the last
# ## three spikes and using a cubic spline basis for the last two
# n1S.fitA <- gam(event ~ te(rlN.1,rsN.1,bs="cr") + rtN.1,data=n1.cal2sDF,family=binomial(link="logit"))
# summary(n1S.fitA)
# ## plot the result in 2 different ways
# plot(n1S.fitA)
# vis.gam(n1S.fitA,phi=20,theta=45)
#
# ## End(Not run)
Run the code above in your browser using DataLab