- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何从使用 rpart 拟合的回归树生成预测区间?
我的理解是回归树以叶节点的平均值为条件对响应进行建模。我不知道如何从模型中获取叶节点的方差,但我想做的是使用叶节点的均值和方差进行模拟以获得预测区间。
Predict.rpart()不提供间隔选项。
示例:我用虹膜数据拟合了一棵树,但预测没有选项,“间隔”
> r1 <- rpart(Sepal.Length ~ ., cp = 0.001, data = iris[1:nrow(iris)-1,])
> predict(r1,newdata=iris[nrow(iris),],type = "interval")
Error in match.arg(type) :
'arg' should be one of “vector”, “prob”, “class”, “matrix”
最佳答案
我不清楚置信区间对回归树意味着什么,因为它们不是线性模型等经典统计模型。我主要看到两种用途:表征树的确定性或表征树每片叶子的预测精度。以下是对这些可能性中的每一种的答案。
表征树的确定性
如果您正在寻找 split 节点的置信度值,则 party
直接提供,因为它使用置换测试并从统计上确定哪些变量最重要,以及每个分割的 p 值。 party
的显着优势的 ctree
函数结束 rpart
如解释 here .
回归树的集合叶子的置信区间
第三,如果您正在寻找每个叶中值的区间置信度,那么叶中观测值的 [0.025,0.975] 分位数区间很可能就是您要查找的。 party
中的默认绘图在显示每个叶子的输出值的箱线图时采用类似的方法:
library("party")
r2 <- ctree(Sepal.Length ~ .,data=iris)
plot(r2)
iris$leaf <- predict(r2, type="node")
CIleaf <- aggregate(iris$Sepal.Length,
by=list(leaf=iris$leaf),
quantile,
prob=c(0.025, 0.25, 0.75, 0.975))
plot(as.factor(CIleaf$leaf), CIleaf[, 2],
ylab="Sepal length", xlab="Regression tree leaf")
legend("bottomright",
c(" 0.975 quantile", " 0.75 quantile", " mean",
" 0.25 quantile", " 0.025 quantile"),
pch=c("-", "_", "_", "_", "-"),
pt.lwd=0.5, pt.cex=c(1, 1, 2, 1, 1), xjust=1)
关于r - 如何从回归树 rpart 对象生成预测区间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29131254/
我在 Python 中使用 matplotlib,并制作了一个带条形的直方图。现在,当直方图出现时,仅 5 的倍数出现在 x 轴上,1000 的倍数出现在 y 轴上。对于 y 轴,这完全没有问题,但对
我正在使用 JavaScript 和 jQuery。我有以下脚本每 30 秒提醒一次 hi。 $(document).ready( function() { alert("hi"); setI
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
在 Numpy(python 包)中,可以使用语法 numpy.linspace(minValue, MaxValue, numberOfSamples) 构造 float 的离散区间。 . 我看到
所以我想在 -3 到 3 的区间内制作一些数字,以便在下面绘制这些函数,所以我想要尽可能多的数字。 我这样做: double k[601]; double y[601]; for (int i = 0
我有一个 Postgresql 表,用于存储有关计划进程的信息,包括上次执行进程的时间。不同的进程对其运行频率有不同的要求。 我列出了需要重新运行的进程列表: SELECT * FROM proces
如何正确使用此类带日期间隔的查询 @SqlUpdate("delete fromlogin where created < now() - ':days days' :: interval") v
我正在尝试计算图中的间隔,我在维基百科上找到了算法的数学描述: http://en.wikipedia.org/wiki/Interval_(graph_theory) H = { n0 }
我有一个基于 Informix-SQL 的 Pawnshop 应用程序,该应用程序根据黄金的重量和纯度计算应向客户贷出多少钱。当铺的最低贷款额为 5.00 美元。当铺员工通常会借出以 5 或 0 结尾
我将 NHibernate 与代码映射一起使用,并且我有一个由此公式创建的属性。 Property(x => x.IsInOverdue, mapper => mapper .Fo
我正在尝试从头开始为 Beta 分布编写卡方拟合优度检验,而不使用任何外部函数。下面的代码报告“1”适合,即使来自 scipy.stats 的 kstest 返回零。数据是正常分布的,所以我的函数也应
如何在 C# 中将任何值四舍五入到 10 区间?例如,如果我有 11,我希望它返回 10,如果我有 136,那么我希望它返回 140。 我可以很容易地用手做 return ((int)(number
如何在 Go 中表示 PostgreSQL 区间? 我的结构看起来像这样: type Product struct { Id int Name
我想编写一个函数,将数值限制在封闭的 0,1 区间内: func clamp01(_ value:T) -> T { return value 1 ? 1 : value } 在 Swift 3
我有一个简单的表格,用于存储来自在线仪表的降水读数。这是表定义: CREATE TABLE public.precip ( gauge_id smallint,
a = y def __gt__(self, y): return not self.x > y def __eq__(self, y): return
我正在处理 pandas 数据框 D=pd.DataFrame(data=[1.0,2.0,2.0,2.0,5.0,3.0,2.0,2.0,5.0,5.0,8.0,1.0]) 我识别低于特定阈值的值
我编写了一些C++代码来解决此问题: #include #include using namespace std; unsigned int countSetBits(unsigned int n
好的,我知道之前有人用一个有限的缩放示例问过这个问题 [-1, 1]间隔 [a, b] Different intervals for Gauss-Legendre quadrature in num
我是一名优秀的程序员,十分优秀!