positions {mixvlmc} | R Documentation |
Report the positions of a sequence associated to a node
Description
This function returns the positions of the sequence represented by node
in the time series used to build the context tree in which the sequence is
represented. This is only possible is those positions were saved during the
construction of the context tree. In positions were not saved, a call to this
function produces an error.
Usage
positions(node)
## S3 method for class 'ctx_node'
positions(node)
## S3 method for class 'ctx_node_cpp'
positions(node)
Arguments
node |
a |
Details
A position of a sequence ctx
in the time series x
is an index value t
such that the sequence ends with x[t]
. Thus x[t+1]
is after the context.
For instance if x=c(0, 0, 1, 1)
and ctx=c(0, 1)
(in standard state
order), then the position of ctx
in x
is 3.
Value
positions of the sequence represented by node
is the original
time series as a integer vector
Examples
dts <- sample(as.factor(c("A", "B", "C")), 100, replace = TRUE)
dts_tree <- ctx_tree(dts, max_depth = 3, min_size = 5)
subseq <- find_sequence(dts_tree, factor(c("B", "A"), levels = c("A", "B", "C")))
if (!is.null(subseq)) {
positions(subseq)
}
[Package mixvlmc version 0.2.1 Index]