【发布时间】:2019-12-06 21:26:25
【问题描述】:
我正在尝试为给定分布生成分位数函数 (f_q)。这是我的代码:
library(GoFKernel)
f_cdf <- function(x) {
integrate(fstar, 1e-10, x)$value/I
}
f_q <- inverse(f_cdf, lower=1e-10, upper=5-1e-10)
ggplot(x_plot, aes(sample=x))+
labs(title="Empirical against theoretical quantiles")+
stat_qq(distribution=f_q) +
stat_qq_line(distribution=f_q)
当我这样做时,我收到以下错误:
stat_qq() 中的计算失败:未使用的参数(p = 分位数)。stat_qq_line() 中的计算失败:未使用的参数(p = 分位数)。
当我的绘图代码和我从 f 获得的样本时没有问题。原因是当我将'distribution = f_q'更改为'distribution = qnorm'时,我可以成功获得一个ggplot: the qqplot given a 'wrong' distribution
所以,我可以确定我的分位数函数“f_q”存在一些错误。因此,如果有人知道 stat_qq 和 stat_qq.line 的“分布”参数的具体要求,那将非常有帮助。
fstar 在 0 和 5 处未定义,范围在 0 和 5 之间。我设计了一个拒绝方案来模拟此分布,并尝试通过分位数-分位数图比较理论分位数和样本分位数。
【问题讨论】:
标签: r plot distribution simulate