eval(expr, envir, enclos) 出错:找不到函数 "qGumbel"

Error in eval(expr, envir, enclos): could not find function "qGumbel"

我对 R 比较陌生,正在尝试模拟 Gumbel copula,其中一个边距是 gumbel pdf,另一个是指数边距。

通过此代码

G3 <- gumbelCopula(1.37, dim=2)
gMvd2 <- mvdc(G3, c("Gumbel","exp"), param = list(list(shape=10.2988298881251, scale=1.02463492397923), list(rate=4)))
set.seed(11)
# n <- if(Xtras) 10000 else 200 # sample size (realistic vs short for example)
x <- rMvdc(100, gMvd2)
head(x)

输出为:

Error in eval(expr, envir, enclos): could not find function "qGumbel"
Traceback:

1. rMvdc(100, gMvd2)
2. eval(qdf.expr, list(x = u[, i]))
3. eval(expr, envir, enclos)

他们也提到了

mvdCheckM 中的警告消息(边距,"p"):

"margins correct? Currently, have no function(s) named: pGumbel"Warning message in mvdCheckM(margins, "d"):
"margins correct? Currently, have no function(s) named: dGumbel"

我认为问题出在边际分布的参数值上,因为当我输入

G3 <- gumbelCopula(1.37, dim=2)
gMvd2 <- mvdc(G3, c("exp","exp"), param = list(list(rate=2), list(rate=4)))
set.seed(11)
# n <- if(Xtras) 10000 else 200 # sample size (realistic vs short for example)
x <- rMvdc(100, gMvd2)
head(x)

没问题!!

正如 Elin 在评论中提到的,我通过将大写 G 更改为小写 g 并添加了我自己的函数来做到这一点

qgumbel <- function(p,shape,scale) shape-scale *log(-log(p))

现在代码可以工作了

G3 <- gumbelCopula(1.37, dim=2)
gMvd2 <- mvdc(G3, c("gumbel","exp"), param = list(list(shape=10.2988298881251, scale=1.02463492397923), list(rate=4)))
set.seed(11)
# n <- if(Xtras) 10000 else 200 # sample size (realistic vs short for example)
x <- rMvdc(100, gMvd2)
head(x)
#  parameter values of the marginal distributions