Description Usage Arguments Value Examples
Simulation experiment of change-point detection with known post-change distributions using the statistic-based stopping rule.
1 2 | sim.detect.stat(GEN0, GEN1, detect.stat, nulower = NULL,
nuupper = NULL, ...)
|
GEN0, GEN1 |
Functions that take no argument and return an observation from the
pre-change ( |
detect.stat |
A function that implements the statistic-based stopping rule: |
nulower, nuupper |
Optional nonnegative numerics: The earliest and latest
time of change-point based on prior belief. The default is |
... |
Additional arguments to be passed to |
A named numeric vector with components
is.FA
A numeric of 1 or 0 indicating whether a false alarm has been raised.
DD
A positive numeric: The delay to detection.
CT
A positive numeric: The computation time.
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 42 43 44 45 46 47 | ##Change from N(0,1) to N(1,1) occurs between 10 and 25.
GEN0=function() rnorm(1)
GEN1=function() rnorm(1)+1
ULP0=function(x) -x^2/2
ULP1=function(x) -(x-1)^2/2
GLP0=function(x) -x
GLP1=function(x) -(x-1)
LLP0=function(x) -1
LLP1=function(x) -1
par0=log(2*pi)/2;par1=par0
#using hyvarinen score
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.stat,nulower=10,nuupper=25,
alpha=0.1,GLP0=GLP0,LLP0=LLP0,GLP1=GLP1,LLP1=LLP1)
#using log score. normalizing constant is unknown
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.stat,nulower=10,nuupper=25,
alpha=0.1,score="log",ULP0=ULP0,ULP1=ULP1,lenx=1)
#using log score. normalizing constant is known
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.stat,nulower=10,nuupper=25,
alpha=0.1,score="log",ULP0=ULP0,ULP1=ULP1,par0=par0,par1=par1)
###################################
##Change from 3 iid Bernoulli(0.2) to 3 iid Bernoulli(0.8) occurs before 20.
GEN0=function() rbinom(3,1,0.2)
GEN1=function() rbinom(3,1,0.8)
ULP0=function(x) sum(x)*(log(0.2)-log(1-0.2))
ULP1=function(x) sum(x)*(log(0.8)-log(1-0.8))
par0=-3*log(1-0.2)
par1=-3*log(1-0.8)
#using hyvarinen score
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.bin.stat,nuupper=20,
alpha=0.1,ULP0=ULP0,ULP1=ULP1)
#using log score. normalizing constant is unknown
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.bin.stat,nuupper=20,
alpha=0.1,score="log",ULP0=ULP0,ULP1=ULP1,lenx=3)
#using log score. normalizing constant is known
sim.detect.stat(GEN0=GEN0,GEN1=GEN1,detect.stat=detect.bin.stat,nuupper=20,
alpha=0.1,score="log",ULP0=ULP0,ULP1=ULP1,par0=par0,par1=par1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.