draw.covlmc | R Documentation |
This function 'draws' a context tree as a text.
## S3 method for class 'covlmc'
draw(
ct,
control = draw_control(),
model = c("coef", "full"),
p_value = TRUE,
digits = 4,
with_state = FALSE,
...
)
ct |
a fitted covlmc model. |
control |
a list of low level control parameters of the text
representation. See details and |
model |
this parameter controls the display of logistic models
associated to nodes. The default |
p_value |
specifies whether the p-values of the likelihood ratio tests conducted during the covlmc construction must be included in the representation. |
digits |
numerical parameters and p-values are represented using the base::signif function, using the number of significant digits specified with this parameter. |
with_state |
specifies whether to display the state associated to each dimension of the logistic model (see details). |
... |
additional arguments for draw. |
The function uses basic "ascii art" to represent the context tree. Characters
used to represent the structure of the tree, e.g. branches, can be modified
using draw_control()
.
In addition to the structure of the context tree, draw
can represent
information attached to the node (contexts and partial contexts). This is
controlled by additional parameters depending on the type of the context
tree.
the context tree (invisibly).
Model representations are affected by the following additional parameter:
time_sep
: character(s) used to split the coefficients list by blocks
associated to time delays in the covariate inclusion into the logistic
model. The first block contains the intercept(s), the second block the
covariate values a time t-1, the third block at time t-2, etc.
When model="full"
, the representation includes the names of the variables
used by the logistic models. Names are the one generated by the underlying
logistic model, e.g. stats::glm()
. Numerical variable names are used as
is, while factors have levels appended. The intercept is denoted (I)
to
save space. The time delays are represented by an underscore followed by
the time delay. For instance if the model uses the numerical covariate y
with two delays, it will appear as to variables y_1
and y_2
.
When model
is not NULL
, the coefficients of the logistic models are
presented, organized in rows associated to states. One state is used as the
reference state and the logistic model aims at predicting the ratio of
probability between another state and the reference one (in log scale).
When with_state
is TRUE
, the display includes for each row of
coefficients the target state. This is useful when using e.g. VGAM::vglm
as unused levels of the target variable will be automatically dropped from
the model, leading to a reduce number of rows. The reference state is
either shown on the first row if model
is "full"
or after the state on
each row if model
is "coef"
.
pc <- powerconsumption[powerconsumption$week == 5, ]
dts <- cut(pc$active_power, breaks = c(0, quantile(pc$active_power, probs = c(0.5, 1))))
dts_cov <- data.frame(day_night = (pc$hour >= 7 & pc$hour <= 17))
m_cov <- covlmc(dts, dts_cov, min_size = 5)
draw(m_cov, digits = 3)
draw(m_cov, model = NULL)
draw(m_cov, p_value = FALSE)
draw(m_cov, p_value = FALSE, time_sep = " | ")
draw(m_cov, model = "full", time_sep = " | ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.