useDynLib(nlme, .registration=TRUE)

importFrom("graphics", pairs, par, plot)

importFrom("stats", # many S3 generics for which we define methods
           AIC, BIC, anova, as.formula, asOneSidedFormula, coef, coefficients,
           confint,
           contr.SAS, contr.helmert, contr.poly, contr.sum, contr.treatment,
           contrasts, "contrasts<-",
           delete.response, dist, fitted, extractAIC, formula, lm, logLik,
           mad, median, model.frame, model.matrix,
           na.fail, na.omit, napredict, naresid,
           nlm, nlminb, nls, nls.control, nobs, optim,
           pchisq, pf, predict, pt,
           qchisq, qf, qnorm, qqnorm, qt, quantile,
           resid, residuals, rnorm, runif, simulate, setNames, terms,
           update, update.formula, var, vcov)

importFrom("utils", head, tail, capture.output, packageDescription)

importFrom("lattice",
           Rows, bwplot, dotplot, llines, lpoints, lsegments, ltext,
           panel.abline, panel.bwplot, panel.dotplot,  panel.grid,
           panel.histogram, panel.linejoin, panel.loess, panel.superpose,
           panel.xyplot, splom, strip.default, trellis.par.get, xyplot)

if(getRversion() >= "3.3.0") {
    if(getRversion() >= "3.5.0")
        importFrom("utils", warnErrList)
    importFrom("stats", sigma)
} else {
    export(sigma)
}

export(ACF, allCoef, asOneFormula, asTable, augPred, balancedGrouped,
       "coef<-", "coefficients<-", collapse, compareFits,
       comparePred, corAR1, corARMA, corCAR1, corCompSymm,
       corExp, corFactor, corGaus, corIdent, corLin, corMatrix,
       corNatural, corRatio, corSpatial, corSpher, corSymm,
       "covariate<-", Dim, fdHess, fixed.effects, fixef, gapply,
       getCovariate, getCovariateFormula, getData, getGroups,
       getGroupsFormula, getResponse, getResponseFormula, getVarCov,
       gls, glsControl, glsStruct, gnls, gnlsControl, gnlsStruct,
       groupedData, gsummary, Initialize, intervals, isBalanced,
       isInitialized, LDEsysMat, lme, lmeControl, lmeStruct,
       lmList, logDet, "matrix<-", Names, "Names<-", needUpdate,
       nfGroupedData, nlme, nlmeControl, nlmeStruct, nlsList,
       nmGroupedData, pdBlocked, pdCompSymm, pdConstruct, pdDiag,
       pdFactor, pdIdent, pdLogChol, pdMat, pdMatrix, pdNatural,
       pdSymm, phenoModel, pooledSD, quinModel,
       random.effects, ranef, recalc, reStruct, simulate.lme,
       splitFormula, varComb, varConstPower, VarCorr, varExp,
       varFixed, varFunc, varIdent, Variogram, varPower, varWeights)

# called directly via do.call
export(anova.lme, nlsList.formula, plot.lme)

# needed as name stored in the call via match.call
export(lme.formula, lme.lmList, lmList.formula, nlme.formula, nlme.nlsList)

# exported for package rms
export(glsApVar, glsEstimate)

S3method("[", groupedData)
S3method("[", pdBlocked)
S3method("[", pdMat)
S3method("[", reStruct)
S3method("[<-", pdMat)
S3method(ACF, gls)
S3method(ACF, lme)
S3method(anova, gls)
S3method(anova, lme)
S3method(as.data.frame, groupedData)
S3method(as.matrix, corStruct)
S3method(as.matrix, pdMat)
S3method(as.matrix, reStruct)
S3method(asTable, groupedData)
S3method(augPred, gls)
S3method(augPred, lme)
S3method(augPred, lmList)
S3method(coef, corAR1)
S3method(coef, corARMA)
S3method(coef, corCAR1)
S3method(coef, corCompSymm)
S3method(coef, corIdent)
S3method(coef, corLin)
S3method(coef, corNatural)
S3method(coef, corSpatial)
S3method(coef, corSpher)
S3method(coef, corStruct)
S3method(coef, corSymm)
S3method(coef, gls)
S3method(coef, gnls)
S3method(coef, lme)
S3method(coef, lmList)
S3method(coef, modelStruct)
S3method(coef, pdBlocked)
S3method(coef, pdCompSymm)
S3method(coef, pdDiag)
S3method(coef, pdIdent)
S3method(coef, pdMat)
S3method(coef, pdNatural)
S3method(coef, pdSymm)
S3method(coef, reStruct)
S3method(coef, summary.lme, getCTable)
S3method(coef, summary.gls, getCTable)
S3method(coef, summary.nlsList)
S3method(coef, varComb)
S3method(coef, varConstPower)
S3method(coef, varExp)
S3method(coef, varFixed)
S3method(coef, varFunc)
S3method(coef, varIdent)
S3method(coef, varPower)
S3method("coef<-", corAR1)
S3method("coef<-", corARMA)
S3method("coef<-", corCAR1)
S3method("coef<-", corCompSymm)
S3method("coef<-", corIdent)
S3method("coef<-", corNatural)
S3method("coef<-", corSpatial)
S3method("coef<-", corStruct)
S3method("coef<-", corSymm)
S3method("coef<-", modelStruct)
S3method("coef<-", pdBlocked)
S3method("coef<-", pdMat)
S3method("coef<-", reStruct)
S3method("coef<-", varComb)
S3method("coef<-", varConstPower)
S3method("coef<-", varExp)
S3method("coef<-", varFixed)
S3method("coef<-", varIdent)
S3method("coef<-", varPower)
S3method(collapse, groupedData)
S3method(comparePred, gls)
S3method(comparePred, lme)
S3method(comparePred, lmList)
S3method(confint, lme)
S3method(confint, lmList)
S3method(confint, nlsList)
S3method(corFactor, compSymm)
S3method(corFactor, corAR1)
S3method(corFactor, corARMA)
S3method(corFactor, corCAR1)
S3method(corFactor, corNatural)
S3method(corFactor, corSpatial)
S3method(corFactor, corStruct)
S3method(corFactor, corSymm)
S3method(corMatrix, corAR1)
S3method(corMatrix, corARMA)
S3method(corMatrix, corCAR1)
S3method(corMatrix, corCompSymm)
S3method(corMatrix, corIdent)
S3method(corMatrix, corNatural)
S3method(corMatrix, corSpatial)
S3method(corMatrix, corStruct)
S3method(corMatrix, corSymm)
S3method(corMatrix, pdBlocked)
S3method(corMatrix, pdCompSymm)
S3method(corMatrix, pdDiag)
S3method(corMatrix, pdIdent)
S3method(corMatrix, pdMat)
S3method(corMatrix, reStruct)
S3method("covariate<-", varFunc)
S3method(deviance, gls)
S3method(deviance, lme)
S3method(Dim, corSpatial)
S3method(Dim, corStruct)
S3method(Dim, default)
S3method(Dim, pdCompSymm)
S3method(Dim, pdDiag)
S3method(Dim, pdIdent)
S3method(Dim, pdMat)
S3method(Dim, pdNatural)
S3method(Dim, pdSymm)
S3method(extractAIC, gls)
S3method(extractAIC, lme)
S3method(fitted, gls)
S3method(fitted, glsStruct)
S3method(fitted, gnls)
S3method(fitted, gnlsStruct)
S3method(fitted, lme)
S3method(fitted, lmeStruct)
S3method(fitted, lmList)
S3method(fitted, nlmeStruct)
S3method(fixef, lme)
S3method(fixef, lmList)
S3method(formula, corStruct)
S3method(formula, gls)
S3method(formula, gnls)
S3method(formula, groupedData)
S3method(formula, lme)
S3method(formula, lmList)
S3method(formula, modelStruct)
S3method(formula, nlme)
S3method(formula, nlsList)
S3method(formula, pdBlocked)
S3method(formula, pdMat)
S3method(formula, reStruct)
S3method(formula, varComb)
S3method(formula, varFunc)
S3method(getCovariate, corSpatial)
S3method(getCovariate, corStruct)
S3method(getCovariate, data.frame)
S3method(getCovariate, varFunc)
S3method(getData, gls)
S3method(getData, gnls)
S3method(getData, lme)
S3method(getData, lmList)
S3method(getData, nlme)
S3method(getData, nls)
S3method(getGroups, corStruct)
S3method(getGroups, data.frame)
S3method(getGroups, gls)
S3method(getGroups, lme)
S3method(getGroups, lmList)
S3method(getGroups, varFunc)
S3method(getGroupsFormula, default)
S3method(getGroupsFormula, gls)
S3method(getGroupsFormula, lme)
S3method(getGroupsFormula, lmList)
S3method(getGroupsFormula, reStruct)
S3method(getResponse, data.frame)
S3method(getResponse, gls)
S3method(getResponse, lme)
S3method(getResponse, lmList)
S3method(getVarCov, gls)
S3method(getVarCov, lme)
S3method(Initialize, corAR1)
S3method(Initialize, corARMA)
S3method(Initialize, corCAR1)
S3method(Initialize, corCompSymm)
S3method(Initialize, corIdent)
S3method(Initialize, corLin)
S3method(Initialize, corNatural)
S3method(Initialize, corSpatial)
S3method(Initialize, corSpher)
S3method(Initialize, corStruct)
S3method(Initialize, corSymm)
S3method(Initialize, glsStruct)
S3method(Initialize, gnlsStruct)
S3method(Initialize, lmeStruct)
S3method(Initialize, reStruct)
S3method(Initialize, varComb)
S3method(Initialize, varConstPower)
S3method(Initialize, varExp)
S3method(Initialize, varFixed)
S3method(Initialize, varFunc)
S3method(Initialize, varIdent)
S3method(Initialize, varPower)
S3method(intervals, gls)
S3method(intervals, lme)
S3method(intervals, lmList)
S3method(isBalanced, groupedData)
S3method(isInitialized, pdBlocked)
S3method(isInitialized, pdMat)
S3method(isInitialized, reStruct)
S3method(lme, formula)
S3method(lme, groupedData)
S3method(lme, lmList)
S3method(lmList, formula)
S3method(lmList, groupedData)
S3method(logDet, corIdent)
S3method(logDet, corStruct)
S3method(logDet, pdBlocked)
S3method(logDet, pdCompSymm)
S3method(logDet, pdDiag)
S3method(logDet, pdIdent)
S3method(logDet, pdMat)
S3method(logDet, pdNatural)
S3method(logDet, pdSymm)
S3method(logDet, reStruct)
S3method(logLik, corStruct)
S3method(logLik, gls)
S3method(logLik, glsStruct)
S3method(logLik, gnls)
S3method(logLik, gnlsStruct)
S3method(logLik, lme)
S3method(logLik, lmeStruct)
S3method(logLik, lmeStructInt)
S3method(logLik, lmList)
S3method(logLik, reStruct)
S3method(logLik, varComb)
S3method(logLik, varFunc)
S3method("matrix<-", pdBlocked)
S3method("matrix<-", pdMat)
S3method("matrix<-", reStruct)
S3method(model.matrix, reStruct)
S3method(Names, formula)
S3method(Names, listForm)
S3method(Names, pdBlocked)
S3method(Names, pdMat)
S3method(Names, reStruct)
S3method("Names<-", pdBlocked)
S3method("Names<-", pdMat)
S3method("Names<-", reStruct)
S3method(needUpdate, corStruct)
S3method(needUpdate, default)
S3method(needUpdate, modelStruct)
S3method(needUpdate, reStruct)
S3method(needUpdate, varComb)
S3method(needUpdate, varIdent)
S3method(nlme, formula)
S3method(nlme, nlsList)
S3method(nlsList, formula)
S3method(nlsList, selfStart)
S3method(nobs, gls)
S3method(nobs, gnls)
S3method(nobs, lme)
S3method(pairs, compareFits)
S3method(pairs, lme)
S3method(pairs, lmList)
S3method(pdConstruct, pdBlocked)
S3method(pdConstruct, pdCompSymm)
S3method(pdConstruct, pdDiag)
S3method(pdConstruct, pdIdent)
S3method(pdConstruct, pdLogChol)
S3method(pdConstruct, pdMat)
S3method(pdConstruct, pdNatural)
S3method(pdConstruct, pdSymm)
S3method(pdFactor, pdBlocked)
S3method(pdFactor, pdCompSymm)
S3method(pdFactor, pdDiag)
S3method(pdFactor, pdIdent)
S3method(pdFactor, pdLogChol)
S3method(pdFactor, pdMat)
S3method(pdFactor, pdNatural)
S3method(pdFactor, pdSymm)
S3method(pdFactor, reStruct)
S3method(pdMatrix, pdBlocked)
S3method(pdMatrix, pdCompSymm)
S3method(pdMatrix, pdDiag)
S3method(pdMatrix, pdIdent)
S3method(pdMatrix, pdMat)
S3method(pdMatrix, pdNatural)
S3method(pdMatrix, pdSymm)
S3method(pdMatrix, reStruct)
S3method(plot, ACF)
S3method(plot, augPred)
S3method(plot, compareFits)
S3method(plot, gls)
S3method(plot, intervals.lmList)
S3method(plot, lme)
S3method(plot, lmList)
S3method(plot, nffGroupedData)
S3method(plot, nfnGroupedData)
S3method(plot, nls)
S3method(plot, nmGroupedData)
S3method(plot, pdMat)
S3method(plot, ranef.lme)
S3method(plot, ranef.lmList)
S3method(plot, simulate.lme)
S3method(plot, Variogram)
S3method(predict, gls)
S3method(predict, gnls)
S3method(predict, lme)
S3method(predict, lmList)
S3method(predict, nlme)
S3method(print, anova.lme)
S3method(print, compareFits)
S3method(print, corNatural)
S3method(print, correlation)
S3method(print, corStruct)
S3method(print, corSymm)
S3method(print, gls)
S3method(print, groupedData)
S3method(print, intervals.gls)
S3method(print, intervals.lme)
S3method(print, intervals.lmList)
S3method(print, lme)
S3method(print, lmList)
S3method(print, modelStruct)
S3method(print, pdMat)
S3method(print, ranef.lme)
S3method(print, reStruct)
S3method(print, simulate.lme)
S3method(print, summary.corNatural)
S3method(print, summary.corStruct)
S3method(print, summary.corSymm)
S3method(print, summary.gls)
S3method(print, summary.lme)
S3method(print, summary.lmList)
S3method(print, summary.modelStruct)
S3method(print, summary.pdMat)
S3method(print, summary.varComb)
S3method(print, summary.varFixed)
S3method(print, summary.varFunc)
S3method(print, varComb)
S3method(print, VarCorr.lme)
S3method(print, VarCov)
S3method(print, varFunc)
S3method(qqnorm, gls)
S3method(qqnorm, lm)
S3method(qqnorm, lme)
S3method(qqnorm, lmList)
S3method(qqnorm, nls)
S3method(ranef, lme)
S3method(ranef, lmList)
S3method(recalc, corAR1)
S3method(recalc, corARMA)
S3method(recalc, corCAR1)
S3method(recalc, corCompSymm)
S3method(recalc, corIdent)
S3method(recalc, corNatural)
S3method(recalc, corSpatial)
S3method(recalc, corStruct)
S3method(recalc, corSymm)
S3method(recalc, modelStruct)
S3method(recalc, reStruct)
S3method(recalc, varFunc)
S3method(recalc, varIdent)
S3method(residuals, gls)
S3method(residuals, glsStruct)
S3method(residuals, gnls)
S3method(residuals, gnlsStruct)
S3method(residuals, lme)
S3method(residuals, lmeStruct)
S3method(residuals, lmList)
S3method(residuals, nlmeStruct)
S3method(sigma, gls)
S3method(sigma, lme)
S3method(sigma, lmList)
S3method(simulate, lme)
S3method(solve, pdBlocked)
S3method(solve, pdDiag)
S3method(solve, pdIdent)
S3method(solve, pdLogChol)
S3method(solve, pdMat)
S3method(solve, pdNatural)
S3method(solve, pdSymm)
S3method(solve, reStruct)
S3method(summary, corAR1)
S3method(summary, corARMA)
S3method(summary, corCAR1)
S3method(summary, corCompSymm)
S3method(summary, corExp)
S3method(summary, corGaus)
S3method(summary, corIdent)
S3method(summary, corLin)
S3method(summary, corNatural)
S3method(summary, corRatio)
S3method(summary, corSpher)
S3method(summary, corStruct)
S3method(summary, corSymm)
S3method(summary, gls)
S3method(summary, lme)
S3method(summary, lmList)
S3method(summary, modelStruct)
S3method(summary, nlsList)
S3method(summary, pdBlocked)
S3method(summary, pdCompSymm)
S3method(summary, pdDiag)
S3method(summary, pdIdent)
S3method(summary, pdLogChol)
S3method(summary, pdMat)
S3method(summary, pdNatural)
S3method(summary, pdSymm)
S3method(summary, reStruct)
S3method(summary, varComb)
S3method(summary, varConstPower)
S3method(summary, varExp)
S3method(summary, varFixed)
S3method(summary, varFunc)
S3method(summary, varIdent)
S3method(summary, varPower)
S3method(terms, gls)
S3method(update, corStruct)
S3method(update, gls)
S3method(update, gnls)
S3method(update, groupedData)
S3method(update, lme)
S3method(update, lmList)
S3method(update, modelStruct)
S3method(update, nlme)
S3method(update, nlsList)
S3method(update, reStruct)
S3method(update, varComb)
S3method(update, varConstPower)
S3method(update, varExp)
S3method(update, varFunc)
S3method(update, varPower)
S3method(VarCorr, lme)
S3method(VarCorr, pdBlocked)
S3method(VarCorr, pdMat)
S3method(Variogram, corExp)
S3method(Variogram, corGaus)
S3method(Variogram, corLin)
S3method(Variogram, corRatio)
S3method(Variogram, corSpatial)
S3method(Variogram, corSpher)
S3method(Variogram, default)
S3method(Variogram, gls)
S3method(Variogram, lme)
S3method(varWeights, glsStruct)
S3method(varWeights, lmeStruct)
S3method(varWeights, varComb)
S3method(varWeights, varFunc)
S3method(vcov, gls)
S3method(vcov, lme)
