vlmc(VLMC)
vlmc()所属R语言包:VLMC
Fit a Variable Length Markov Chain (VLMC)
适合可变长度的马尔可夫链(VLMC)
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Fit a Variable Length Markov Chain (VLMC) to a discrete time series, in basically two steps:<br> First a large Markov Chain is generated containing (all if threshold.gen = 1) the context states of the time series. In the second step, many states of the MC are collapsed by pruning the corresponding context tree.
装一个可变长度马尔可夫链(VLMC)的一个离散的时间序列,基本上有两个步骤:一个大<br>一马尔可夫链生成包含(如果threshold.gen = 1)的背景下国家的时间序列。在第二个步骤中,许多国家的MC崩溃了相应的上下文树的修剪。
用法----------Usage----------
vlmc(dts,
cutoff.prune = qchisq(alpha.c, df=max(.1,alpha.len-1),lower.tail=FALSE)/2,
alpha.c = 0.05,
threshold.gen = 2,
code1char = TRUE, y = TRUE, debug = FALSE, quiet = FALSE,
dump = 0, ctl.dump = c(width.ct = 1+log10(n), nmax.set = -1) )
is.vlmc(x)
## S3 method for class 'vlmc':
print(x, digits = max(3, getOption("digits") - 3), ...)
参数----------Arguments----------
参数:dts
a discrete “time series”; can be a numeric, character or factor.
一个独立的“时间序列”,可以是数字,字符或因素。
参数:cutoff.prune
non-negative number; the cutoff used for pruning; defaults to half the \alpha-quantile of a chisq distribution, where \alpha = alpha.c, the following argument:
非负数;用于修剪,默认的截止到一半的\alpha - 分位数的chisq分布的,其中\alpha =alpha.c,以下几种说法:
参数:alpha.c
number in (0,1) used to specify cutoff.prune in the more intuitive \chi^2 quantile scale; defaulting to 5%.
(0,1)用于指定cutoff.prune更直观的\chi^2位数规模的,默认为5%。
参数:threshold.gen
integer >= 1 (usually left at 2). When generating the initial large tree, only generate nodes with count >= threshold.gen.
整数>= 1(通常是左2)。在生成初始的大树,只生成节点与count >= threshold.gen。
参数:code1char
logical; if true (default), the data dts will be ..........FIXME...........
逻辑;如果为true(缺省值),数据dts.......... FIXME ...........
参数:y
logical; if true (default), the data dts will be returned. This allows to ensure that residuals (residuals.vlmc) and “k-step ahead” predictions can be computed from the result.
逻辑;如果为true(缺省值),数据dts将被退回。这允许以确保残差(residuals.vlmc)和“k-领先一步”预测可以从结果中计算。
参数:debug
logical; should debugging info be printed to stderr.
逻辑调试信息打印到stderr。
参数:quiet
logical; if true, don't print some warnings.
逻辑,如果情况属实,不打印一些警告。
参数:dump
integer in 0:2. If positive, the pruned tree is dumped to stderr; if 2, the initial unpruned tree is dumped as well.
0:2整数。如果是正数,修剪树转储到stderr,如果为2,初始未修剪的树被弃置。
参数:ctl.dump
integer of length 2, say ctl[1:2] controlling the above dump when dump > 0. ctl[1] is the width (number of characters) for the “counts”, ctl[2] the maximal number of set elements that are printed per node; when the latter is not positive (by default), currently max(6, 15 - log10(n)) is used.
长度为2的整数,说ctl[1:2]控制转储时dump > 0。 ctl[1]的“罪状”,ctl[2]印有每个节点的集合元素的最大数目,当后者不积极(默认情况下),目前的宽度(字符数) max(6, 15 - log10(n))使用。
参数:x
a fitted "vlmc" object.
一个装有"vlmc"对象。
参数:digits
integer giving the number of significant digits for printing numbers.
整数的数量显着数字印刷数字。
参数:...
potentially further arguments [Generic].
潜在的进一步的论据[通用]。
值----------Value----------
A "vlmc" object, basically a list with components <table summary="R valueblock"> <tr valign="top"><td>n</td> <td> length of data series when fit.</td></tr> <tr valign="top"><td>threshold.gen, cutoff.prune</td> <td> the arguments (or their defaults).</td></tr> <tr valign="top"><td>alpha.len</td> <td> the alphabet size.</td></tr> <tr valign="top"><td>alpha</td> <td> the alphabet used, as one string.</td></tr> <tr valign="top"><td>size</td> <td> a named integer vector of length (>=) 4, giving characteristic sizes of the fitted VLMC. Its named components are
A"vlmc"对象,基本上是一个列表组件<table summary="R valueblock"> <tr valign="top"> <TD> n</ TD> <TD>长度的数据系列时适合。</ TD> </ TR> <tr valign="top"> <TD> threshold.gen, cutoff.prune </ TD> <TD>的参数(或默认)。</ TD> </ TR> < TR VALIGN =“顶”> <TD>alpha.len </ TD> <TD>字符集的大小。</ TD> </ TR> <tr valign="top"> <TD>alpha <TD>使用的字母表,作为一个字符串</ TD> </ TD> </ TR> <tr valign="top"> <TD>size </ TD> <td>一个名为整数向量长度(> =)4,给拟合VLMC的特征尺寸的。其命名为组件
"ord.MC"the (maximal) order of the Markov chain,
“ord.MC”马尔可夫链(最大)的顺序,
"context"the “context tree size”, i.e., the number of leaves plus number of “hidden nodes”,
“背景”的“上下文树的大小”,即“隐藏节点”的数量的叶加数字的,
"nr.leaves"is the number of leaves, and
“nr.leaves”是叶子的片数,并
"total"the number of integers needed to encode the VLMC tree, i.e., length(vlmc.vec) (see below). </td></tr> <tr valign="top"><td>vlmc.vec</td> <td> integer vector, containing (an encoding of) the fitted VLMC tree.</td></tr> <tr valign="top"><td>y</td> <td> if y = TRUE, the data dts, as character, using the letters from alpha.</td></tr> <tr valign="top"><td>call</td> <td> the call vlmc(..) used.</td></tr> </table>
“总”VLMC树,即,length(vlmc.vec)(见下文)进行编码所需要的数目的整数。 </ TD> </ TR> <tr valign="top"> <TD> vlmc.vec</ TD> <TD>整数向量,包含(编码)的拟合VLMC树。</ TD> < / TR> <tr valign="top"> <TD> y </ TD> <TD>如果y = TRUE,数据dts,为character,使用信从alpha。</ TD> </ TR> <tr valign="top"> <TD>call </ TD> <TD>callvlmc(..) </ TD> </ TR> </ TABLE>
注意----------Note----------
Set cutoff = 0, thresh = 1 for getting a “perfect fit”, i.e. a VLMC which perfectly re-predicts the data (apart from the first observation). Note that even with cutoff = 0 some pruning may happen, for all (terminal) nodes with delta=0.
设置cutoff = 0, thresh = 1得到一个“完美的结合”,即VLMC的完美预测的数据(除了从第一次观测)。请注意,即使cutoff = 0一些修剪,可能发生的所有节点(终端)delta= 0。
(作者)----------Author(s)----------
Martin Maechler
参考文献----------References----------
Buhlmann P. and Wyner A. (1998) Variable Length Markov Chains. Annals of Statistics 27, 480–513.
M盲chler M. and B眉hlmann P. (2004) Variable Length Markov Chains: Methodology, Computing, and Software. J. Computational and Graphical Statistics 2, 435–455.
M盲chler M. (2004) VLMC — Implementation and R interface; working paper.
参见----------See Also----------
draw.vlmc, entropy, simulate.vlmc for “VLMC bootstrapping”.
draw.vlmc,entropy,simulate.vlmc“VLMC引导”。
实例----------Examples----------
f1 <- c(1,0,0,0)
f2 <- rep(1:0,2)
(dt1 <- c(f1,f1,f2,f1,f2,f2,f1))
(vlmc.dt1 <- vlmc(dt1))
vlmc(dt1, dump = 1,
ctl.dump = c(wid = 3, nmax = 20), debug = TRUE)
(vlmc.dt1c01 <- vlmc(dts = dt1, cutoff.prune = .1, dump=1))
data(presidents)
dpres <- cut(presidents, c(0,45,70, 100)) # three values + NA[三个值+ NA]
table(dpres <- factor(dpres, exclude = NULL)) # NA as 4th level[NA为4级]
vlmc.pres <- vlmc(dpres, debug = TRUE)
vlmc.pres
## alphabet & and its length:[#字母和它的长度:]
vlmc.pres$alpha
stopifnot(
length(print(strsplit(vlmc.pres$alpha,NULL)[[1]])) == vlmc.pres$ alpha.len
)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|