繁体   English   中英

如何在3D曲面上添加置信区间?

[英]How to add confidence intervals to 3D surface?

我使用矩阵akima通过插值获得的值具有40x40的矩阵,以创建3D曲面。

我使用蒙特卡洛模拟从预测值中估计出95%的CI,现在我想将0年的它们添加到我的3D图形中。

我做错了什么,我不明白如何绘制垂直线来表示配置项。 我的台词看起来像这样:

在此处输入图片说明

我希望在此图像上具有CI: 在此处输入图片说明

这是我的数据保管箱链接,因为它比允许在此处发布的空间长: https : //www.dropbox.com/s/c6iyd2r00k5jbws/data.rtf?dl=0

和我的代码:

    persp(xyz,theta = 45, phi = 25,border="grey40", ticktype = "detailed", zlim=c(0,.8))->res2

   y.bin <- rep(1,25)
    x.bin <- seq(-10,10,length.out = 25)

points (trans3d(x.bin, y.bin, z = y0, pmat = res2), col = 1, lwd=2)
lines (trans3d(x.bin, y.bin, z = LCI, pmat = res2), col = 1, lwd=2)
lines (trans3d(x.bin, y.bin, z = UCI, pmat = res2), col = 1, lwd=2)

问题在于,上下置信区间被绘制为一条直线。 如果您以一定的间隔在这些点上循环,然后在该点的上限值和下限值之间绘制线,则该图看起来更接近您想要的值。 请注意,示例y0中的点值不在许多3d间隔上。

在此处输入图片说明

# data from link is imported
persp(xyz,theta = 45, phi = 25,border="grey40", ticktype = "detailed", zlim=c(0,.8))->res2

y.bin <- rep(1,25)
x.bin <- seq(-10,10,length.out = 25)

# y0 points
points (trans3d(x.bin, y.bin, z = y0, pmat = res2), col = 1, lwd=2)

# lines between upper and lower CIs for each location
for(i in 1:length(LCI)){
  lines (trans3d(rep(x.bin[i],2), rep(y.bin[i],2), z = c(LCI[i],UCI[i]), pmat = res2), col = 1, lwd=2)
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM