Method new()
Create a new Stcp object.
Usage
Stcp$new(
method = c("ST", "SR", "CU", "GLRCU"),
family = c("Normal", "Ber", "Bounded"),
alternative = c("two.sided", "greater", "less"),
threshold = log(1/0.05),
m_pre = 0,
delta_lower = 0.1,
delta_upper = NULL,
weights = NULL,
lambdas = NULL,
k_max = 1000
)
Arguments
method
Method of the sequential procedure.
ST: Sequential test based on a mixture of E-values.
SR: Sequential change detection based on e-SR procedure.
CU: Sequential change detection based on e-CUSUM procedure.
GLRCU: Sequential change detection based on GLR-CUSUM procedure.
family
Distribution of underlying univariate observations.
Normal: (sub-)Gaussian with sigma = 1.
Ber: Bernoulli distribution on {0,1}.
Bounded: General bounded distribution on [0,1]
alternative
Alternative / post-change mean space
two.sided: Two-sided test / change detection
greater: Alternative /post-change mean is greater than null / pre-change one
less: Alternative /post-change mean is less than null / pre-change one
threshold
Stopping threshold. We recommend to use log(1/alpha)
for "ST" and "SR" methods where alpha is a testing level or 1/ARL.
for "CU" and "GRLCU", we recommend to tune the threshold by using
domain-specific sampler to hit the target ARL.
m_pre
The boundary of mean parameter in null / pre-change space
delta_lower
Minimum gap between null / pre-change space and
alternative / post-change one. It must be strictly positive for ST, SR and CU.
Currently, GLRCU does not support the minimum gap, and this param will be ignored.
delta_upper
Maximum gap between null / pre-change space and
alternative / post-change one. It must be strictly positive for ST, SR and CU.
Currently, GLRCU does not support the maximum gap, and this param will be ignored.
weights
If not null, the input weights will be used to initialize Stcp object.
lambdas
If not null, the input lambdas will be used to initialize Stcp object.
k_max
Positive integer to determine the maximum number of baselines.
For GLRCU method, it is used as the lookup window size for GLRCU statistics.
Returns
A new Stcp
object.
Print summary of Stcp object.
Method getWeights()
Return weights of mixture of e-values / e-detectors.
Method getLambdas()
Return lambda parameters of mixture of e-values / e-detectors.
Method getLogValue()
Return the log value of mixture of e-values / e-detectors.
Method getThreshold()
Return the threshold of the sequential test / change detection
Usage
Stcp$getThreshold()
Method isStopped()
Return TRUE if the sequential test / change detection was stopped by crossing the threshold.
Method getTime()
Return the number of observations having been passed.
Method getStoppedTime()
Return the stopped time. If it has been never stopped, return zero.
Usage
Stcp$getStoppedTime()
Method reset()
Reset the stcp object to the initial setup.
Method updateLogValues()
Update the log value and related fields by passing a vector of observations.
Usage
Stcp$updateLogValues(xs)
Arguments
xs
A numeric vector of observations.
Method updateLogValuesUntilStop()
Update the log value and related fields until the log value is crossing the boundary.
Usage
Stcp$updateLogValuesUntilStop(xs)
Arguments
xs
A numeric vector of observations.
Method updateAndReturnHistories()
Update the log value and related fields then return updated log values by passing a vector of observations.
Usage
Stcp$updateAndReturnHistories(xs)
Arguments
xs
A numeric vector of observations.
Method updateLogValuesByAvgs()
Update the log value and related fields by passing
a vector of averages and number of corresponding samples.
Usage
Stcp$updateLogValuesByAvgs(x_bars, ns)
Arguments
x_bars
A numeric vector of averages.
ns
A numeric vector of sample sizes.
Method updateLogValuesUntilStopByAvgs()
Update the log value and related fields by passing
a vector of averages and number of corresponding samples
until the log value is crossing the boundary.
Usage
Stcp$updateLogValuesUntilStopByAvgs(x_bars, ns)
Arguments
x_bars
A numeric vector of averages.
ns
A numeric vector of sample sizes.
Method updateAndReturnHistoriesByAvgs()
Update the log value and related fields then return updated log values
a vector of averages and number of corresponding samples.
Usage
Stcp$updateAndReturnHistoriesByAvgs(x_bars, ns)
Arguments
x_bars
A numeric vector of averages.
ns
A numeric vector of sample sizes.