# varianceTime: Variance-Time Analysis for Spike Trains In STAR: Spike Train Analysis with R

## Description

Performs Variance-Time Analysis for a Spike Train (or any univariate time series) assuming a Poisson Process with the same Rate as the Spike Train.

## Usage

 ```1 2 3 4 5``` ```varianceTime(spikeTrain, CI = c(0.95, 0.99), windowSizes) is.varianceTime(obj) ## S3 method for class 'varianceTime' plot(x, style = c("default", "Ogata"), unit = "s", xlab, ylab, main, sub, xlim, ylim, ...) ```

## Arguments

 `spikeTrain` a `spikeTrain` object or a vector which can be coerced to such an object. `obj` a object to test against a `varianceTime` object. `x` a `varianceTime` object. `CI` a numeric vector with at most two elements. The coverage probability of the confidence intervals. `windowSizes` a numeric increasing vector of positive numbers. The window sizes used to split the spike train. `style` a character. The style of the plot, `"default"` or `"Ogata"`. `unit` a character. The unit in which the spike times are expressed. `xlab` a character. The x label. `ylab` a character. The y label. `main` a character. The title. `sub` a character. The subtitle. `xlim` a numeric. See `plot`. `ylim` a numeric. See `plot`. `...` see `plot`.

## Details

See Fig. 5 of Ogata (1988) for details. The confidence intervals are obtained with a Normal approximation of the Poisson distribution.

## Value

`varianceTime` returns a list of class `varianceTime` with the following elements:

 `s2` numeric vector of empirical variance. `sigma2` numeric vector of expected variance under the Poisson hypothesis. `ciUp` a numeric vector or a 2 rows matrix with the upper limits of the confidence interval(s). `ciLow` a numeric vector or a 2 rows matrix with the lower limits of the confidence interval(s). `windowSizes` numeric vector of window sizes actually used. `CI` a numeric vector, the coverage probabilities of the confidence intervals. `call` the matched call

`plot.varianceTime` is used for its side effect: a graph is produced.

`is.varianceTime` returns `TRUE` if its argument is a `varianceTime` object and `FALSE` otherwise.

## Author(s)

Christophe Pouzat [email protected] and Chong Gu [email protected] for a correction on the sampling variance of the variance of a normal distribution.

## References

Ogata, Yosihiko (1988) Statistical Models for Earthquake Occurrences and Residual Analysis for Point Processes. Journal of the American Statistical Association 83: 9-27.

`acf.spikeTrain`, `renewalTestPlot`
 ```1 2 3 4 5``` ```## Replicate (almost) Fig. 5 of Ogata 1988 data(ShallowShocks) vtShallow <- varianceTime(ShallowShocks\$Date,,c(5,10,20,40,60,80,seq(100,500,by = 25))*10) is.varianceTime(vtShallow) plot(vtShallow, style="Ogata") ```