1useDynLib(robustbase, .registration=TRUE)
2
3if(FALSE) {##MM
4    stopifnot(require(codetoolsBioC), require(robustbase))
5    findExternalDeps("robustbase")
6}
7importFrom("grDevices", dev.interactive, extendrange)
8importFrom("graphics",
9           abline, axis,
10           box, legend, lines, matplot, mtext,
11           panel.smooth, par, plot, points, strheight, text, title)
12importFrom("stats",
13           aggregate, alias, as.formula, binomial,
14           coef, cor, cov, cov.wt, cov2cor, delete.response, deviance, dnorm, dpois,
15           family, fitted, fivenum, formula,
16           gaussian, glm, glm.fit, hatvalues,
17           integrate, is.empty.model, lm.fit, lm.wfit,
18           mad, mahalanobis, median, model.frame, model.matrix, model.matrix.lm,
19           model.offset, model.response, model.weights,
20           na.fail, na.omit, na.pass, napredict, naprint, naresid,
21           nlminb, nls, nls.control, nobs,
22           optim, optimize, pbinom, pchisq, pf, pgamma, pnorm, poisson, ppois,
23           predict, printCoefmat, pt,
24           qchisq, qnorm, qpois, qqline, qqnorm, qt, quantile,
25           resid, residuals, residuals.lm, setNames, splinefun, symnum,
26           terms, uniroot, var, vcov, weights, .checkMFClasses, .getXlevels,
27
28           ## S3 generics (*not* shown yet by  findExternalDeps() above):
29           anova, case.names, confint,
30           dummy.coef, logLik, profile, variable.names
31           )
32
33
34## ^^^^ MASS has a bit more; take it as example
35if(getRversion() >= "3.1.0")
36importFrom("stats", .lm.fit, confint.lm, dummy.coef.lm)
37if(getRversion() >= "3.3.0") {
38    importFrom("stats", sigma)
39} else {
40    export(sigma)
41    S3method(sigma, nls)
42}
43
44importFrom("utils", globalVariables, str)
45
46## MASS has many rlm S3 methods; should we use some of them - for rnls() ?!
47## we also currently use MASS::cov.rob(); but probably only temporarily
48importFrom("methods", is, new, setClass, setMethod, slot, "slot<-",
49	   ## needed, e.g. for 'robustlmm' to work w/o warning:
50	   as, "as<-", coerce, "coerce<-")
51
52importFrom("DEoptimR", JDEoptim)
53
54## Functions defined in this package
55export(Sn, Qn, Qn.old,
56       s_Sn, s_Qn, s_mad, s_IQR,
57
58       summarizeRobWeights,
59       wgt.himedian,
60
61       h.alpha.n,
62       covMcd, .MCDcons, .MCDcnp2, .MCDcnp2.rew, .MCDsingularityMsg,
63       robMD, mahalanobisD, # <- still "internal"
64       ltsReg,
65       tolEllipsePlot,
66       ## RENAME ?!? :
67       covPlot, ltsPlot,
68       ## NO! ddplot, distplot, chi2qqplot
69       rrcov.control,##  << RENAME --- FIXME
70       huberM,
71       colMedians, rowMedians,
72       covOGK, covGK, hard.rejection, scaleTau2,
73       covComed,
74       ## comedian, COM, -- not yet
75       smoothWgt, .wgtFUN.covMcd, .wgtFUN.covComed,
76       psiFunc, huberPsi, hampelPsi,
77## Not yet:
78##     tukeyPsi, # = biweight / bisquare
79       tukeyChi, tukeyPsi1, # TODO deprecate: see ./TODO
80       Mpsi, Mchi, Mwgt, MrhoInf, .Mpsi, .Mchi, .Mwgt, .MrhoInf,
81       .Mwgt.psi1,
82       .Mchi.tuning.default,  .Mpsi.tuning.default, .regularize.Mpsi,
83       .Mchi.tuning.defaults, .Mpsi.tuning.defaults,
84       .psi2ipsi, .psi.const, .psi.ggw.findc, .psi.lqq.findc,
85
86       lmrob, lmrob.fit,
87       lmrob.fit.MM, lmrob..M..fit, lmrob..D..fit,
88       lmrob.S, lmrob.lar, lmrob.M.S,
89       lmrob.control,
90       .lmrob.hat, # was lmrob.leverages()
91       splitFrame,
92       outlierStats,
93
94       mc, # Mia Hubers's medcouple
95       adjbox,
96       adjboxStats,
97       adjOutlyingness,
98       fullRank,
99       glmrob,
100       nlrob, nlrob.control
101       , glmrobMqle.control, glmrobBY.control, glmrobMT.control
102       , BYlogreg ## R/BYlogreg.R FIXME: add to glmrob() and "deprecate"
103       ## , glmrobMT ## R/MTestimador2.R
104       , estimethod
105       ## related to detMCD() and to be used in rrcov etc:
106       , r6pack, doScale
107       , rankMM, classPC, .signflip
108       )
109
110
111## S3 methods for ``our own'' S3 generics:
112S3method(ltsReg, default)
113S3method(ltsReg, formula)
114
115S3method(adjbox, default)
116S3method(adjbox, formula)
117
118
119## Register all the methods for S3 generics elsewhere
120## in case namespace is loaded but not currently attached.
121
122S3method(anova, lmrob)
123S3method(anova, glmrob)
124
125S3method(alias, lmrob)
126S3method(case.names, lmrob)
127S3method(confint, lmrob)
128S3method(confint, nlrob)
129S3method(dummy.coef, lmrob)
130S3method(estimethod, nlrob)
131S3method(family, lmrob)
132S3method(hatvalues, lmrob)
133S3method(kappa, lmrob)
134S3method(labels, lmrob)
135S3method(model.matrix, lmrob)
136S3method(nobs, lmrob)
137S3method(nobs, lmrob.S, nobs.lmrob)# use the same as "lmrob"
138S3method(nobs, mcd)
139S3method(residuals, lmrob)
140S3method(variable.names, lmrob)
141S3method(weights, glmrob)
142S3method(weights, lmrob)
143S3method(weights, lmrob.S, weights.lmrob)# use the same as "lmrob"
144S3method(weights, nlrob, weights.lmrob)# use the same as "lmrob"
145
146S3method(formula, nlrob)
147S3method(fitted, nlrob)
148S3method(plot, lts)
149S3method(plot, mcd)
150S3method(plot, lmrob)
151S3method(predict, lmrob)
152S3method(predict, glmrob)
153S3method(predict, nlrob)
154
155S3method(print, glmrob)
156S3method(print, lts)
157S3method(print, mcd)
158S3method(print, nlrob)
159S3method(print, lmrob)
160S3method(print, lmrob.S)
161S3method(print, summary.glmrob)
162S3method(print, summary.lmrob)
163S3method(print, summary.nlrob)
164S3method(print, summary.lts)
165
166S3method(qr, lmrob)
167## lmrob uses residuals.default
168S3method(residuals, nlrob)
169S3method(residuals, glmrob)
170
171S3method(summary, glmrob)
172S3method(summary, lmrob)
173S3method(summary, lts)
174S3method(summary, mcd)
175S3method(summary, nlrob)
176
177S3method(sigma, lmrob)
178S3method(sigma, nlrob)
179S3method(vcov, glmrob)
180S3method(vcov, lmrob)
181S3method(vcov, nlrob)
182S3method(print, summary.mcd)
183
184## S4 Generics {only those defined in this package}:
185export(
186       chgDefaults
187       )
188
189exportClasses(
190              "functionX",   # function(x, <tune_par>): VECTORIZED in 'x'
191              "functionXal", # a functional: function of tuning par.s only
192              "psi_func"     # containing  rho(), psi(), psi'(), ...
193              )
194
195exportMethods(
196              chgDefaults,
197              plot
198              )
199
200