Description Usage Arguments Value Examples
View source: R/dynamic_neural_model-v6.R
Preprocess nueral spike train recording to preapre binned spike counts suitable for DAPP analysis
1 2 3 |
mplex.preprocess(spiketimes, start.time=0, end.time=1e3, bw=50,
remove.zeros=FALSE, visualize=TRUE, ...)
|
spiketimes |
a list with 3 elements giving the 3 sets of spiketimes associated with experimental conditions A, B and AB |
start.time |
starting time for the observation window. See details below |
end.time |
ending time of the observations window. See details below |
bw |
bin width (in ms) used for binning. A single bin is used when bw equals or exceeds the length of the observation period (end.time - start.time). Single bin analysis is same as total spike count analysis |
remove.zeros |
logical indicating if trials with zero spike counts should be removed from the analysis |
visualize |
logical indicating if a graphical summary should be produced to visualize the three sets of trials |
... |
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 |
Returns a list containting the following items.
Acounts |
binned spike counts under condition A presented as a matrix. Rows are bins, columns are replicates (trials). In case of single bin analysis, i.e., with bw equal or larger than total observation window length, a vector of counts is returned. |
Bcount |
binned spike counts under condition B |
ABcounts |
binned spike counts under condition AB |
bin.mids |
an array giving the mid-points of the time bins |
bin.width |
a scalar giving the bin width |
time.horizon |
a vector of length 2 giving the start and the end times of the observation period |
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 27 28 29 30 31 32 33 34 35 36 37 | ## generate 25 A and 30 B trials with rate functions
## lambda.A(t) = 160*exp(-2*t/1000) + 40*exp(-0.2*t/1000)
## lambda.B(t) = 40*exp(-2*t/1000)
## where time t is measured in ms. Then, generate 40 AB trials,
## roughly half with flat weight curves with a constant intensity
## either close to A, or close to B or close to the 50-50 mark,
## (equally likely). The remaining curves are sinusoidal
## that snake between 0.01 and 0.99 with a period randomly
## drawn between 400 and 1000
ntrials <- c(nA=25, nB=30, nAB=40)
flat.range <- list(A=c(0.85, 0.95),
B=c(0.05, 0.15),
mid=c(0.45,0.55))
flat.mix <- c(A=1/3, B=1/3, mid=1/3)
wavy.span <- c(0.01, 0.99)
wavy.period <- c(400, 1000)
T.horiz <- 1000
rateB <- 40 * exp(-2*(1:T.horiz)/T.horiz)
rateA <- 4*rateB + 40 * exp(-0.2*(1:T.horiz)/T.horiz)
synth.data <- synthesis.dapp(ntrials = ntrials, pr.flat = 0.5,
intervals = flat.range, wts = flat.mix,
span = wavy.span, period.range = wavy.period,
lambda.A=rateA, lambda.B=rateB)
## Visualize data and generate binned spike counts
spike.counts <- mplex.preprocess(synth.data$spiketimes, visualize=TRUE,
top="Synthetic data: bin size=50ms")
## Not run:
## Visualize total spike counts data
spike.counts <- mplex.preprocess(synth.data$spiketimes, bw=Inf, visualize=TRUE,
top="Synthetic data: total spike counts")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.