change.binary: Changepoint Model with Binary Discrete Distribution

Description Usage Arguments Value Examples

Description

The changepoint model is used to test if there is a significant change in binary probability of one outcome versus another, over the course of some threshold, typically time or sequential order.

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

Numerical value that represents preselected changepoint (only one is allowed) for any model, should the user wish to test a specific point in data; NA by default.

Value

Table containing location of changepoint – either preselected or determined rigorously – and associated significance value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

a = rbinom(200,1,0.3)
b = rbinom(200,1,0.7)
d = data.frame(t=1:400,y=c(a,b))

change.binary(d$y, d$t)
change.binary(d$y, d$t, pre = 195)

hollicam/DiscreteChoiceModels documentation built on May 3, 2019, 8:59 p.m.