我正在构建一个R包来显示R中的Weibull图(使用graphics::plot
).该图具有对数变换的x轴和Weibull变换的y轴(缺少更好的描述).因此,双参数威布尔分布可以在该图上表示为直线.
x轴的对数变换就像将log="x"
参数添加到plot()
或中一样简单curve()
.如何以优雅的方式提供y轴变换,以便所有与图形相关的绘图都可以在我的轴变换图上使用?要演示我需要的内容,请运行以下示例代码:
## initialisation ##
beta <- 2;eta <- 1000
ticks <- c(seq(0.01,0.09,0.01),(1:9)/10,seq(0.91,0.99,0.01))
F0inv <- function (p) log(qweibull(p, 1, 1))
# this is the transformation function
F0 <- function (q) exp(-exp(q))
# this is the inverse of the transformation function
weibull <- function(x)pweibull(x,beta,eta)
# the curve of this function represents the weibull distribution
# as a straight line on weibull paper
weibull2 <- function(x)F0inv(weibull(x))
Run Code Online (Sandbox Code Playgroud)
首先用威布尔分布的例子 …