我试图在 R 中查看 Sn 或 SnB 方法的代码,但是当我gofCopula
在Copula包中打开 R 函数时,我看不到整个代码。如何访问特定方法的代码?这是函数示例:
gofCopula(copula, x, N=1000, method="SnB
")
当我进入时,gofCopula
我只看到这个:
function (copula, x, N = 1000, method = eval(formals(gofTstat)$method),
estim.method = eval(formals(fitCopula)$method), simulation = c("pb",
"mult"), verbose = TRUE, print.every = NULL, optim.method = "BFGS",
optim.control = list(maxit = 20), ...)
{
stopifnot(is(copula, "copula"), N >= 1)
if (!is.matrix(x))
x <- rbind(x, deparse.level = 0L)
stopifnot((d <- ncol(x)) > 1, (n <- nrow(x)) > 0, dim(copula) ==
d)
method <- match.arg(method)
estim.method <- match.arg(estim.method)
optim.method <- match.arg(optim.method)
simulation <- match.arg(simulation)
stopifnot(optim.method %in% eval(formals(optim)$method))
if (!is.null(print.every)) {
warning("Argument 'print.every' is deprecated. Please use 'verbose' instead.")
verbose <- print.every > 0
}
if (missing(estim.method) && !missing(method)) {
eMeth <- eval(formals()$estim.method)
if (!is.na(i <- pmatch(method, eMeth))) {
warning("old (pre 0.999-*) argument 'method' is now called 'estim.method'")
estim.method <- eMeth[i]
method <- "Sn"
}
}
switch(simulation, pb = {
gofPB(copula, x, N = N, method = method, estim.method = estim.method,
verbose = verbose, optim.method = optim.method, optim.control = optim.control,
...)
}, mult = {
gofMB(copula, x = x, N = N, method = method, estim.method = estim.method,
optim.method = optim.method, optim.control = optim.control,
...)
}, stop("Invalid simulation method ", simulation))
}
<environment: namespace:copula>