Type: Package
Title: Bayesian Model to Find Changepoints Based on Rates and Count Data
Version: 1.0.4
Author: Andrew G. Chapple
Maintainer: Andrew G. Chapple <agc6@rice.edu>
Description: This function fits a reversible jump Bayesian piecewise exponential model that also includes the intensity of each event considered along with the rate of events.
License: GPL-2
Encoding: UTF-8
LazyData: true
Imports: Rcpp (≥ 0.12.9)
LinkingTo: Rcpp, RcppArmadillo
RoxygenNote: 6.0.1
NeedsCompilation: yes
Packaged: 2018-04-24 18:00:14 UTC; Andrew
Repository: CRAN
Date/Publication: 2018-04-24 18:10:19 UTC

Runs the PieceExpIntensity sampler and returns posterior results.

Description

Returns a list of posterior samples along with summaries for the most visited number of split points.

Usage

PieceExpIntensity(X, Y, B, Poi)

Arguments

X

Vector containing observed event times.

Y

Vector containing poisson count intensities.

B

Number of iterations to run the MCMC with half burned in.

Poi

Prior mean number of split points.

Value

A list of all posterior quantities and a summary of the most commonly visited model.

References

Chapple (2017). Modeling ISIL terror attacks and their intensities via flexible Bayesian piecewise models. Currently Under Review.

Examples

B=1000
n=100
X=rexp(n,1)
Y=X
Y[X<.5]=rpois(sum(X<.5),20)
Y[X>.5]=rpois(sum(X>.5),3)
Poi=10
PieceExpIntensity(X,Y,B,Poi)

C++ Sampling Function for MCMC

Description

C++ Sampling Function used in the PieceExpIntensity function.

Usage

PieceExpIntensity2(Y, Rates, B, Poi)

Arguments

Y

Vector containing observed event times.

Rates

Vector containing poisson count intensities.

B

Number of iterations to run the MCMC with half burned in.

Poi

Prior mean number of split points,

Value

A list of all posterior quantities.

Examples

B=1000
n=100
Y=rexp(n,1)
Rates=Y
Rates[Y<.5]=rpois(sum(Y<.5),20)
Rates[Y>.5]=rpois(sum(Y>.5),3)
Poi=10
PieceExpIntensity2(Y,Rates,B,Poi)