rstatisticssimulation

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


I am relatively new to R and trying to simulate a Gumbel copula with and one of these margin is gumbel pdf and the other is exponential.

by this code

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)

The output was:

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)

They also mention remark

Warning message in mvdCheckM(margins, "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"

I think the problem lies in parameter values of the marginal distributions because when I type

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)

No problem!!


Solution

  • As Elin mentioned in the comment I did it by changing capital G to small g and added my own function

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

    and now the code works

    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