2

我正在使用包taylor.diagram中的功能,plotrix例如

obs = runif(100,1,100)
mod1 = runif(100,1,100)
mod2 = runif(100,1,100) 
mod3 = runif(100,1,100) 
taylor.diagram(obs,mod1)
taylor.diagram(obs,mod2,add=TRUE)
taylor.diagram(obs,mod3,add=TRUE)

在此处输入图像描述

在传统的泰勒图中没有偏差,但在他的论文中(Taylor, 2001, KE Summarizing multiple aspect of model performance in a single diagram Taylor JGR, 106, 7183-7192)泰勒说

"Although the diagram has been designed to convey information about centered pattern differences it is also possible to indicate differences in overall means (i.e., the bias). This can be done on the diagram by attaching to each plotted point a line segment drawn at a right angle to the straight line defined by the point and the reference point. If the length of the attached line segment is equal to the bias, then the distance from the reference point to the end of the line segment will be equal to the total (uncentered) RMS error"

我承认我不知道从哪里开始尝试这样做。有没有人成功地在情节上添加了这些信息?

4

1 回答 1

5

如果我理解正确,偏差是模型向量和观察向量之间的均值差异。然后,问题是,(a)找到观测点和模型点之间的线,(b)找到垂直于这条线的线,(c)沿着垂直线找到一个点,与模型点的距离相等到偏见。

一种可能的解决方案是:

taylor.bias <- function(ref, model, normalize = FALSE){
    R <- cor(model, ref, use = "pairwise")
    sd.f <- sd(model)
    sd.r <- sd(ref)
    m.f <- mean(model)
    m.r <- mean(ref)

    ## normalize if requested
    if (normalize) {
        m.f <- m.f/sd.r
        m.r <- m.r/sd.r
        sd.f <- sd.f/sd.r
        sd.r <- 1
        }

    ## calculate bias
    bias <- m.f - m.r

    ## coordinates for model and observations
    dd <- rbind(mp = c(sd.f * R, sd.f * sin(acos(R))), rp = c(sd.r, 0))

    ## find equation of line passing through pts
    v1 <- solve(cbind(1, dd[,1])) %*% dd[,2]    

    ## find perpendicular line
    v2 <- c(dd[1,2] + dd[1,1]/v1[2], -1/v1[2])

    ## find point defined by bias
    nm <- dd[1,] - c(0, v2[1])
    nm <- nm / sqrt(sum(nm^2))
    bp <- dd[1,] + bias*nm

    ## plot lines
    arrows(x0 = dd[1,1], x1 = bp[1], y0 = dd[1,2], y1 = bp[2], col = "red", length = 0.05, lwd = 1.5)
    lines(rbind(dd[2,], bp), col = "red", lty = 3)
    lines(dd, col = "red", lty = 3)
    }

然后,

library(plotrix)
obs = runif(100,1,100)
mod1 = runif(100,1,100)
taylor.diagram(obs,mod1)
taylor.bias(obs,mod1)

其中红色向量的长度表示偏差,将向量尖端连接到参考点的虚线长度是 RMS 误差。红色矢量的方向表示偏差的符号——在下图中,负偏差。

在此处输入图像描述

于 2014-02-25T20:14:33.093 回答