## Not run:
# ## Load the Vanillin responses of the first
# ## cockroach data set
# data(CAL1V)
# ## convert them into repeatedTrain objects
# ## The stimulus command is on between 4.49 s and 4.99s
# CAL1V <- lapply(CAL1V,as.repeatedTrain)
# ## Generate raster plot for neuron 1
# raster(CAL1V[["neuron 1"]],c(4.49,4.99))
# ## make a smooth PSTH of these data
# psth(CAL1V[["neuron 1"]],stimTimeCourse=c(4.49,4.99),breaks=c(bw=0.5,step=0.05),colCI=2,xlim=c(0,10))
# ## add a grid to the plot
# grid()
# ## The response starts after 4.5 s and is mostly over after 6 s: create
# ## breaks accordingly
# myBreaks <- c(0,2.25,4.5,seq(4.75,6.25,0.25),seq(6.5,11,0.5))
# ## get a count data frame
# CAL1Vn1DF <- df4counts(CAL1V[["neuron 1"]],myBreaks)
# ## use a box plot to look at the result
# boxplot(Rate ~ Time, data=CAL1Vn1DF)
# ## watch out here the time scale is distorted because of our
# ## choice of unequal bins
# ## Fit a glm of the Poisson family taking both Bin and Trial effects
# CAL1Vn1DFglm <- glm(Count ~ Bin + Trial,family=poisson,data=CAL1Vn1DF)
# ## use an anova to see that both the Bin effect and the trial effect are
# ## highly significant
# anova(CAL1Vn1DFglm, test="Chisq")
# ## End(Not run)
Run the code above in your browser using DataLab