change.binary: Changepoint Model with Binary Discrete Distribution

Description Usage Arguments Value Examples

Description

Fit changepoint model on data to test if there is a significant change in binary probability of one outcome versus other outcome.

Usage

1
change.binary(v, t = seq(1, length(v)), x = rep(NA, length(v)), pre = NA)

Arguments

v

Vector that contains response variable of interest.

t

Vector that contains threshold variable over which to study change (ex. Time, outcome count in succession); default is sequence from 1 to total number of observations.

x

Vector that contains hidden parameter, should you wish to test an interaction of original data with another variable (i.e., a hierarchical model); NA by default.

pre

A value represents preselected changepoint for any model, should the user wish to test a specific point in data; NA by default.

Value

Table that contains location of changepoint (either preselected or determined rigorously) and its associated significance value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
r = rnorm(400,0,1) * 10
r1 = r[1:200]
r2 = r[201:400]
a = rbinom(200,1,
           exp(r1)/(1+exp(r1)))
b = rbinom(200,1,
           exp(r2+1)/(1+exp(r2+2)))
d = data.frame(x=r,y=c(a,b),t=1:400)

change.binary(v = d$y, t= d$t, x = d$x)
change.binary(v = d$y, t= d$t, pre = 200)

tinyleap/LatentStage documentation built on May 12, 2019, 4:27 p.m.