# Refer to all C/Fortran routines by their name prefixed by C_
useDynLib(stats, .registration = TRUE, .fixes = "C_")

import(graphics)
importFrom(grDevices, dev.interactive, palette, extendrange, xy.coords)

importFrom(utils, str)


# exportPattern("^[^\\.]")
export(.checkMFClasses, .getXlevels, .MFclass)

export(add.scope, add1, addmargins, aggregate, aggregate.data.frame,
       aggregate.default, aggregate.ts, AIC, alias, anova, anova.glm,
       anova.glmlist, anova.lm, anova.lmlist, anova.mlm, aov, approx,
       approxfun, as.formula, as.ts, ave, BIC, binomial, bw.bcv,
       bw.nrd, bw.nrd0, bw.SJ, bw.ucv, C, case.names, coef,
       coefficients, complete.cases, confint, confint.default,
       constrOptim, contr.SAS, contr.helmert, contr.poly, contr.sum,
       contr.treatment, contrasts, "contrasts<-", convolve,
       cooks.distance, cor, cov, cov.wt, cov2cor, covratio, cycle, D,
       dbeta, dbinom, dcauchy, dchisq, delete.response, deltat,
       density, density.default, deriv, deriv.default, deriv.formula,
       deriv3, deriv3.default, deriv3.formula, deviance, dexp, df,
       df.residual, dfbeta, dfbetas, dffits, dgamma, dgeom, dhyper,
       diff.ts, dlnorm, dlogis, dmultinom, dnbinom, dnorm, dpois,
       drop.scope, drop.terms, drop1, dsignrank, dt, dummy.coef,
       dunif, dweibull, dwilcox, eff.aovlist, effects, estVar, end,
       expand.model.frame, extractAIC, factor.scope, family, fft,
       fitted, fitted.values, fivenum, formula, frequency, ftable,
       Gamma, gaussian, get_all_vars, getCall, glm, glm.control, glm.fit,
       hasTsp, hat, hatvalues, hatvalues.lm, influence,
       influence.measures, integrate, interaction.plot,
       inverse.gaussian, IQR, is.empty.model, is.mts, is.ts, lines.ts,
       lm, lm.fit, lm.influence, lm.wfit, logLik, loglin, lowess,
       ls.diag, ls.print, lsfit, mad, mahalanobis, make.link,
       makepredictcall, manova, mauchly.test, median, model.extract,
       model.frame, model.frame.aovlist, model.frame.default,
       model.frame.glm, model.frame.lm, model.matrix,
       model.matrix.default, model.matrix.lm, model.offset,
       model.response, model.tables, model.weights, mvfft, na.action,
       na.exclude, na.fail, na.omit, na.pass, napredict, naprint,
       naresid, nextn, nlm, nlminb, nobs, offset, optim, optimHess, optimise,
       optimize, p.adjust, p.adjust.methods, pbeta, pbinom, pcauchy,
       pchisq, pexp, pf, pgamma, pgeom, phyper, plnorm, plogis,
       plot.density, plot.lm, plot.mlm, plot.ts, plot.TukeyHSD,
       pnbinom, pnorm, poisson, poly, polym, power, ppoints, ppois,
       predict, predict.glm, predict.lm, predict.mlm, predict.poly,
       preplot, printCoefmat, print.anova, print.density,
       print.family, print.formula, print.ftable, print.glm,
       print.infl, print.integrate, print.lm, print.logLik,
       print.terms, print.ts, profile, proj, psignrank, pt, ptukey,
       punif, pweibull, pwilcox, qbeta, qbinom, qcauchy, qchisq, qexp,
       qf, qgamma, qgeom, qhyper, qlnorm, qlogis, qnbinom, qnorm,
       qpois, qqline, qqnorm, qqnorm.default, qqplot, qsignrank, qt,
       qtukey, quantile, quantile.default, quasi, quasibinomial,
       quasipoisson, qunif, qweibull, qwilcox, r2dtable, rbeta,
       rbinom, rcauchy, rchisq, read.ftable, reformulate, relevel,
       replications, reshape, resid, residuals, residuals.default,
       residuals.glm, residuals.lm, rexp, rf, rgamma, rgeom, rhyper,
       rlnorm, rlogis, rmultinom, rnbinom, rnorm, rpois, rsignrank,
       rstandard, rstandard.glm, rstandard.lm, rstudent, rstudent.glm,
       rstudent.lm, rt, runif, rweibull, rwilcox, rWishart, sd, se.contrast,
       simulate, spline, splinefun, splinefunH, SSD, start,
       stat.anova, step, summary.aov, summary.aovlist, summary.glm,
       summary.infl, summary.lm, summary.manova, summary.mlm, symnum,
       termplot, terms, terms.aovlist, terms.default, terms.formula,
       terms.terms, time, ts, tsp, "tsp<-", TukeyHSD, TukeyHSD.aov,
       uniroot, update, update.default, update.formula, var,
       variable.names, vcov, weighted.mean, weighted.residuals,
       weights, window, "window<-", write.ftable, xtabs, pbirthday,
       qbirthday)

# for now, as package 'rv' takes over median
export(median.default)

# deprecated
export(mauchley.test)

# defunct
export(reshapeWide, reshapeLong, print.coefmat, anovalist.lm, lm.fit.null,
       lm.wfit.null, glm.fit.null)

## register all the methods for generics elsewhere in case namespace is
## loaded but not currently attached.
S3method("[", acf)
S3method("[", formula)
S3method("[", terms)
S3method("[", ts)
S3method("[<-", ts)
S3method(add1, default)
S3method(add1, glm)
S3method(add1, lm)
S3method(add1, mlm)
S3method("aggregate", "formula")
S3method(AIC, default)
S3method(AIC, logLik)
S3method(alias, formula)
S3method(alias, lm)
S3method(as.data.frame, aovproj)
S3method(as.data.frame, ftable)
S3method(as.data.frame, logLik)
S3method(as.table, ftable)
S3method(as.ts, default)
S3method(BIC, default)
S3method(BIC, logLik)
S3method(case.names, default)
S3method(case.names, lm)
S3method(cbind, ts)
S3method(coef, aov)
S3method(coef, default)
S3method(coef, listof)
S3method(confint, default)
S3method(confint, glm)
S3method(confint, lm)
S3method(confint, nls)
S3method(cooks.distance, glm)
S3method(cooks.distance, lm)
S3method(cycle, default)
S3method(cycle, ts)
S3method(deltat, default)
S3method(deviance, default)
S3method(deviance, glm)
S3method(deviance, lm)
S3method(deviance, mlm)
S3method(df.residual, default)
S3method(dfbeta, lm)
S3method(dfbetas, lm)
S3method(drop1, default)
S3method(drop1, glm)
S3method(drop1, lm)
S3method(drop1, mlm)
S3method(dummy.coef, aovlist)
S3method(dummy.coef, lm)
S3method(effects, glm)
S3method(effects, lm)
S3method(end, default)
S3method(estVar, SSD)
S3method(estVar, mlm)
S3method(extractAIC, aov)
S3method(extractAIC, coxph)
S3method(extractAIC, glm)
S3method(extractAIC, lm)
S3method(extractAIC, negbin)
S3method(extractAIC, survreg)
S3method(family, glm)
S3method(family, lm)
S3method(fitted, default)
S3method(fitted, kmeans)
S3method(format, ftable)
S3method(formula, character)
S3method(formula, data.frame)
S3method(formula, default)
S3method(formula, formula)
S3method(formula, glm)
S3method(formula, lm)
S3method(formula, terms)
S3method(frequency, default)
S3method(ftable, default)
S3method(ftable, formula)
S3method(getCall, default)
S3method(influence, glm)
S3method(influence, lm)
S3method(labels, dist)
S3method(labels, lm)
S3method(labels, terms)
S3method(logLik, glm)
S3method(logLik, lm)
S3method(logLik, logLik)
S3method(makepredictcall, default)
S3method(makepredictcall, poly)
S3method(mauchly.test, SSD)
S3method(mauchly.test, mlm)
S3method(median, default)
S3method(model.tables, aov)
S3method(model.tables, aovlist)
S3method(na.action, default)
S3method(na.contiguous, default)
S3method(na.exclude, data.frame)
S3method(na.exclude, default)
S3method(na.fail, default)
S3method(na.omit, data.frame)
S3method(na.omit, default)
S3method(na.omit, ts)
S3method(napredict, default)
S3method(napredict, exclude)
S3method(naprint, default)
S3method(naprint, exclude)
S3method(naprint, omit)
S3method(naresid, default)
S3method(naresid, exclude)
S3method(nobs, default)
S3method(nobs, glm)
S3method(nobs, lm)
S3method(nobs, logLik)
S3method(nobs, nls)
S3method(Ops, ts)
S3method(plot, density)
S3method(plot, lm)
S3method(plot, mlm)
S3method(plot, ts)
S3method(plot, TukeyHSD)
S3method(predict, glm)
S3method(predict, lm)
S3method(predict, mlm)
S3method(predict, poly)
S3method(print, acf)
S3method(print, anova)
S3method(print, aov)
S3method(print, aovlist)
S3method(print, density)
S3method(print, dummy_coef)
S3method(print, dummy_coef_list)
S3method(print, family)
S3method(print, formula)
S3method(print, ftable)
S3method(print, glm)
S3method(print, htest)
S3method(print, infl)
S3method(print, integrate)
S3method(print, kmeans)
S3method(print, lm)
S3method(print, logLik)
S3method(print, mtable)
S3method(print, pairwise.htest)
S3method(print, power.htest)
S3method(print, summary.aov)
S3method(print, summary.aovlist)
S3method(print, summary.glm)
S3method(print, summary.lm)
S3method(print, summary.manova)
S3method(print, tables_aov)
S3method(print, TukeyHSD)
S3method(print, terms)
S3method(print, ts)
S3method(print, xtabs)
S3method(proj, aov)
S3method(proj, aovlist)
S3method(proj, default)
S3method(proj, lm)
S3method(qr, lm)
S3method(quantile, default)
S3method(quantile, ecdf)
S3method(quantile, POSIXt)
S3method(relevel, default)
S3method(relevel, factor)
S3method(relevel, ordered)
S3method(reorder, default)
S3method(se.contrast, aov)
S3method(se.contrast, aovlist)
S3method(simulate, lm)
S3method(summary, aov)
S3method(summary, aovlist)
S3method(summary, glm)
S3method(summary, infl)
S3method(summary, lm)
S3method(summary, manova)
S3method(summary, mlm)
S3method(SSD, mlm)
S3method(start, default)
S3method(str, logLik)
S3method(t, ts)
S3method(time, default)
S3method(time, ts)
S3method(TukeyHSD, aov)
S3method(update, default)
S3method(update, formula)
S3method(variable.names, default)
S3method(variable.names, lm)
S3method(vcov, glm)
#S3method(vcov, gls)
S3method(vcov, lm)
S3method(vcov, summary.lm)
S3method(vcov, summary.glm)
S3method(vcov, mlm)
#S3method(vcov, lme)
S3method(weights, default)
S3method(weights, glm)
S3method(window, default)
S3method(window, ts)
S3method("window<-", ts)


## from ctest

exportPattern("\\.test$")
export(pairwise.table)

# documented but not exported
# export(print.power.htest)

S3method(ansari.test, default)
S3method(ansari.test, formula)
S3method(bartlett.test, default)
S3method(bartlett.test, formula)
S3method(cor.test, default)
S3method(cor.test, formula)
S3method(fligner.test, default)
S3method(fligner.test, formula)
S3method(friedman.test, default)
S3method(friedman.test, formula)
S3method(kruskal.test, default)
S3method(kruskal.test, formula)
S3method(mood.test, default)
S3method(mood.test, formula)
S3method(quade.test, default)
S3method(quade.test, formula)
S3method(t.test, default)
S3method(t.test, formula)
S3method(var.test, default)
S3method(var.test, formula)
S3method(wilcox.test, default)
S3method(wilcox.test, formula)

## from eda
export(line, medpolish, smooth)

S3method(plot, medpolish)
S3method(print, medpolish)
S3method(print, tukeyline)
S3method(print, tukeysmooth)
S3method(residuals, tukeyline)
S3method(summary, tukeysmooth)


## from modreg

export(isoreg, ksmooth, loess, loess.control, loess.smooth, ppr,
       runmed, scatter.smooth, smooth.spline, smoothEnds, supsmu)

# methods which are documented and registered, but not exported
# export(plot.isoreg, plot.ppr,
#        predict.loess, predict.smooth.spline)

S3method(anova, loess)
S3method(fitted, isoreg)
S3method(fitted, smooth.spline)
S3method(lines, isoreg)
S3method(plot, isoreg)
S3method(plot, ppr)
S3method(ppr, default)
S3method(ppr, formula)
S3method(predict, loess)
S3method(predict, ppr)
S3method(predict, smooth.spline)
S3method(predict, smooth.spline.fit)
S3method(print, isoreg)
S3method(print, loess)
S3method(print, ppr)
S3method(print, smooth.spline)
S3method(print, summary.loess)
S3method(print, summary.ppr)
S3method(residuals, isoreg)
S3method(residuals, smooth.spline)
S3method(summary, loess)
S3method(summary, ppr)

## from mva

export(as.dist, as.hclust, biplot, cancor, cmdscale,
       cophenetic, cutree, dist, factanal, hclust, kmeans,
       loadings, plclust, prcomp, princomp, promax,
       rect.hclust, screeplot, varimax)
## dendro*
export(as.dendrogram, dendrapply, heatmap, is.leaf,
       order.dendrogram, reorder)

## methods which are documented but not exported
## export(as.hclust.default, as.matrix.dist,
##        biplot.princomp, cut.dendrogram,
##        identify.hclust, plot.dendrogram, plot.hclust,
##        print.dist, print.factanal,
##        print.loadings, print.summary.princomp, str.dendrogram,
##        summary.princomp)

S3method("[[", dendrogram)
S3method(as.dendrogram, hclust)
S3method(as.hclust, dendrogram)
S3method(as.hclust, default)
S3method(as.hclust, twins)
S3method(as.matrix, dist)
S3method(biplot, default)
S3method(biplot, princomp)
S3method(biplot, prcomp)
S3method(cut, dendrogram)
S3method(format, dist)
S3method(identify, hclust)
S3method(labels, dendrogram)
S3method(merge, dendrogram)
S3method(plot, dendrogram)
S3method(plot, hclust)
S3method(plot, prcomp)
S3method(plot, princomp)
S3method(predict, prcomp)
S3method(predict, princomp)
S3method(prcomp, default)
S3method(prcomp, formula)
S3method(princomp, default)
S3method(princomp, formula)
S3method(print, dendrogram)
S3method(print, dist)
S3method(print, factanal)
S3method(print, hclust)
S3method(print, loadings)
S3method(print, prcomp)
S3method(print, princomp)
S3method(print, summary.prcomp)
S3method(print, summary.princomp)
S3method(reorder, dendrogram)
S3method(rev, dendrogram)
S3method(screeplot, default)
S3method(str, dendrogram)
S3method(summary, prcomp)
S3method(summary, princomp)

## from nls

export(NLSstAsymptotic, NLSstClosestX, NLSstLfAsymptote,
       NLSstRtAsymptote, SSasymp, SSasympOff, SSasympOrig, SSbiexp,
       SSfol, SSfpl, SSgompertz, SSlogis, SSmicmen, SSweibull,
       asOneSidedFormula, clearNames, getInitial, nls, nls.control,
       numericDeriv, selfStart, setNames, sortedXyData)

# documented but not exported
# export(formula.nls, plot.profile.nls, predict.nls, profile.nls)

S3method(NLSstAsymptotic, sortedXyData)
S3method(NLSstClosestX, sortedXyData)
S3method(NLSstLfAsymptote, sortedXyData)
S3method(NLSstRtAsymptote, sortedXyData)
S3method(anova, nls)
S3method(coef, nls)
S3method(deviance, nls)
S3method(df.residual, nls)
S3method(fitted, nls)
S3method(formula, nls)
S3method(getInitial, default)
S3method(getInitial, formula)
S3method(getInitial, selfStart)
S3method(logLik, nls)
S3method(plot, profile.nls)
S3method(predict, nls)
S3method(print, nls)
S3method(print, summary.nls)
S3method(profile, nls)
S3method(profiler, nls)
S3method(residuals, nls)
S3method(selfStart, default)
S3method(selfStart, formula)
S3method(sortedXyData, default)
S3method(summary, nls)
S3method(vcov, nls)
S3method(weights, nls)

## from ts: Box.test and PP.test are covered above.

export(acf, acf2AR, ar, ar.burg, ar.mle, ar.ols, ar.yw, arima,
       arima.sim, arima0, arima0.diag, ARMAacf, ARMAtoMA,
       bandwidth.kernel, ccf, cpgram, decompose, df.kernel, diffinv,
       embed, filter, HoltWinters, is.tskernel, KalmanForecast,
       KalmanLike, KalmanRun, KalmanSmooth, kernapply, kernel, lag,
       lag.plot, makeARIMA, monthplot, na.contiguous, pacf, plot.spec,
       plot.spec.coherency, plot.spec.phase, spec.ar, spec.pgram,
       spec.taper, spectrum, stl, StructTS, toeplitz, ts.intersect,
       ts.plot, ts.union, tsdiag, tsSmooth)

# methods which are documented and registered
# export(ar.burg.default, ar.burg.mts, ar.yw.default, ar.yw.mts,
#        diffinv.default, diffinv.ts, kernapply.default,
#        kernapply.ts, kernapply.tskernel, kernapply.vector,
#        lag.default, monthplot.default, monthplot.stl,
#        monthplot.StructTS, monthplot.ts, pacf.default,
#        plot.acf, plot.HoltWinters, plot.stl, predict.ar,
#        predict.Arima, predict.arima0, predict.HoltWinters,
#        tsdiag.Arima, tsdiag.arima0, tsdiag.StructTS,
#        tsSmooth.StructTS)

S3method("[", tskernel)
S3method(ar.burg, default)
S3method(ar.burg, mts)
S3method(ar.yw, default)
S3method(ar.yw, mts)
S3method(coef, Arima)
S3method(diffinv, default)
S3method(diffinv, ts)
S3method(diffinv, vector)
S3method(kernapply, default)
S3method(kernapply, ts)
S3method(kernapply, tskernel)
S3method(kernapply, vector)
S3method(lag, default)
S3method(lines, ts)
S3method(logLik, Arima)
S3method(monthplot, default)
S3method(monthplot, stl)
S3method(monthplot, StructTS)
S3method(monthplot, ts)
S3method(pacf, default)
S3method(plot, acf)
S3method(plot, decomposed.ts)
S3method(plot, HoltWinters)
S3method(plot, spec)
S3method(plot, stl)
S3method(plot, tskernel)
S3method(predict, ar)
S3method(predict, Arima)
S3method(predict, arima0)
S3method(predict, HoltWinters)
S3method(predict, StructTS)
S3method(print, ar)
S3method(print, Arima)
S3method(print, arima0)
S3method(print, HoltWinters)
S3method(print, stl)
S3method(print, StructTS)
S3method(print, tskernel)
S3method(residuals, HoltWinters)
S3method(summary, stl)
S3method(tsdiag, Arima)
S3method(tsdiag, arima0)
S3method(tsdiag, StructTS)
S3method(tsSmooth, StructTS)
S3method(vcov, Arima)

## from stepfun

export(as.stepfun, ecdf, is.stepfun, knots, plot.ecdf,
       plot.stepfun, stepfun, summary.stepfun)
## the examples call plot.* summary.stepfun directly ...

S3method(as.stepfun, default)
S3method(as.stepfun, isoreg)
S3method(knots, stepfun)
S3method(lines, stepfun)
S3method(plot, ecdf)
S3method(plot, stepfun)
S3method(print, ecdf)
S3method(print, summary.ecdf)
S3method(print, stepfun)
S3method(summary, ecdf)
S3method(summary, stepfun)

## Added after the merge

S3method(as.dist, default)
S3method(cophenetic, default)
S3method(cophenetic, dendrogram)
S3method(weighted.mean, Date)
S3method(weighted.mean, default)
S3method(weighted.mean, difftime)
S3method(weighted.mean, POSIXct)
S3method(weighted.mean, POSIXlt)
