rstudent()对于"mlm"返回错误的结果. (装有多个LHS的线性模型) [英] rstudent() returns incorrect result for an "mlm" (linear models fitted with multiple LHS)

查看:275
本文介绍了rstudent()对于"mlm"返回错误的结果. (装有多个LHS的线性模型)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道对具有多个LHS的线性模型的支持是有限的.但是,当可以在"mlm"对象上运行函数时,我希望结果是可信的.使用rstudent时,会产生奇怪的结果.这是一个错误还是有其他解释?

I know that the support for linear models with multiple LHS is limited. But when it is possible to run a function on an "mlm" object, I would expect the results to be trusty. When using rstudent, strange results are produced. Is this a bug or is there some other explanation?

在下面的示例中,fittedAfittedB相同,但是在rstudent情况下,第二列不同.

In the example below fittedA and fittedB are identical, but in the case of rstudent the 2nd column differs.

y <- matrix(rnorm(20), 10, 2)
x <- 1:10
fittedA <- fitted(lm(y ~ x))
fittedB <- cbind(fitted(lm(y[, 1] ~ x)), fitted(lm(y[, 2] ~ x)))
rstudentA <- rstudent(lm(y ~ x))
rstudentB <- cbind(rstudent(lm(y[, 1] ~ x)), rstudent(lm(y[, 2] ~ x)))

推荐答案

谢谢@李哲源;另请参见 https://www.r-project.org/bugs.html 如何报告错误... R核心团队对它们的重视程度更高.此外,在那里,我们可以为补丁程序提供更好的信誉..
Als注意,R的源代码(尤其是其开发版本)始终可以通过svn("subversion")或通过 https://svn.r-project.org/R/trunk/

Thank you @李哲源; see also https://www.r-project.org/bugs.html on how to report bugs ... where they are noticed better by the R core team. Also, there, we could give better credit for patches..
Als note that R's source code - notably it's development version - is always available via svn ("subversion") or also a webbrowser at https://svn.r-project.org/R/trunk/

cooks.distance.lm()rstandard.lm()的源代码均在

Both, cooks.distance.lm()'s and rstandard.lm()'s source code is in https://svn.r-project.org/R/trunk/src/library/stats/R/lm.influence.R .... all for a next time. Your proposed small code changes via outer() are good enough of course.

非常感谢您进行详尽的分析和提出的建议的错误修复!

Thank you very much for the thorough analysis and your well proposed bug fix!

这篇关于rstudent()对于"mlm"返回错误的结果. (装有多个LHS的线性模型)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆