【问题标题】:How to add confidence intervals to 3D surface?如何将置信区间添加到 3D 表面?
【发布时间】:2019-05-07 17:58:59
【问题描述】:

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

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

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

我想在这张图片上使用 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)

【问题讨论】:

    标签: r plot graph 3d confidence-interval


    【解决方案1】:

    问题在于上下置信区间被绘制为一条线。如果您以一定间隔遍历这些点,然后在此处绘制上限值和下限值之间的线,则该图看起来更接近您想要的。请注意,示例 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)
    }
    

    【讨论】:

      猜你喜欢
      • 2016-09-11
      • 2013-10-19
      • 2021-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-18
      相关资源
      最近更新 更多