如何将置信区间添加到 3D 表面?

How to add confidence intervals to 3D surface?

我有一个 40x40 的矩阵,它来自使用库 akima 进行插值以创建 3D 表面所获得的值。

我使用 monte carlo 模拟预测值估计了 CI 95%,现在我想将第 0 年的它们添加到我的 3D 图表中。

我做错了,我不明白如何绘制垂直线来表示 CIs。 我的台词是这样的:

而且我想要 CI 喜欢这张图片:

这是我的数据,保管箱 link,因为它比此处 post 允许的 space 长: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)
}