isi: Get Lagged Inter Spike Intervals (ISIs) From Data Frames...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/gssmisc.R

Description

A utility function to create a vector containing the ith preceding inter spike interval (isi) at a given time.

Usage

1
isi(dataFrame, lag = 1)

Arguments

dataFrame

a data.frame typically generated by mkGLMdf. Should at least contain an event and a time variable.

lag

a strictly positive integer. Set to 1 if the previous isi is required, to 2 is the isi preceding the last one is required, etc...

Details

Look at the (short) source file for details.

Value

A numeric vector with the value of the lagth isi preceding the time of the corresponding bin center.

Note

Before plugging the result into gssanova, do not forget to remove the NA elements (see the example).

Author(s)

Christophe Pouzat [email protected]

See Also

mkGLMdf, gssanova, %tt%

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
## load e060517spont data set
data(e060517spont)
## make a data frame using a 2 ms bin width
e060517spontDF <- mkGLMdf(e060517spont,0.002,0,60)
## Keep data relevant to neuron 1
e060517spontDFn1 <- e060517spontDF[e060517spontDF$neuron == "1",]
## get the isi at lag 1 and 2
e060517spontDFn1$isi1 <- isi(e060517spontDFn1,lag=1)
e060517spontDFn1$isi2 <- isi(e060517spontDFn1,lag=2)
## keep only defined elements
e060517spontDFn1 <- e060517spontDFn1[!is.na(e060517spontDFn1$isi2),]
## split the data set into an "early" and a "late" part
e060517spontDFn1e <- e060517spontDFn1[e060517spontDFn1$time <= 30,]
e060517spontDFn1l <- e060517spontDFn1[e060517spontDFn1$time > 30,]
## Fit the late part
e060517spontDFn1lGF <- gssanova(event ~ lN.1*isi1+isi2, data=e060517spontDFn1l, family="binomial", seed=20061001)
## Time transform the early part and perform goodness of fit tests
e060517spont.n1e.tt <- e060517spontDFn1lGF %tt% e060517spontDFn1e
e060517spont.n1e.tt
summary(e060517spont.n1e.tt)
plot(summary(e060517spont.n1e.tt))

## End(Not run)

STAR documentation built on May 30, 2017, 3:06 a.m.