import("methods")

##importFrom("stats", "end", "time", "start")
importFrom("graphics", "plot")
import("zoo")
importFrom(stats, confint)
importFrom("stats", "uniroot")
import("stats4")
import("expm")
import("mvtnorm")
import("cubature")
importFrom("statmod","gauss.quad")

import("coda")
importFrom(utils, toLatex)

importFrom("graphics", "lines")
importFrom("stats", "qchisq")
importFrom("utils", "relist")
importFrom("stats", "spline")

importFrom(boot, boot) # added by YK on Sep. 9, 2017 
#08/07/2016
#exportPattern("^[[:alpha:]]+") # NEVER DO THIS AGAIN PLEASE!
#cimport(RcppArmadillo)
importFrom(Rcpp, evalCpp)
#import(RcppArmadillo)
# 03/07/2015
importFrom(stats, time)
importFrom(stats, ts)
importFrom(stats, rnorm)
importFrom(stats, na.omit)
importFrom(stats, dgamma)
importFrom(stats, optimHess)
importFrom(stats, filter)
importFrom(utils, tail)
importFrom(utils, head)
importFrom(stats, acf)
importFrom(stats, fft)
importFrom(stats, rexp)
importFrom(stats, approx)
importFrom(stats, arima0)
importFrom(stats, frequency)
importFrom(stats, D)
importFrom(stats, integrate)
importFrom(stats, rpois)
importFrom(stats, runif)
importFrom(stats, optim)
importFrom(stats, optimize)
importFrom(stats, deltat)
importFrom(stats, pchisq)
importFrom(stats, symnum)
importFrom(stats, rchisq)
importFrom(stats, rgamma)
importFrom(stats, diffinv)
importFrom(stats, pnorm)
importFrom(stats, approxfun)
importFrom(stats, qnorm)
importFrom(stats, rbinom)
importFrom(stats, constrOptim)
importFrom(stats, dnorm)
importFrom(stats, deriv)
importFrom(graphics, points)
importFrom(stats, end)
importFrom(stats, start)
importFrom(utils, str)
importFrom(stats, sd)
importFrom("stats", cov2cor) # added by YK on Apr. 12, 2018
importFrom("graphics", "abline", "hist", "par", "text") # added by YK on Jul. 19, 2019
importFrom("stats", "mvfft") # added by YK on Apr. 15, 2020
importFrom("stats", "convolve") # added by YK on Jan. 28, 2022
importFrom(coda, as.mcmc)
importFrom("stats", "cov", "var")

# added by EG on Dec. 15, 2021
importFrom(calculus,"%dot%")
importFrom(calculus,"%gradient%")
importFrom(calculus,"%inner%")
importFrom(calculus,"%mx%")
importFrom(calculus,"%outer%")
importFrom(calculus,"%prod%")
importFrom(calculus,"%sum%")

# added by Kosuke Kito on Jul. 27, 2024
importFrom(Matrix, "bdiag")
importFrom(calculus, "derivative")

# added by Masahiro Kurisaki on Apr. 4, 2025 
importFrom("grDevices", "rgb")
importFrom("graphics", "close.screen", "legend", "polygon", "screen", "split.screen")

exportClasses("yuima",
"yuima.data",
"yuima.law",
"yuima.sampling",
"yuima.characteristic",
"yuima.model",
"model.parameter",
"yuima.carma",
"yuima.carmaHawkes",
"carmaHawkes.info",
"carma.info",
"yuima.carma.qmle",
"yuima.poisson",
"yuima.qmle",
"yuima.CP.qmle",
"cogarch.info",
"yuima.cogarch",
"yuima.Map",
"info.Map",
"param.Map",
"yuima.multimodel",
"param.Integral",
"variable.Integral",
"Integrand",
"Integral.sde",
"yuima.Integral",
"info.PPR",
"yuima.PPR",
"yuima.Hawkes",
"yuima.th",
"yuima.PPR.qmle",
"yuima.LevyRM",
"yuima.snr",
"yuima.ae",  # added by EG on Dec. 15, 2021
"yuima.state_space_model",
"yuima.linear_state_space_model"
)

exportMethods(
#"dim",
## "start",
"plot",
## "time",
## "end",
"simulate",
"cce",
"llag",
"poisson.random.sampling",
"get.zoo.data",
"initialize",
##              "ql",
##              "rql",
##              "ml.ql",
"adaBayes",
"lseBayes",
"limiting.gamma",
"getF",
"getf",
"getxinit",
"gete",
"simFunctional",
"F0",
"Fnorm",
"asymptotic_term",
#"cbind.yuima",
"rand",
"dens",
"cdf",
"quant",
"char"
#"rbind.yuima"
)

## function which we want to expose to the user
## all other functions are used internally by the
## package
export(ybook)
export(setYuima)
export(setModel) ## builds sde model
export(setData)
export(setSampling)
export(setCharacteristic)
export(setCarma)
export(setCarmaHawkes)
export(setPoisson)
export(setPPR)
export(setHawkes)
export(dconst)
export(rconst)
export(setLaw)
export(setCogarch)
export(setMap)
#export(setMultiModel)
export(setIntegral)
export(FromCF2yuima_law)
export(setLaw_th)
#export(dim)
#export(start)
export(plot)
#export(time)
#export(end)

export(simulate) # simulates couple of processes
export(setLRM)
export(estimation_LRM)
export(subsampling)
export(cce)
export(llag)
export(poisson.random.sampling)
export(noisy.sampling)
export(mpv)
export(bns.test)
export(hyavar) # asymptotic variance estimator for the Hayashi-Yoshida estimator
export(lmm) # Oct. 10, 2015: local methods of moment estimator
export(mllag) # Oct. 10, 2015: multiple lead-lag detector
export(llag.test) # Sep. 9, 2017: testing the absence of lead-lag effects 
export(cce.factor) # Jul. 19, 2019: high-dimensional covariance estimator
export(simBmllag) # added by YK on Apr. 15, 2020
export(simBmllag.coef) # added by YK on Apr. 15, 2020
export(wllag) # added by YK on Apr. 15, 2020
export(minrv, medrv, minrv.test, medrv.test, lm.jumptest, pz.test) # added by YK on Nov. 28, 2021

export(get.zoo.data)

##export(ql,rql,ml.ql)
##export(rql)
export(adaBayes)
export(lseBayes)
export(rIG, rNIG, rbgamma, rvgamma, rstable,rpts,rnts, rGIG, rGH) ## random number generators in rng.R
export(dIG, dNIG, dbgamma, dvgamma, dGIG, dGH) ## pdfs in rng.R
export(limiting.gamma)
export(lambdaFromData)


export(setFunctional)
export(getF)
export(getf)
export(getxinit)
export(gete)

export(simFunctional)
export(F0)
export(Fnorm)
export(asymptotic_term)

##export(LSE)
export(lse)

export(qmle)
export(EstimCarmaHawkes)
export(get.counting.data)
export(quasilogl)
export(phi.test)
export(lasso)
export(CPoint)
export(qmleR)
export(qmleL)
export(qmleLevy)
export(IC)
export(snr)
export(JBtest)
export(DataPPR)
export(qmleDegenerate) # added by YK
export(kalmanBucyFilter)
export(qmle.linear_state_space_model)
export(poest)


export(Intensity.PPR)


export(CarmaNoise) # Estimates the Levy in carma model
export(gmm) # Estimation COGARCH(P,Q) using Method Of Moments
export(cogarchNoise)
export(Diagnostic.Cogarch)
export(Diagnostic.Carma)

# Asymptotic expansion (added by EG on Dec. 15, 2021)
export(ae)
export(aeCharacteristic)
export(aeDensity)
export(aeExpectation)
export(aeKurtosis)
export(aeMarginal)
export(aeMean)
export(aeMoment)
export(aeSd)
export(aeSkewness)

# Methods
export(rand)# random number generator of a Levy process specified by user
export(dens)
export(cdf)
export(quant)
export(char)


export(qgv)
export(mmfrac)

export(simCIR)
export(fitCIR)

#export(cbind.yuima)
#export(rbind.yuima)
S3method(print, phitest)
S3method(print, qgv)
S3method(print, mmfrac)
S3method(print, yuima.lasso)
S3method(print, yuima.llag) # Oct. 10, 2015
S3method(print, yuima.mllag) # Oct. 10, 2015
S3method(print, yuima.specv) # Oct. 10, 2015
S3method(print, yuima.ic)
S3method(print, yuima.wllag) # added by YK on Apr. 15, 2020

S3method(toLatex, yuima)
S3method(toLatex, yuima.model)
S3method(toLatex, yuima.carma)
S3method(toLatex, yuima.cogarch)
S3method(rbind, yuima.model)
S3method(cbind, yuima)

S3method(plot, yuima.llag) # Oct. 10, 2015
S3method(plot, yuima.mllag) # Oct. 10, 2015
S3method(plot, yuima.wllag) # added by YK on Apr. 15, 2020
S3method(print, summary.yuima)

useDynLib(yuima)

