poisson.tests: Poisson Tests for Whole Trial Spike Counts

Description Usage Arguments Value Examples

View source: R/poisson_analysis.R

Description

Carries out various Poisson related tests for double-stimuli spike count distribution.

Usage

1
2
3
4
5
 
poisson.tests(xA, xB, xAB, labels = c("A", "B", "AB"), remove.zeros = FALSE,
              gamma.pars = c(0.5, 2e-10), beta.pars = c(0.5, 0.5),
              nMC = 1000, plot = FALSE, add.poisson.fits = FALSE, 
              method.screen = c('variance', 'bincount'), ...)

Arguments

xA

an array of whole-trial spike counts under stimulus 1

xB

an array of whole-trial spike counts under stimulus 2

xAB

an array of whole-trial spike counts when both stimuli are present together

labels

labels for stimlus conditions

remove.zeros

whether to remove trials with zero spike counts

gamma.pars

shape and rate parameters of the gamma prior on Poisson mean

beta.pars

shape parameters of the beta prior for the mixture/intermediate parameter

nMC

number of Monte Carlo samples to be used in numerical approximations.

plot

logical indicating if a visualization plot should be made

add.poisson.fits

logical indicating if a fitted Poisson pmfs will be overlaid in the visualization. Ignored when plot=FALSE.

method.screen

a character string, default is 'variance' which uses the Poisson variance test to assess whether a Poisson distribution fits a sample of counts. Alternative choice is 'bincount' which uses an binned histogram based nonparametric chi-square goodness of fit test

...

additional commands to be passed on to grid.arrange() for plotting. For example, adding 'top="PLOT TITLE"' will add a title at the top of the combined plot. See grid.arrange for more details.

Value

Returns a list with the following items:

separation.logBF

the (log) Bayes factor for testing that that two single stimulus distributions are different

post.prob

posterior probabilities of the four hypotheses (Mixture, Intermediate, Outside, Single) under equal prior probabilities

pois.pvalue

minimum of the two p-values checking for Poisson-ness of each single stimulus distribution

sample.sizes

three trial counts for A, B and AB conditions

Examples

1
2
3
4
5
6
nA <- 20; nB <- 15; nAB <- 25
muA <- 25; muB <- 40
Acounts <- rpois(nA, muA)
Bcounts <- rpois(nB, muB)
ABcounts <- rpois(nAB, sample(c(muA, muB), nAB, replace = TRUE))
poisson.tests(Acounts, Bcounts, ABcounts, nMC=200, plot=FALSE)

neuromplex documentation built on April 22, 2021, 5:11 p.m.