Generates a Data Frame from a repeatedTrain Object After Time Binning
data.frame object out of a
repeatedTrain object after time binning in order to study
trials stationarity with a
a numeric. A single number is interpreted has the number of bins; a vector is interpreted as the position of the "breaks" between bins.
The bins are placed between the
floor of the smallest
spike time and the
ceiling of the largest one when
breaks is a scalar. After time binning the number of spikes of
each trial falling in each bin is counted (in the same way as the
counts component of a
psth list is
obtained). This matrix of count is then formatted as a data frame.
data.frame with the following variables:
a count (number of spikes in a given bin at a given trial).
the bin index (a
the trial index (a
the count divided by the length of the corresponding bin.
the time of the midpoints of the bins.
glm of the poisson family is used for subsequent
analysis the important implicit hypothesis of an inhomogenous Poisson
train is of course made.
Christophe Pouzat firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
## 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")
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.