plot.dapp: Plotting Method for Dynamic Admixture of Poisson Process

Description Usage Arguments Value See Also Examples

View source: R/dynamic_neural_model-v6.R

Description

Visually summarizes model fit of the DAPP model to binned spiking data

Usage

1
2
3
4
5
 
## S3 method for class 'dapp'
plot(x, tilt.prior = FALSE, mesh.tilt = 0.1,
     nprior = x$mcmc["nsamp"], ncurves = 10,
     simple.layout = FALSE, ...)

Arguments

x

a fitted model of the class 'dapp'

tilt.prior

lofical giving whether the prior should be tilted to mimic an analysis done with a uniform prior on the range(alpha)

mesh.tilt

a tuning parameter that controls how exactly tilting is done. Shorter mesh value gives tighter match but will require more Monte Carlo simulations

nprior

number of prior draws to be used for display

ncurves

number of curves to be shown individually

simple.layout

logical indicating if a simpler graphical output should be returned with only predictive visualization

...

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

Gives prior and posterior summaries of the range and average predicted alpha curves

See Also

dapp, predict.dapp and summary.dapp.

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## Not run: 
## 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 generated binned spike counts
spike.counts <- mplex.preprocess(synth.data$spiketimes, visualize=FALSE)

## Fit the DAPP model to data
fit.post <- dapp(spike.counts, verbose=FALSE)

## Visualize model fit
plot(fit.post)

## Post process results to assign second order stochasticity labels
summary(fit.post)

## End(Not run)

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