I am using the taylor.diagram function in the plotrix package e.g.

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)

enter image description here

In the conventional Taylor diagram there is no bias but in his paper (Taylor, 2001, K.E. Summarizing multiple aspects of model performance in a single diagram Taylor JGR, 106, 7183-7192) Taylor says that

"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"

I admit that I don't know where to start to try and do this. Has anyone succeeded at adding this information on the plot?

有帮助吗?

解决方案

If I understand correctly the bias is the difference in means between the model vector and the observation vector. Then, the problem is to, (a) find the line between the observation and model points, (b) find a line perpendicular to this line, (c) find a point along the perpendicular line, at a distance from the model point equal to the bias.

One possible solution is:

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)
    }

Then,

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

Where the length of the red vector indicates the bias and the length of dotted line joining the vector's tip to the reference point is the RMS error. The direction of the red vector indicates the sign of the bias -- in the picture below, negative bias.

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top