## Copyright (C) 2012 Marius Hofert, Ivan Kojadinovic, Martin Maechler, and Jun Yan
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.


useDynLib(copula, .registration=TRUE)

### Part I: Former copula ######################################################

importFrom("graphics", persp, contour)

importFrom("mvtnorm",
           dmvnorm, pmvnorm, rmvnorm,
           dmvt, pmvt, rmvt)

## FIXME[instead of "Depends"]: importFrom(pspline)

## importFrom(sn, dmst)
## importFrom(sn, qsn, dsn, psn, dmsn, pmsn)

export(dcopula, pcopula, rcopula)
export(dmvdc, pmvdc, rmvdc)
export(kendallsTau, spearmansRho, tailIndex)
export(calibKendallsTau, calibSpearmansRho)

## archmCopula methods
export(genFun, genInv, genFunDer1, genFunDer2)

## evCopula methods
export(Afun, AfunDer, Anfun)

exportClasses(mvdc)
exportClasses(Copula, copula, ellipCopula, archmCopula, evCopula)
exportClasses(indepCopula)
exportClasses(normalCopula, tCopula)
exportClasses(claytonCopula, frankCopula, gumbelCopula, amhCopula)
exportClasses(galambosCopula, huslerReissCopula, tawnCopula, tevCopula)
exportClasses(plackettCopula)
exportClasses(fgmCopula)

export(mvdc)
export(ellipCopula, archmCopula, evCopula)
export(normalCopula, tCopula)
export(indepCopula)
export(claytonCopula, frankCopula, gumbelCopula, amhCopula)
export(galambosCopula, huslerReissCopula, tawnCopula, tevCopula)
export(plackettCopula)
export(fgmCopula)

exportMethods(show, summary)
exportMethods(persp, contour)

## fitting copula
export(loglikCopula, loglikMvdc)
export(fitCopula, fitMvdc)
exportClasses(fitCopula, fitMvdc)
exportClasses(summaryFitCopula, summaryFitMvdc)

## independence tests
export(indepTestSim, indepTest, multIndepTest,
       serialIndepTestSim, serialIndepTest, multSerialIndepTest,
       dependogram)

## gof tests
export(gofCopula, gofEVCopula)

## other nonparametric tests
export(evTestC, evTestA, evTestK)
export(exchEVTest, exchTest)

## asymmetric copula class testing
exportClasses(asymCopula)
export(asymCopula)
exportClasses(asymExplicitCopula)
export(asymExplicitCopula)

S3method(print, indepTest)
S3method(print, gofCopula)
S3method(print, evTest)
S3method(print, exchTest)

## testing
## export(derCdfWrtParams, derPdfWrtParams, tauDer, rhoDer)
## export(derCdfWrtArgs)
## export(ChiPlot, KPlot)
## testing purpose
## export(fitCopula.repar)
## export(multcomp) ---> R/mult.R


### Part II: Former nacopula ###################################################

## Now  'Depend'  on  stats4 and bbmle :
##importFrom("stats4", mle)
importMethodsFrom("stats4", coef,confint, logLik, AIC, BIC, summary, plot, profile)

importFrom("gsl", debye_1)

importFrom("ADGofTest", ad.test)

importFrom("stabledist", dstable)

if(FALSE) {## currently do not "depend" on Rmpfr's correct installation:
## As we use it in "bad cases" polyG(), dsumSibuya(),..:
importFrom("Rmpfr",
	   mpfr, chooseMpfr, chooseMpfr.all,
	   getPrec, roundMpfr, sumBinomMpfr)
## currently needed when Rmpfr is detached, as it influences "numeric" (e.g. in examples testing):
importClassesFrom("Rmpfr",
                  mpfr, atomicVector, array_or_vector, Mnumber)
}

exportClasses("acopula",
              "nacopula", "outer_nacopula",
              "interval", "maybeInterval"
              )

## Generics, functions and acopula - family objects defined in this package
export("copAMH", "copClayton", "copFrank", "copGumbel", "copJoe"
       ,"getAcop"
       ,"cacopula", "dnacopula", "pnacopula", "rnacopula" ,"rnchild"
       ## estimation
       ## ,"coeffG", "polyG", "polyJ", "signFF"
       ,"initOpt"
       ,"beta.", "beta.hat", "pobs"
       ,"ebeta", "etau", "emde", "dDiag", "edmle", "emle", "enacopula"
       ## goodness-of-fit
       ,"gofTstat", "rtrafo", "htrafo", "gnacopula"
       ## Kendall distribution
       ,"K", "pK", "qK", "dK", "rK"
       ## misc
       ,"onacopula", "onacopulaL", "nac2list", "nesdepth", rnacModel, nacPairthetas
       ,"polynEval"
       ,"printNacopula"
       ,"interval"
       ,"opower"
       ,"prob"
       ,"timing"
       ## Should we provide these in a separate (very small) R pakage ?
       ,"sinc", "A..Z"
       ,"rstable1"
       ,"retstable", "retstableR"
       ,"dSibuya", "pSibuya", "dsumSibuya", "rSibuya", "rSibuyaR"
       ,"rlog", "rlogR", "rF01Frank", "rF01Joe", "rFFrank", "rFJoe"
       ,"log1mexp"
       ,"polylog", "Bernoulli", "Bernoulli.all"
       ,"Eulerian", "Stirling1", "Stirling2"
       ,"Eulerian.all", "Stirling1.all", "Stirling2.all"
       ,"psiDabsMC"
       ,"setTheta"
       ,"tauAMH"
       ,"allComp" # <- maybe keep private ?
       ,"safeUroot"
       ,"splom2"
       )

exportMethods(## for both own and "other" generics:
	      "prob",
	      "%in%", "dim",
	      "format", "show"
	      )
