residuals.vlmc(VLMC)
residuals.vlmc()所属R语言包:VLMC
Compute Residuals of a Fitted VLMC Object
计算残差的一个装有VLMC对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Compute residuals of a fitted vlmc object.
计算残差的一个合身的的vlmc对象。
This is yet a matter of research and may change in the future.
这又是一个问题的研究,并可能在未来发生改变。
用法----------Usage----------
## S3 method for class 'vlmc':
residuals(object,
type = c("classwise",
"deviance", "pearson", "working", "response", "partial"),
y = object$y, ...)
参数----------Arguments----------
参数:object
typically the result of vlmc(..).
通常vlmc(..)的结果。
参数:type
The type of residuals to compute, defaults to "classwise" which returns an n x m matrix, see below. The other types only make sense when the discrete values of y are ordered which always includes the binary case (m=2). <br> The "deviance" residuals r are defined similarly as for logistic regression, see below. <br> "pearson", "working" and "response" are currently identical and give the difference of the underlying integer code (of the discrete data). Note that "partial" residuals are not yet defined!
残差计算的类型,缺省值到"classwise",它返回一个n x m矩阵,见下文。只其他类型的离散值时有意义y是有序的,它总是包括二进制的情况下(m=2)。参考"deviance"残差r的定义同样的logistic回归分析,请参阅下文。参考“皮尔森”,“工作”和“响应”目前相同的底层整数代码(离散数据)得到的差。需要注意的是"partial"的残差尚未定义!
参数:y
discrete time series with respect to which the residuals are to be computed.
离散时间序列的残差计算。
参数:...
possibly further arguments (none at the moment).
可能有进一步的参数没有在那一刻。
值----------Value----------
If type = "classwise" (the default), a numeric matrix of dimension n x m of values I[i,j] - p[i,j] where the indicator I[i,j] is 1 iff y[i] == a[j] and a is the alphabet (or levels) of y, and p[i,j] are the elements of the estimated (1-step ahead) predicted probabilities, p <- predict(object). Hence, for each i, the only positive residual stands for the observed class.
如果type = "classwise"(默认值),数字矩阵的维n x m值I[i,j] - p[i,j]在哪儿指标I[i,j]是1,当且仅当y[i] == a[j]和a是字母(或级别)y和p[i,j]元素的估计(1 - 领先一步)预测概率,p <- predict(object)。因此,对于每个i,只有正值剩余表示为所观察到的类。
For all other types, the result is a numeric vector of the length of the original time-series (with first element NA).<br> For type = "deviance", r[i] = +- sqrt(-2 log(P[i])) where P[i] is the predicted probability for the i-th observation which is the same as p[i,y[i]] above (now assuming y[i] in {1,2,...,m}). The sum of the squared deviance residuals is the deviance of the fitted model.
对于所有其他的type的,其结果是一个数值向量的原始的时间序列的长度(与第一元件NA)。<br>如需type = "deviance",r[i] = +- sqrt(-2 log(P[i])) 其中P[i]是预测概率的第i个观察,它是相同p[i,y[i]]上述(现在假定y[i] in {1,2,...,m})。的总和的平方越轨残差是越轨拟合模型。
(作者)----------Author(s)----------
Martin Maechler
参见----------See Also----------
vlmc,deviance.vlmc, and
vlmc,deviance.vlmc,和
实例----------Examples----------
example(vlmc)
rp <- residuals(vlmc.pres)
stopifnot(all(abs(apply(rp[-1,],1,sum)) < 1e-15))
matplot(seq(presidents), rp, ylab = "residuals", type="l")
## ``Tukey-Anscombe'' (the following is first stab at plot method):[#杜克安斯库姆“(以下是首次尝试在图法):]
matplot(fitted(vlmc.pres), rp, ylab = "residuals", xaxt = "n",
type="b", pch=vlmc.pres$alpha)
axis(1, at = 0vlmc.pres$alpha.len-1),
labels = strsplit(vlmc.pres$alpha,"")[[1]])
summary(rd <- residuals(vlmc.pres, type = "dev"))
rd[1:7]
## sum of squared dev.residuals === deviance :[#总结的平方dev.residuals,===偏差:]
all.equal(sum(rd[-1] ^ 2),
deviance(vlmc.pres))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|