找回密码
 注册
查看: 348|回复: 0

R语言 VLMC包 predict.vlmc()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-1 16:24:13 | 显示全部楼层 |阅读模式
predict.vlmc(VLMC)
predict.vlmc()所属R语言包:VLMC

                                        Prediction of VLMC for (new) Series
                                         (新)系列VLMC预测

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Compute predictions on a fitted VLMC object for each (but the first) element of another discrete time series. Computes by default a matrix of prediction probabilities.  The argument type allows other predictions such as the most probable "class" or "response", the context length (tree "depth"), or an "ID" of the corresponding context.
计算上一个装VLMC的对象为每一个(第一)元素的另一种离散的时间序列的预测。默认情况下,矩阵计算的预测概率。允许其他的预测,最有可能的type或"class"“的背景下长度(树"response"),或"depth"相应的上下文的参数"ID" 。


用法----------Usage----------


## S3 method for class 'vlmc':
predict(object, newdata,
         type = c("probs", "class","response", "id.node", "depth", "ALL"),
         se.fit = FALSE,
         allow.subset = TRUE, check.alphabet=TRUE,
         ...)
## S3 method for class 'vlmc':
fitted(object, ...)



参数----------Arguments----------

参数:object
typically the result of vlmc(..).
通常vlmc(..)的结果。


参数:newdata
a discrete “time series”, a numeric, character or factor, as the dts argument of vlmc(.).
一个独立的“时间序列”,一个数字,字符或因素,如dtsvlmc(.)参数。


参数:type
character indicating the type of prediction required, options given in the Usage secion above, see also the Value section below.  The default "probs" returns a matrix of prediction probabilties, whereas "class" or "response" give the corresponding most probable class.  The value of this argument can be abbreviated.
字符表示的预测需要的类型,选项给出上述用途secion在,请参阅下面的值部分。默认"probs"返回一个矩阵预测probabilties,而"class"或"response"给予相应的最可能的类。这个参数的值,可以缩写。


参数:se.fit
a switch indicating if standard errors are required. <br> &mdash; NOT YET supported &mdash; .
一个开关,指示如果需要标准误差。 <BR>  - 尚不支持 - 。


参数:allow.subset
logical; if TRUE, newdata may not have all different &ldquo;alphabet letters&rdquo; used in x.
逻辑,如果TRUE,newdata可能不都不同的“字母”用于x。


参数:check.alphabet
logical; if TRUE, consistency of newdata's alphabet with those of x is checked.
合乎逻辑;,如果TRUE,一致性newdata的英文字母与x的检查。


参数:...
(potentially further arguments) required by generic.
(参数可能进一步)的通用要求。


值----------Value----------

Depending on the type argument, <table summary="R valueblock"> <tr valign="top"><td>"probs"</td> <td> an n * m matrix pm of (prediction) probabilities, i.e., all the rows of pm sum to 1.
根据type参数,表summary="R valueblock"> <tr valign="top"> <TD> "probs" </ TD> <TD>n * m矩阵 pm(预测)的概率,也就是说,所有的行pm总和为1。

pm[i,k] is  Pr(Y[i]=k | Y[i-1,...]) (and is therefore NA for i=1). The dimnames of pm are the values of newdata[] and the alphabet letters k.</td></tr> <tr valign="top"><td>"class", "response"</td> <td> the corresponding most probable value of Y[]; as factor for "class" and as integer in 0m-1) for type = "response". If there is more than one most probable value, the first one is chosen.</td></tr> <tr valign="top"><td>"id.node"</td> <td> an (integer) &ldquo;ID&rdquo; of the current context (= node of the tree represented VLMC).</td></tr> <tr valign="top"><td>"depth"</td> <td> the context length, i.e., the depth of the Markov chain, at the current observation (of newdata).</td></tr>
pm[i,k]是Pr(Y[i]=k | Y[i-1,...])(因此NAi=1)。 dimnamespm的值newdata[]和字母k。</ TD> </ TR> <tr valign="top"> <TD>的"class", "response" </ TD> <TD>相应的最有可能的Y值[]factor"class"和作为整数0m-1)type = "response"的。如果有超过一个最可能的值,第一个被选中。</ TD> </ TR> <tr valign="top"> <TD>"id.node" </ TD> <TD>(整数)电流的上下文(树节点代表VLMC)的“ID”。</ TD> </ TR> <tr valign="top"> <TD> "depth"</ TD> <TD>的背景下长度,即马尔可夫链的深度,在当前的观测值(newdata“)。</ TD> </ TR>

<tr valign="top"><td>"ALL"</td> <td> an object of class "predict.vlmc", a list with the following components,   
<tr valign="top"> <TD> "ALL" </ TD> <TD>类的一个对象"predict.vlmc",有以下组件的列表,

IDinteger vector as for type = "id.node",
IDinteger矢量为为type = "id.node",

probsprediction probability matrix, as above,
probsprediction概率矩阵,如上所述,

flagsinteger vector, non-zero for particular states only, rather for debugging.
flagsinteger向量,非零特定的状态,而只进行调试。




ctxtcharacter, ctxt[i] a string giving the context (backwards) for newdata[i], using alphabet letters.
ctxtcharacter,ctxt[i]一个字符串,给出上下文(向后)newdata[i],使用字母。

fittedcharacter with fitted values, i.e., the alphabet letter with the highest probability, using max.col where ties are broken at random.
fittedcharacter与拟合值,即的字母概率最高的,使用max.col随机关系被打破。

alpha, alpha.lenthe alphabet (single string) and its length.    which has its own print method (print.predict.vlmc).</td></tr> </table>
α,alpha.lenthe字母(单个字符串中)和它的长度。都有自己的打印方法(print.predict.vlmc)</ TD> </ TR> </ TABLE>


注意----------Note----------

The predict method and its possible arguments are still in active development, and we are considering to return the marginal probabilities instead of NA for the first value(s).
predict方法和可能的参数仍然在开发中,我们正在考虑返回的边际概率,而不是NA的第一个值(S)。


参见----------See Also----------

vlmc and residuals.vlmc.  For
vlmc和residuals.vlmc。为


实例----------Examples----------


f1 <- c(1,0,0,0)
f2 <- rep(1:0,2)
(dt2 <- rep(c(f1,f1,f2,f1,f2,f2,f1),2))

(vlmc.dt2c15  <- vlmc(dt2, cutoff = 1.5))
draw(vlmc.dt2c15)

## Fitted Values:[拟合值]
all.equal(predict(vlmc.dt2c15, dt2), predict(vlmc.dt2c15))
(pa2c15 <- predict(vlmc.dt2c15, type = "ALL"))

## Depth = context length  ([1] : NA) :[#深度=上下文长度([1]:NA):]
stopifnot(nchar(pa2c15 $ ctxt)[-1] ==
          predict(vlmc.dt2c15, type = "depth")[-1])

same <- (ff1 <- pa2c15 $ fitted) ==
        (ff2 <- int2alpha(predict(vlmc.dt2c15, type ="response"), alpha="01"))
which(!same) #-&gt; some are different, since max.col() breaks ties at random![ - >有些不同,,因为max.col()打破在随机的关系!]

ndt2 <- c(rep(0,6),f1,f1,f2)
predict(vlmc.dt2c15, ndt2, "ALL")

(newdt2 <- sample(dt2, 17))
pm <- predict(vlmc.dt2c15, newdt2, allow.subset = TRUE)
summary(apply(pm, 1, sum))# all 1[所有的1]

predict(vlmc.dt2c15, newdt2, type = "ALL")

data(bnrf1)
(vbnrf <- vlmc(bnrf1EB))
(pA <- predict(vbnrf, bnrf1EB[1:24], type = "ALL"))
pc <- predict(vbnrf, bnrf1EB[1:24], type = "class")
pr <- predict(vbnrf, bnrf1EB[1:24], type = "resp")
stopifnot(as.integer  (pc[-1])   == 1 + pr[-1],
          as.character(pc[-1]) == strsplit(vbnrf$alpha,NULL)[[1]][1 + pr[-1]])

##-- Example of a "perfect" fit -- just for illustration:[# - 一个“完美”的契合 - 只是为了说明的例子:]
##                            the default, thresh = 2 doesn't fit perfectly(i=38)[#默认情况下,阈值= 2不完全适合(I = 38)]
(vlmc.dt2c0th1 <- vlmc(dt2, cutoff = 0, thresh = 1))

## "Fitted" = "Data" (but the first which can't be predicted):[#“装修”=“数据”(但第一不能预测):]
stopifnot(dt2[-1] == predict(vlmc.dt2c0th1,type = "response")[-1])

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-26 05:19 , Processed in 0.021664 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表