robust/0000755000176000001440000000000013601152344011617 5ustar ripleyusersrobust/NAMESPACE0000644000176000001440000001013413067033552013042 0ustar ripleyusers### Import from other Packages --------------------------------------------- importFrom("graphics", legend, lines, par, plot, polygon, strheight, strwidth, text) importFrom("stats", anova, as.formula, binomial, coef, delete.response, deviance, dgamma, dlnorm, dnorm, drop.scope, dweibull, factor.scope, fitted, formula, glm.fit, hatvalues, lm, lsfit, mad, mahalanobis, median, model.extract, model.frame, model.matrix, na.fail, napredict, naprint, nlm, pchisq, pgamma, pnorm, printCoefmat, pt, pweibull, qchisq, qgamma, qnorm, quantile, qweibull, resid, residuals, rnorm, runif, stat.anova, terms, uniroot, update, update.formula, var, weighted.mean) importFrom("utils", menu) importFrom("lattice", histogram, panel.abline, panel.histogram, panel.mathdensity, panel.text, panel.xyplot, prepanel.default.histogram, simpleKey, strip.default, xyplot) importFrom("MASS", fitdistr, lmsreg) importFrom("robustbase", covMcd, rrcov.control) importFrom("fit.models", fit.models, fmclass.register, fmclass.add.class, plot.glmfm, designMD) importFrom("rrcov", CovControlOgk, covMest, CovOgk, CovSde, getCenter, getCov, getDistance) ### Export Functions and Methods ------------------------------------------- export( ## lmRob ## lmRob, lmRob.fit, lmRob.wfit, lmRob.fit.compute, lmRob.control, summary.lmRob, plot.lmRob, drop1.lmRob, step.lmRob, anova.lmRob, anova.lmRoblist, predict.lmRob, rb.lmRob, lmRob.RFPE, test.lmRob, lsRobTest, update.lmRob, psi.weight, rho.weight, psp.weight, chi.weight, ## glmRob ## glmRob, glmRob.control, glmRob.cubif, glmRob.cubif.control, glmRob.misclass, glmRob.misclass.control, glmRob.mallows, glmRob.mallows.control, summary.glmRob, plot.glmRob, anova.glmRob, anova.glmRoblist, predict.glmRob, residuals.glmRob, # covRob / covClassic covRob, covRob.control, summary.covRob, plot.covRob, covClassic, summary.covClassic, plot.covClassic, # Covariance Comparison summary.covfm, plot.covfm, ddPlot.covfm, ellipsesPlot.covfm, screePlot.covfm, distancePlot.covfm, ## Robust univariate parameter estimation ## fitdstnRob, fitdstn, gammaRob, gammaRob.control, lognormRob, lognormRob.control, weibullRob, weibullRob.control, #Robust univariate parameter estimation plot.fdfm, overlaidDenPlot.fdfm, qqPlot.fdfm, ## Other ## gen.data ) ## S3 methods for lmRob ## S3method(anova, lmRob) S3method(drop1, lmRob) S3method(labels, lmRob) S3method(plot, lmRob) S3method(predict, lmRob) S3method(summary, lmRob) S3method(update, lmRob) S3method(designMD, lmRob) S3method(residuals, lmRob) S3method(model.matrix, lmRob) S3method(model.frame, lmRob) S3method(print, lmRob) S3method(print, summary.lmRob) S3method(print, lsRobTest) ## S3 methods for glmRob ## S3method(anova, glmRob) S3method(print, glmRob) S3method(summary, glmRob) S3method(labels, glmRob) S3method(predict, glmRob) S3method(designMD, glmRob) S3method(residuals, glmRob) S3method(model.matrix, glmRob) S3method(model.frame, glmRob) S3method(print, glmRob) importFrom(stats, family) S3method(family, glmRob) S3method(plot, glmRob) S3method(print, summary.glmRob) ## S3 methods for covRob/covClassic ## S3method(print, covRob) S3method(summary, covRob) S3method(plot, covRob) S3method(print, covClassic) S3method(summary, covClassic) S3method(plot, covClassic) S3method(print, summary.covRob) S3method(print, summary.covClassic) ## S3 methods for fitdstnRob ## S3method(print, fitdstn) S3method(summary, fitdstn) S3method(plot, fitdstn) ## S3 methods for fit.models ## S3method(plot, covfm) S3method(print, covfm) S3method(summary, covfm) S3method(print, summary.covfm) S3method(print, fdfm) S3method(summary, fdfm) S3method(plot, fdfm) ## S3 methods for [g]lmRoblist ## S3method(anova,glmRoblist) S3method(anova, lmRoblist) ## S3 methods for other packages ## S3method(designMD, rlm) S3method(designMD, lmrob) S3method(designMD, glmrob) robust/README0000644000176000001440000000160513044465224012506 0ustar ripleyusersThis package contains the Robust Library version 0.4 Contributors: Jeff Wang Ruben Zamar Alfio Marazzi Victor Yohai Matias Salibian-Barrera Ricardo Maronna Eric Zivot David Rocke Doug Martin Kjell Konis --------------- This package contains the following robust methods: Robust Covariance estimation (scatter and location) Robust Linear Regression Robust Generalized Linear Models Robust Gamma, Weibull, and lognormal parameter estimation A method for side-by-side comparison of robust and classical models is also provided. Please see Robust.pdf for further details. To do: (port from S-Plus to R) #Robust ANOVA #Robust Principal Component Analysis robust/data/0000755000176000001440000000000013100224217012521 5ustar ripleyusersrobust/data/woodmod.dat.txt.gz0000644000176000001440000000042513100224217016121 0ustar ripleyusersEq@Cp7 Iz`Ih^׏lP>yy>Q{J/! 15o9Dh4\#4Km謼ß!W.8q]uH-ok\rubV)΀l&DkK }h͉#;'>֌0phǜ~ $+JZӡ&P^Z;,yClc&%Y(׀robust/data/stack.dat.txt.gz0000644000176000001440000000025413100224217015556 0ustar ripleyusersMA 01rLff)+k]J+x}3=>cӲ0q->l/y?qz`$`CnfuN@ !1t3iP-kG$n.WvzrBOբ0$sc6 |Bg|WM\sgt9#robust/data/leuk.dat.txt.gz0000644000176000001440000000020513100224217015405 0ustar ripleyusers]K 5qrT،kx;: ШQwǹ )ϩisvh@8jڻ-_A@/- TCҞl+U6>}Orobust/data/breslow.dat.txt.gz0000644000176000001440000000211113100224217016120 0ustar ripleyusersmVˎF 6b\'+7D%^o qiDD6AlmJ4[sS R90d'vٲdžǜ)|u9c3|N?ؔo텖|WVCn{/xal^> /ʼnǝfˆVFEZiǖ-k|;g/ʛinиViDji4N)[6=Dl|v Vx[Sv%f5X-sxvk LAa/cMc%k-k70_PN KņM5$OֿiUNV%'9h|Y<  75bno0Z4jUJ%.Ƿ_?!NeIvթexԄm 3 &$*p&Q[G gyxNYgE@Wc@r4#8'zze#l:˥0^Õ+ vkZbp!vj{B޲oL2q&Q;Z܄}:ϥ}(IL >4P>h3@#747[CYq* #]N\U/;7S^g!BM!;o#K7ޙ]^UȟƵFɩ?; robust/data/mallows.dat.txt.gz0000644000176000001440000000366013100224217016133 0ustar ripleyusers=IG D:GL&>oY%jP90ߟ_??cgvY]S_ k~#>Hϕrj':>{z-_sm>jΪo8։K/zgUZYsV9\qžgq>]ӑe&۹wQb?]F%CjL=3-Jvo^qb9mVz*{ҬPA |-ibVj0eu Aye:j;"r27i^,>59Sq- *Ӡ!S 1Кu333@$Iɂ:zf>=9i:Gft`2 E_lq? ǣȡ;h>opzWrobust/man/0000755000176000001440000000000013601150636012374 5ustar ripleyusersrobust/man/summary.lmRob.Rd0000644000176000001440000000327313044465224015442 0ustar ripleyusers\name{summary.lmRob} \alias{summary.lmRob} \title{Summarizing Robust Linear Model Fits} \description{ Compute a summary of the robustly fitted linear model. } \usage{ \method{summary}{lmRob}(object, correlation = FALSE, bootstrap.se = FALSE, ...) } \arguments{ \item{object}{an lmRob object.} \item{correlation}{a logical value. If \code{TRUE} then the correlation matrix of the coefficients is included in the summary.} \item{bootstrap.se}{a logical value. If \code{TRUE} then bootstrap standard error estimates are included in the summary.} \item{...}{additional arguments required by the generic \code{\link{summary}} function.} } \value{ The summary is returned in a list of class summary.lmRob and contains the following components: \item{sigma}{a single numeric value containing the residual scale estimate.} \item{df}{a numeric vector of length 3 containing integer values: the rank of the model matrix, the residual degrees of freedom, and the number of coefficients in the model.} \item{cov.unscaled}{the unscaled covariance matrix; i.e, the matrix that, when multiplied by the estimate of the error variance, yields the estimated covariance matrix for the coefficients.} \item{correlation}{the correlation coefficient matrix for the coefficients in the model.} \item{...}{the remaining components are the same as the corresponding components in an \code{lmRob} object. Use the \code{\link{names}} function to obtain a list of the components.} } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) stack.sum <- summary(stack.rob) stack.sum stack.bse <- summary(stack.rob, bootstrap.se = TRUE) stack.bse } \keyword{methods} \keyword{robust} \keyword{regression} robust/man/mallows.dat.Rd0000644000176000001440000000105113044465224015110 0ustar ripleyusers\name{mallows.dat} \alias{mallows.dat} \docType{data} \title{Mallows Data} \description{ An exmaple data set for the mallows fitter in glmRob. } \usage{data(mallows.dat)} \format{ A data frame with 70 observations on the following 4 variables. \describe{ \item{\code{y}}{a numeric vector.} \item{\code{a}}{a numeric vector.} \item{\code{b}}{a numeric vector.} \item{\code{c}}{a numeric vector.} } } \source{ Don't know - if you know please email the package maintainer. } \examples{ data(mallows.dat) } \keyword{datasets} robust/man/update.lmRob.Rd0000644000176000001440000000261413044465224015225 0ustar ripleyusers\name{update.lmRob} \alias{update.lmRob} \title{Update an lmRob Model Object} \description{ A method for the generic \code{\link{update}} function for objects inheriting from class \code{lmRob}. See \code{\link{update}} for the general behavior of this function and for the interpretation of the arguments. } \usage{ \method{update}{lmRob}(object, formula., \dots, evaluate = TRUE) } \arguments{ \item{object}{an lmRob object.} \item{formula.}{a modeling formula, such as \code{y ~ a + b}. A single dot \code{.} on either side of the \code{~} gets replaced by the left or right side of the formula in \code{object}. The dot on the left can be omitted. By default, it refits object using the same formula as in \code{object}.} \item{evaluate}{a logical value. If \code{TRUE} the updated call is evaluated and returned. Otherwise the unevaluated call is returned.} \item{\dots}{additional arguments passed to the generic update function.} } \value{ either a new updated object, or else an unevaluated expression for creating such an object. } \details{ If \code{formula.} is missing, \code{update.lmRob} alternates between the initial estimates and final estimates. Otherwise (when \code{formula.} is present), \code{update.lmRob} functions just like \code{update.default}. } \seealso{ \code{\link{lmRob}}. \code{\link{update}}. } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/gen.data.Rd0000644000176000001440000000174713044465224014360 0ustar ripleyusers\name{gen.data} \alias{gen.data} \title{Generate Data With Contamination} \description{ Generates a random dataset with some amount of contaimination. } \usage{ gen.data(coeff, n = 100, eps = 0.1, sig = 3, snr = 1/20, seed = 837) } \arguments{ \item{coeff}{a numeric vector of length 3 containing the true coefficients.} \item{n}{a positive integer giving the number of observations in the data set.} \item{eps}{a numeric value between 0 and 0.5 specifying the fraction of contamination.} \item{sig}{a positive numeric value giving the standard deviation of the uncontaminated data.} \item{snr}{a positive numeic value giving the signal to noise ratio, well not really.} \item{seed}{an integer value giving the seed for the random number generator.} } \value{ a data frame with \code{n} rows and 4 columns. The regressors are generated as: \code{rnorm(n,1)}, \code{rnorm(n,1)^3}, \code{exp(rnorm(n,1))}. It also generates an unused vector \code{x4}. } \keyword{utilities} robust/man/lmRob.fit.Rd0000644000176000001440000000220413044465224014520 0ustar ripleyusers\name{lmRob.fit} \alias{lmRob.fit} \alias{lmRob.wfit} \title{Robust Fitter Functions for Linear Models} \description{ These are the basic computing engines called by \code{lmRob} used to robustly fit linear models. These functions are not intended to be used directly. } \usage{ lmRob.fit(x, y, x1.idx = NULL, nrep = NULL, robust.control = NULL, ...) lmRob.wfit(x, y, w, x1.idx = NULL, nrep = NULL, robust.control = NULL, ...) } \arguments{ \item{x}{a numeric matrix containing the design matrix.} \item{y}{a numeric vector containing the linear model response.} \item{w}{a numeric vector containing the weights.} \item{x1.idx}{a numeric vector containing the indices of columns of the design matrix arising from the coding of factor variables.} \item{nrep}{the number of random subsamples to be drawn. If \code{"Exhaustive"} resampling is being used, the value of \code{nrep} is ignored.} \item{robust.control}{a list of control parameters to be used in the numerical algorithms. See \code{lmRob.control} for the possible control parameters and their default settings.} \item{\dots}{additional arguments.} } \keyword{robust} robust/man/lmRob.control.Rd0000644000176000001440000000557013044465224015427 0ustar ripleyusers\name{lmRob.control} \alias{lmRob.control} \title{ Control Parameters for Robust Linear Regression } \description{ Allows the users to set values affecting the estimation procedure for robust regression in \code{lmRob}. } \usage{ lmRob.control(tlo = 1e-4, tua = 1.5e-06, mxr = 50, mxf = 50, mxs = 50, tl = 1e-06, estim = "Final", initial.alg = "Auto", final.alg = "MM", seed = 1313, level = 0.1, efficiency = 0.9, weight = c("Optimal", "Optimal"), trace = TRUE) } \arguments{ \item{tlo}{ the relative tolerance in the iterative algorithms. } \item{tua}{ the tolerance used for the determination of pseudo-rank. } \item{mxr}{ the maximum number of iterations in the refinement step. } \item{mxf}{ the maximum number of iterations for computing final coefficient estimates. } \item{mxs}{ the maximum number of iterations for computing scale estimate. } \item{tl}{ the tolerance for scale denominators. If a scale estimate becomes less than \code{tl}, the scale estimate is set equal to \code{tl}. } \item{estim}{ parameter that determines the type of estimator to be computed. If \code{estim="Initial"}, only the initial estimates are computed; if \code{estim="Final"}, then final estimates are returned. } \item{initial.alg}{ parameter that determines the algorithm for initial estimates. Valid choices are \code{"Auto"} for data-dependent algorithm, \code{"Random"} for random resampling, \code{"Exhaustive"} for exhaustive resampling, \code{"Fast"} for fast procedure, and \code{"Genetic"} for genetic algorithm. By default, \code{lmRob} uses \code{"Auto"}. } \item{final.alg}{ parameter that determines the type of the final estimates. Valid choices are \code{"Adaptive"} for the robust efficient weighted least squares as proposed in Gervini and Yohai (1999), and \code{"MM"} for MM-estimate as proposed in Yohai, Stahel and Zamar (1991). By default, \code{lmRob} uses \code{"MM"}. } \item{seed}{ seed parameter used in the random sampling and genetic algorithm for the computation of initial estimates. } \item{weight}{ a character vector that determines the type of loss functions to be used. The first determines the loss function used for the initial estimates, and the second determines the loss function used for the final M-estimates. Valid choices are \code{"Optimal"} and \code{"Bisquare"}. } \item{level}{ the level of significance of the test for bias of the final MM-estimates, if desired later on. } \item{efficiency}{ the asymptotic efficiency of the final estimate. } \item{trace}{ a logical flag: if \code{TRUE}, the remaining computing time will be printed. } } \value{ a list containing the values used for each of the control parameters. } \seealso{ \code{\link{lmRob}}. } \examples{ data(stack.dat) my.control <- lmRob.control(weight=c("Bisquare","Optimal")) stack.bo <- lmRob(Loss ~ ., data = stack.dat, control = my.control) } \keyword{robust} \keyword{regression} robust/man/fitdstn.Rd0000644000176000001440000000327713044465224014352 0ustar ripleyusers\name{fitdstn} \alias{fitdstn} \title{Maximum-likelihood Fitting of Univariate Distributions} \description{ Maximum-likelihood fitting of univariate distributions. } \usage{ fitdstn(x, densfun, \dots) } \arguments{ \item{x}{a numeric vector containing the sample.} \item{densfun}{a character string naming the distribution. Distributions \sQuote{gamma}, \sQuote{lognormal}, and \sQuote{weibull} are supported.} \item{\dots}{additional arguments are ignored.} } \details{ This function relies on the \code{\link[MASS]{fitdistr}} function for the computations. The returned object is modified to support plotting and comparison. } \value{ a list with class \dQuote{fitdstn} containing the following elements: \item{estimate}{a named numeric vector containing the parameter estimates.} \item{sd}{a named numeric vector containing the standard deviations of the parameter estimates.} \item{vcov}{a numeric matrix containing the variance-covariance matrix of the estimated parameter vector.} \item{n}{a single numeric value indicating the number of sample points in \code{x}.} \item{loglik}{a single numeric value giving the maxized the log-likelihood.} \item{call}{the matched call.} \item{densfun}{the character string \code{densfun} provided in the arguments.} \item{x}{the data provided in \code{x}.} } \note{ The \code{print} method displays the estimated parameters and their standard errors (in parentheses). } \seealso{ An important goal here is the comparison with \emph{robust} fits to the same distributions, see \code{\link{fitdstnRob}}. \code{\link[MASS]{fitdistr}} which provides many more choices for \code{densfun}. } \keyword{maximum-likelihood} robust/man/residuals.glmRob.Rd0000644000176000001440000000077013044465224016106 0ustar ripleyusers\name{residuals.glmRob} \alias{residuals.glmRob} \title{Residuals Methods for glmRob Objects} \description{ Residuals methods for \code{glmRob} objects. } \usage{ \method{residuals}{glmRob}(object, type = c("deviance", "pearson", "working", "response"), ...) } \arguments{ \item{object}{a \code{glmRob} object.} \item{type}{the type of residuals to be returned.} \item{\dots}{additional arguments are ignored.} } \value{ a numeric vector containing the residuals. } \keyword{robust} robust/man/gammaRob.control.Rd0000644000176000001440000000075013044465224016074 0ustar ripleyusers\name{gammaRob.control} \alias{gammaRob.control} \title{Control Parameters for gammaRob} \description{ Create a list of control parameters for the \code{gammaRob} function. } \usage{ gammaRob.control(estim, \dots) } \arguments{ \item{estim}{a character string specifying the estimator.} \item{\dots}{control parameters appropriate for the estimator given in \code{estim}.} } \value{ a list of control parameters appropriate for the specified estimator. } \keyword{robust} robust/man/covRob.control.Rd0000644000176000001440000000276713044465224015613 0ustar ripleyusers\name{covRob.control} \alias{covRob.control} \title{ Control Parameters for Robust Covariance Estimation } \description{ This function is used to create a list of control parameters for the underlying robust estimator used in the \code{covRob} function. } \usage{ covRob.control(estim, ...) } \arguments{ \item{estim}{a character vector of length one giving the name of the estimator to generate the control parameters for.} \item{\dots}{control parameters appropriate for the robust estimator specified in \code{estim} in the form \code{name = value} and separated by commas. Omitted parameters receive their default values.} } \value{ a list of control parameters appropriate for the robust estimator given in \code{estim}. The value of \code{estim} occupies the first element of the list.} \details{ The control parameters are estimator specific. Information on the control parameters (and their default values) can be found in the help files of each of the robust covariance estimators. } \seealso{ This function is a utility function for \code{\link{covRob}}.
The underlying robust estimators are: \code{\link[rrcov]{CovSde}}, \code{\link[robustbase]{covMcd}} and \code{\link[rrcov]{CovOgk}}. Power-users should consider calling these functions directly. } \examples{ mcd.control <- covRob.control("mcd", quan = 0.75, ntrial = 1000) ds.control <- covRob.control("donostah", prob = 0.95) qc.control <- covRob.control("pairwiseqc") } %\keyword{librobust} \keyword{utilities} robust/man/covRob.Rd0000644000176000001440000001426013044465224014123 0ustar ripleyusers\name{covRob} \alias{covRob} \title{ Robust Covariance/Correlation Matrix Estimation } \description{ Compute robust estimates of multivariate location and scatter. } \usage{ covRob(data, corr = FALSE, distance = TRUE, na.action = na.fail, estim = "auto", control = covRob.control(estim, ...), ...) } \arguments{ \item{data}{a numeric matrix or data frame containing the data.} \item{corr}{a logical flag. If \code{corr = TRUE} then the estimated correlation matrix is computed.} \item{distance}{a logical flag. If \code{distance = TRUE} the squared Mahalanobis distances are computed.} \item{na.action}{a function to filter missing data. The default \code{na.fail} produces an error if missing values are present. An alternative is \code{na.omit} which deletes observations that contain one or more missing values.} \item{estim}{a character string specifying the robust estimator to be used. The choices are: "mcd" for the Fast MCD algorithm of Rousseeuw and Van Driessen, "weighted" for the Reweighted MCD, "donostah" for the Donoho-Stahel projection based estimator, "M" for the constrained M estimator provided by Rocke, "pairwiseQC" for the orthogonalized quadrant correlation pairwise estimator, and "pairwiseGK" for the Orthogonalized Gnanadesikan-Kettenring pairwise estimator. The default "auto" selects from "donostah", "mcd", and "pairwiseQC" with the goal of producing a good estimate in a reasonable amount of time.} \item{control}{a list of control parameters to be used in the numerical algorithms. See \code{covRob.control} for the possible control parameters and their default settings. This argument is ignored when \code{estim = "auto"}.} \item{\dots}{control parameters may be passed directly when \code{estim != "auto"}.} } \details{ The \code{covRob} function selects a robust covariance estimator that is likely to provide a \emph{good} estimate in a reasonable amount of time. Presently this selection is based on the problem size. The Donoho-Stahel estimator is used if there are less than 1000 observations and less than 10 variables or less than 5000 observations and less than 5 variables. If there are less than 50000 observations and less than 20 variables then the MCD is used. For larger problems, the Orthogonalized Quadrant Correlation estimator is used. The MCD and Reweighted-MCD estimates (\code{estim = "mcd"} and \code{estim = "weighted"} respectively) are computed using the \code{\link[robustbase]{covMcd}} function in the robustbase package. By default, \code{\link[robustbase]{covMcd}} returns the reweighted estimate; the actual MCD estimate is contained in the components of the output list prefixed with \code{raw}. The M estimate (\code{estim = "M"}) is computed using the \code{\link[rrcov]{covMest}} function in the rrcov package. For historical reasons the Robust Library uses the MCD to compute the initial estimate. The Donoho-Stahel (\code{estim = "donostah"}) estimator is computed using the \code{\link[rrcov]{CovSde}} function provided in the rrcov package. The pairwise estimators (\code{estim = "pairwisegk"} and \code{estim = "pairwiseqc"}) are computed using the \code{\link[rrcov]{CovOgk}} function in the rrcov package. } \value{ an object of class "\code{covRob}" with components: \item{call}{an image of the call that produced the object with all the arguments named.} \item{cov}{a numeric matrix containing the final robust estimate of the covariance/correlation matrix.} \item{center}{a numeric vector containing the final robust estimate of the location vector.} \item{dist}{a numeric vector containing the squared Mahalanobis distances computed using robust estimates of covariance and location contained in \code{cov} and \code{center}. If \code{distance = FALSE} this element will me missing.} \item{raw.cov}{a numeric matrix containing the initial robust estimate of the covariance/correlation matrix. If there is no initial robust estimate then this element is set to \code{NA}.} \item{raw.center}{a numeric vector containing the initial robust estimate of the location vector. If there is no initial robust estimate then this element is set to \code{NA}.} \item{raw.dist}{a numeric vector containing the squared Mahalanobis distances computed using the initial robust estimates of covariance and location contained in \code{raw.cov} and \code{raw.center}. If \code{distance = FALSE} or if there is no initial robust estimate then this element is set to \code{NA}.} \item{corr}{a logical flag. If \code{corr = TRUE} then \code{cov} and \code{raw.cov} contain robust estimates of the correlation matrix of \code{data}.} \item{estim}{a character string containing the name of the robust estimator.} \item{control}{a list containing the control parameters used by the robust estimator.} } \references{ R. A. Maronna and V. J. Yohai (1995) The Behavior of the Stahel-Donoho Robust Multivariate Estimator. \emph{Journal of the American Statistical Association} \bold{90} (429), 330--341. P. J. Rousseeuw and K. van Driessen (1999) A fast algorithm for the minimum covariance determinant estimator. \emph{Technometrics} \bold{41}, 212--223. D. L. Woodruff and D. M. Rocke (1994) Computable robust estimation of multivariate location and shape on high dimension using compound estimators. \emph{Journal of the American Statistical Association}, \bold{89}, 888--896. R. A. Maronna and R. H. Zamar (2002) Robust estimates of location and dispersion of high-dimensional datasets. \emph{Technometrics} \bold{44} (4), 307--317. } \note{ Version 0.3-8 of the Robust Library: all of the functions origianlly contributed by the S-Plus Robust Library have been replaced by dependencies on the robustbase and rrcov packages. Computed results may differ from earlier versions of the Robust Library. In particular, the MCD estimators are now adjusted by a small sample size correction factor. Additionally, a bug was fixed where the final MCD covariance estimate produced with \code{estim = "mcd"} was not rescaled for consistency. } \seealso{ \code{\link[rrcov]{CovSde}}, \code{\link[robustbase]{covMcd}}, \code{\link[rrcov]{CovOgk}}, \code{\link[rrcov]{covMest}}, \code{\link{covRob.control}}, \code{\link{covClassic}}. } \examples{ data(stackloss) covRob(stackloss) } \keyword{multivariate} \keyword{robust} robust/man/woodmod.dat.Rd0000644000176000001440000000210513044465224015103 0ustar ripleyusers\name{woodmod.dat} \alias{woodmod.dat} \title{ Modified Wood Data } \description{ The explanatory variables from the Modified Data on Wood Specific Gravity analyzed in Rousseeuw and Leroy (1987). Note that \code{data(wood, package="robustbase")} contains the same data, and additionally the y-variable. } \usage{ data(woodmod.dat) } \format{ This data frame contains the following variables: \describe{ \item{V1}{number of fibers per square milimeter in Springwood (coded by dividing by 1000).} \item{V2}{number of fibers per square milimeter in Summerwood (coded by dividing by 10000).} \item{V3}{fraction of Springwood.} \item{V4}{fraction of light absorption by Springwood.} \item{V5}{fraction of light absorption by Summerwood.} } } \source{ Rousseeuw, P. J., and Leroy, A. M. (1987). \emph{Robust Regression and Outlier Detection}. New York: Wiley. } \examples{ data(woodmod.dat) woodmod.dat data(wood, package = "robustbase") stopifnot(data.matrix(woodmod.dat) == data.matrix(wood [,1:5])) } \keyword{datasets} robust/man/glmRob.misclass.control.Rd0000644000176000001440000000235513044465224017411 0ustar ripleyusers\name{glmRob.misclass.control} \alias{glmRob.misclass.control} \title{ Control for Misclassification Robust GLM Estimator } \description{ Allows users to set parameters for \code{glmRob}. } \usage{ glmRob.misclass.control(mc.gamma = 0.01, mc.maxit = 30, mc.trc = FALSE, mc.tol = 0.001, mc.initial = NULL, ...) } \arguments{ \item{mc.gamma}{a real number between 0 and 1 that represents the probability of misclassification of a response variable.} \item{mc.maxit}{maximum number of iterations.} \item{mc.trc}{a logical value indicating whether a trace of the current parameter values is printed to the screen while the algorithm iterates.} \item{mc.tol}{convergence threshold.} \item{mc.initial}{a vector of initial values to start the iterations. If ommited, the coeficients resulting from a non-robust glm fit are used.} \item{\dots}{additional arguments are ignored.} } \value{ a list containing the parameters packaged to be used by \code{\link{glmRob}}. The values for \code{\link{glmRob.misclass.control}} can be supplied directly in a call to \code{\link{glmRob}}. These values are filtered through \code{\link{glmRob.misclass.control}} inside \code{\link{glmRob}}. } \seealso{\code{\link{glmRob}}} \keyword{robust} \keyword{regression} robust/man/lognormRob.Rd0000644000176000001440000000267113044465224015014 0ustar ripleyusers\name{lognormRob} \alias{lognormRob} \title{Robust Estimation of Lognormal Distribution Parameters} \description{ Robust estimation of lognormal distribution parameters. } \usage{ lognormRob(x, estim = c("tdmean"), control = lognormRob.control(estim, \dots), \dots) } \arguments{ \item{x}{a numeric vector containing the sample.} \item{estim}{a character string specifying which estimator to use.} \item{control}{a list of control parameters appropriate for the estimator in \code{estim}.} \item{\dots}{control parameters may also be given here.} } \value{ a list with class \dQuote{fitdstn} containing the following elements: \item{estimate}{a named numeric vector containing the parameter estimates.} \item{sd}{a named numeric vector containing the standard deviations of the parameter estimates. Missing in current implementation.} \item{vcov}{a numeric matrix containing the variance-covariance matrix of the estimated parameter vector. Missing in current implementation.} \item{mu}{a single numeric value containing an estimate of the mean.} \item{V.mu}{a single numeric value containing the variance of the estimated mean.} \item{control}{a list containing the control parameters used by the estimator.} } \note{ The \code{print} method displays the estimated parameters and their standard errors (in parentheses). } \seealso{ \code{\link{lognormRob.control}}, \code{\link{fitdstnRob}}. } \keyword{robust} robust/man/glmRob.misclass.Rd0000644000176000001440000000140313044465224015723 0ustar ripleyusers\name{glmRob.misclass} \alias{glmRob.misclass} \title{Consistent Misclassification Estimator} \description{ Computes the consistent misclassification estimate provided in \code{\link{glmRob}}. } \usage{ glmRob.misclass(x, y, control, offset, null.dev, family, Terms) } \arguments{ \item{x}{model matrix.} \item{y}{response.} \item{control}{control parameters.} \item{offset}{offset.} \item{null.dev}{a logical value.} \item{family}{a binomial family object.} \item{Terms}{the Terms object computed in glmRob.} } \value{ a list similar to \code{\link{glmRob.object}}. } \seealso{\code{\link{glmRob}}} \examples{ data(leuk.dat) glmRob(y ~ ag + wbc, data = leuk.dat, family = binomial(), method = 'misclass') } \keyword{robust} \keyword{regression} robust/man/covClassic.Rd0000644000176000001440000000467113044465224014767 0ustar ripleyusers%% --- NOTA BENE: Renamed function from cov() to ccov() to covClassic() \name{covClassic} \alias{covClassic} \title{Classical Covariance Estimation} \description{ Compute an estimate of the covariance/correlation matrix and location vector using classical methods. Its main intention is to return an object compatible to that produced by \code{\link{covRob}}, but fit using classical methods. } \usage{ covClassic(data, corr = FALSE, center = TRUE, distance = TRUE, na.action = na.fail, unbiased = TRUE, ...) } \arguments{ \item{data}{a numeric matrix or data frame containing the data.} \item{corr}{a logical flag. If \code{corr = TRUE} then the estimated correlation matrix is computed.} \item{center}{a logical flag or a numeric vector of length \code{p} (where \code{p} is the number of columns of \code{x}) specifying the center. If \code{center = TRUE} then the center is estimated. Otherwise the center is taken to be 0.} \item{distance}{a logical flag. If \code{distance = TRUE} the Mahalanobis distances are computed.} \item{na.action}{a function to filter missing data. The default \code{na.fail} produces an error if missing values are present. An alternative is \code{na.omit} which deletes observations that contain one or more missing values.} \item{unbiased}{logical indicating if an unbiased estimate of the covariance matrix is should becomputed. If false, the maximum likelihood estimate is computed.} \item{...}{additional .} } \value{ a list with class \dQuote{covClassic} containing the following elements: \item{call}{an image of the call that produced the object with all the arguments named.} \item{cov}{a numeric matrix containing the estimate of the covariance/correlation matrix.} \item{center}{a numeric vector containing the estimate of the location vector.} \item{dist}{a numeric vector containing the squared Mahalanobis distances. Only present if \code{distance = TRUE} in the \code{call}.} \item{corr}{a logical flag. If \code{corr = TRUE} then \code{cov} contains an estimate of the correlation matrix of \code{x}.} } \note{ Originally, and in S-PLUS, this function was called \code{cov}; it has been renamed, as that did mask the function in the standard package \pkg{stats}. } \seealso{ \code{\link{covRob}}, \code{\link{var}}, \code{\link{cov.wt}}. } \examples{ data(stack.dat) covClassic(stack.dat) } \keyword{robust} \keyword{multivariate} robust/man/glmRob.cubif.Rd0000644000176000001440000000311213044465224015174 0ustar ripleyusers\name{glmRob.cubif} \alias{glmRob.cubif} \title{Robust GLM CUBIF Fitter} \description{ Robustly fit a generalized linear model using a \bold{c}onditionally \bold{u}nbiased \bold{b}ounded \bold{i}n\bold{f}luence (\dQuote{cubif}) estimator. This function is called by the high-level function \code{\link{glmRob}} when \code{method = "cubif"} (the default) is specified. } \usage{ glmRob.cubif(x, y, intercept = FALSE, offset = 0, family = binomial(), null.dev = TRUE, control) } \arguments{ \item{x}{a numeric model matrix.} \item{y}{either a numeric vector containing the response or, in the case of the binomial family, a two-column numeric matrix containing the number of successes and failures.} \item{intercept}{a logical value. If \code{TRUE} a column of ones is added to the design matrix.} \item{offset}{a numeric vector containing the offset.} \item{family}{a family object.} \item{null.dev}{a logical value. If \code{TRUE} the null deviance is computed.} \item{control}{a list of control parameters. See \code{\link{glmRob.cubif.control}}.} } \value{ See \code{\link{glmRob.object}}. } \references{ Kunsch, L., Stefanski L. and Carroll, R. (1989). Conditionally Unbiased Bounded-Influence Estimation in General Regression Models, with Applications to Generalized Linear Models. JASA \bold{84}, 460--466. Marazzi, A. (1993). Algorithms, routines and S functions for robust statistics. Wadsworth & Brooks/Cole, Pacific Grove, CA. } \seealso{ \code{\link{glmRob}}, \code{\link{glmRob.cubif.control}}. } \keyword{robust} \keyword{regression} robust/man/summary.glmRob.Rd0000644000176000001440000000165213044465224015610 0ustar ripleyusers\name{summary.glmRob} \alias{summary.glmRob} \title{Summarizing Robust Generalized Linear Model Fits} \description{ Compute a summary of the robustly fitted generalized linear model. } \usage{ \method{summary}{glmRob}(object, correlation = TRUE, ...) } \arguments{ \item{object}{a glmRob object.} \item{correlation}{a logical value. If \code{TRUE} then the correlation matrix of the coefficients is included in the summary.} \item{\dots}{additional arguments required by the generic \code{\link{summary}} function.} } \value{ The summary is returned in a list of class summary.glmRob and contains the following components: \item{comp1 }{Description of 'comp1'} \item{comp2 }{Description of 'comp2'} ... } \examples{ data(breslow.dat) bres.rob <- glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), data = breslow.dat) bres.sum <- summary(bres.rob) bres.sum } \keyword{methods} \keyword{robust} \keyword{regression} robust/man/plot.fdfm.Rd0000644000176000001440000000133213044465224014556 0ustar ripleyusers\name{plot.fdfm} \alias{plot.fdfm} \title{fdfm Plot Method} \description{ Comparison plots for fitted univariate distributions. } \usage{ \method{plot}{fdfm}(x, which.plots = 2:3, \dots) } \arguments{ \item{x}{an \code{fdfm} object.} \item{which.plots}{either "ask", "all", or an integer vector specifying which plots to draw. In the latter case, use the plot numbers given in the "ask" menu.} \item{\dots}{additional arguments are passed to the plotting functions.} } \value{ \code{x} is invisibly returned. } \examples{ data(los, package = "robustbase") los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), x = los, densfun = "gamma") plot(los.fm) } \keyword{hplot} robust/man/lmRob.RFPE.Rd0000644000176000001440000000146013044465224014475 0ustar ripleyusers\name{lmRob.RFPE} \alias{lmRob.RFPE} \title{Robust Final Prediction Errors } \description{ Computes the robust Final Prediction Errors (FPE) for a robust regression fit using M-estimates. } \usage{ lmRob.RFPE(object, scale = NULL) } \arguments{ \item{object}{an lmRob object.} \item{scale}{a numeric value specifying the scale estimate used to compute the robust FPE. Usually this should be the scale estimate from an encompassing model. If \code{NULL}, the scale estimate in \code{object} is used.} } \value{ a single numeric value giving the robust final prediction error. } \seealso{ \code{\link{lmRob}}, \code{\link{step.lmRob}}, \code{\link{drop1.lmRob}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) lmRob.RFPE(stack.rob) } \keyword{robust} \keyword{regression} robust/man/step.lmRob.Rd0000644000176000001440000000723713044465224014724 0ustar ripleyusers\name{step.lmRob} \alias{step.lmRob} \title{Build a Model in a Stepwise Fashion} \description{ Performs stepwise model selection on a robustly fitted linear model. Presently only the backward stepwise procedure is implemented. } \usage{ step.lmRob(object, scope, scale, direction = c("both", "backward", "forward"), trace = TRUE, keep = NULL, steps = 1000, fast = FALSE, \dots) } \arguments{ \item{object}{an \code{\link{lmRob}} object.} \item{scope}{either a formula or a list with elements \code{lower} and \code{upper} each of which is a formula. The terms in the right-hand-side of \code{lower} are always included in the model and the additional terms in the right-hand-side of \code{upper} are the candidates for inclusion/exclusion from the model. If a single formula is given, it is taken to be \code{upper} and \code{lower} is set to the empty model. The \code{.} operator is interpreted in the context of the formula in \code{object}.} \item{scale}{a single numeric value containing a residual scale estimate. If missing, the scale estimate in \code{object} is used.} \item{direction}{a character value specifying the mode of stepwise search. The possibilities are "both", "backward", and "forward", with a default of "backward". Presently only "backward" stepwise searches are implemented.} \item{trace}{a logical value. If \code{TRUE}, information is printed during stepwise search.} \item{keep}{a filter function whose input is a fitted model object and the associated AIC statistic, and whose output is arbitrary. Typically keep will select a subset of the components of the object and return them. The default is not to keep anything.} \item{steps}{an integer value specifying the the maximum number of steps to be considered. The default is 1000 (essentially as many as required). It is typically used to stop the process early.} \item{fast}{a logical value. If \code{TRUE} the robust initial estimate (used when fitting each of the reduced models) is replaced by a weighted least squares estimate using the robust weights computed for the current fit. Note: the fast algorithm does not work in this version of the Robust Library.} \item{\dots}{additional arguments required by the generic step function.} } \details{ Presently only backward stepwise selection is supported. During each step the Robust Final Prediction Error (as computed by the function \code{\link{lmRob.RFPE}}) is calculated for the current model and for each sub-model achievable by deleting a single term. The function then either steps to the sub-model with the lowest Robust Final Prediction Error or, if the current model has the lowest Robust Final Prediction Error, terminates. The scale estimate from \code{object} is used to compute the Robust Final Prediction Error throughout the procedure unless the \code{scale} argument is provided in which case the user specified value is used. } \value{ the model with the lowest Robust Final Prediction Error encountered during the stepwise procedure is returned. Additionally, an \code{anova} element corresponding to the steps taken in the search is appended to the returned object. If a \code{keep} function was provided then the kept values can be found in the \code{keep} element of the returned object. } \seealso{ \code{\link{lmRob}}, \code{\link{lmRob.RFPE}}, \code{\link{drop1.lmRob}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) ## The default behavior is to try dropping all terms ## step.lmRob(stack.rob) ## Keep Water.Temp in the model ## my.scope <- list(lower = . ~ Water.Temp, upper = . ~ .) step.lmRob(stack.rob, scope = my.scope) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/anova.lmRob.Rd0000644000176000001440000000326613044465224015053 0ustar ripleyusers\name{anova.lmRob} \alias{anova.lmRob} \alias{anova.lmRoblist} \title{ANOVA for Robust Linear Model Fits} \description{ Compute an analysis of variance table for one or more robust linear model fits. } \usage{ \method{anova}{lmRob}(object, ..., test = c("RF", "RWald")) \method{anova}{lmRoblist}(object, const, ipsi, yc, test = c("RWald", "RF"), ...) } \arguments{ \item{object}{an lmRob object.} \item{\dots}{additional arguments required by the generic anova function. If \code{\dots} contains additional robustly fitted linear models then the function \code{\link{anova.lmRoblist}} is dispatched.} \item{const}{a numeric value containing the tuning constant.} \item{ipsi}{an integer value specifying the psi-function.} \item{yc}{a numeric value containing the tuning constant.} \item{test}{a single character value specifying which test should be computed in the Anova table. The possible choices are "RWald" and "RF".} } \details{ The default test used by anova is the \code{"RWald"} test, which is the Wald test based on robust estimates of the coefficients and covariance matrix. If \code{test} is \code{"RF"}, the robustified F-test is used instead. } \value{ an \code{anova} object. } \section{References}{ Hampel, F. R., Ronchetti, E. M., Rousseeuw, P. J., and Stahel, W. A. (1986). \emph{Robust statistics: the approach based on influence functions}. John Wiley & Sons. } \seealso{ \code{\link{lmRob}}, \code{\link{anova}}. } \examples{ data(stack.dat) stack.small <- lmRob(Loss ~ Water.Temp + Acid.Conc., data = stack.dat) stack.full <- lmRob(Loss ~ ., data = stack.dat) anova(stack.full) anova(stack.full, stack.small) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/ddPlot.covfm.Rd0000644000176000001440000000236713044465224015235 0ustar ripleyusers\name{ddPlot.covfm} \alias{ddPlot.covfm} \title{Distance - Distance Plot} \description{ For a \code{covfm} object containing 2 models, this function plots the Mahalanobis distance from the first model on the y-axis and the Mahalanobis distance from the second model on the x-axis. } \usage{ ddPlot.covfm(x, level = 0.95, strip = "", id.n = 3, \dots) } \arguments{ \item{x}{a \code{"covfm"} object.} \item{level}{a single numeric value between 0 and 1 giving the chi-squared percent point used to compute the outlyingness threshold.} \item{strip}{a character string printed in the \dQuote{strip} at the top of the plot.} \item{id.n}{a single nonnegative integer specifying the number of extreme points to label in the plot.} \item{\dots}{additional arguments are passed to \code{xyplot}.} } \value{ if the models can be compared then the plotted \code{trellis} object is invisibly returned. Otherwise \code{x} is returned invisibly. } \examples{ data(woodmod.dat) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) ddPlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", ylab = "y-axis label", pch = 4, col = "purple") } \keyword{hplot} robust/man/leuk.dat.Rd0000644000176000001440000000100013044465224014364 0ustar ripleyusers\name{leuk.dat} \alias{leuk.dat} \docType{data} \title{Leuk Data} \description{ An exmaple data set for the misclassification fitter in glmRob. } \usage{data(leuk.dat)} \format{ A data frame with 33 observations on the following 3 variables. \describe{ \item{\code{wbc}}{a numeric vector.} \item{\code{ag}}{a numeric vector.} \item{\code{y}}{a numeric vector.} } } \source{ Don't know - if you know please email the package maintainer. } \examples{ data(leuk.dat) } \keyword{datasets} robust/man/plot.glmRob.Rd0000644000176000001440000000273613044465224015075 0ustar ripleyusers\name{plot.glmRob} \alias{plot.glmRob} \title{Diagnostic Regression Plots} \description{ Creates a set plots useful for assessing a robustly fitted generalized linear model. The plot options are (2) Deviance Residuals vs. Predicted Values, (3) Response vs. Predicted Values, (4) Normal QQ Plot of Pearson Residuals, (5) QQ Plot of Deviance Residuals, (6) Standardized Deviance Residuals vs. Robust Distances, (7) Standardized Deviance Residuals vs. Index (Time), and (8) Sqrt of abs(Deviance Residuals) vs. Fitted Values. } \usage{ \method{plot}{glmRob}(x, which.plots = c(2, 5, 7, 6), ...) } \arguments{ \item{x}{a glmRob object.} \item{which.plots}{either "ask", "all", or an integer vector specifying which plots to draw. If \code{which.plots} is an integer vector, use the plot numbers given in the description above (or in the "ask" menu).} \item{...}{additional arguments are pass to the ploting subfunctions which are listed in the see also section.} } \value{ \code{x} is invisibly returned. } \section{Side Effects}{ The selected plots are drawn on a graphics device. } \details{ This function casts the glmRob object as an glmfm object containing a single model. The actual ploting is then done by the function \code{\link{plot.glmfm}}. } \section{References}{ Atkinson, A. C. (1985). Plots, Transformations and Regression. New York: Oxford University Press. } \seealso{ \code{\link{plot}}, \code{\link{glmRob}}, \code{\link{plot.glmfm}}. } \keyword{methods} \keyword{hplot} robust/man/glmRob.Rd0000644000176000001440000001007613044465224014114 0ustar ripleyusers\name{glmRob} \alias{glmRob} \title{Fit a Robust Generalized Linear Model} \description{ Produces an object of class \code{glmRob} which is a Robust Generalized Linear Model fit.} \usage{ glmRob(formula, family = binomial(), data, weights, subset, na.action, method = "cubif", model = TRUE, x = FALSE, y = TRUE, control = glmRob.control, contrasts = NULL, \dots) } \arguments{ \item{formula}{a formula expression as for other regression models, of the form response ~ predictors. See the documentation of \code{lm} and \code{formula} for details.} \item{family}{a family object - only \code{binomial} and \code{poisson} are implemented. See the documentation of \code{glm} for details.} \item{data}{an optional data frame in which to interpret the variables occuring in the formula.} \item{weights}{an optional vector of weights to be used in the fitting process. Should be \code{NULL} or a numeric vector.} \item{subset}{an expression specifying the subset of the data to which the model is fit. This can be a logical vector (which is replicated to have length equal to the number of observations), a numeric vector indicating which observations are included, or a character vector of the row names to be included. By default all observations are used.} \item{na.action}{a function to filter missing data. This is applied to the \code{model.frame} after any \code{subset} argument has been used. The default (\code{na.fail}) is to create an error if any missing values are found. A possible alternative is \code{na.omit} which omits the rows that contain one or more missing values.} \item{method}{a character vector indicating the fitting method. The choices are \code{method = "cubif"} for the conditionally unbiased bounded influence estimator, \code{method = "mallows"} for Mallow's leverage downweighting estimator, and \code{method = "misclass"} for a consistent estimate based on the misclassification model. The Mallows' and misclassification estimators are only defined for logistic regression models with Bernoulli response.} \item{model}{a logical flag. If \code{TRUE} then the model frame is returned.} \item{x}{a logical flag. If \code{TRUE} then the model matrix is returned.} \item{y}{a logical flag. If \code{TRUE} then the response variable is returned.} \item{contrasts}{a list of contrasts to be used for some or all of the factors appearing as variables in the model formula. The names of the list should be the names of the corresponding variables, and the elements should either be contrast-type matrices (matrices with as many rows as levels of the factor and with columns linearly independent of each other and of a column of one's), or else they should be functions that compute such contrast matrices.} \item{control}{a list of iteration and algorithmic constants to control the conditionally unbiased bounded influence robust fit. See \code{glmRob.cubif.control} for their names and default values. These can also be set as arguments of \code{glmRob} itself.} \item{\dots}{control arguments maybe specified directly.} } \value{a list with class \code{glmRob} containing the robust generalized linear model fit. See \code{\link{glmRob.object}} for details.} \section{References}{ Copas, J. B. (1988). Binary Regression Models for Contaminated Data. JRSS 50, 225-265. Kunsch, L., Stefanski L. and Carroll, R. (1989). Conditionally Unbiased Bounded-Influence Estimation in General Regression Models, with Applications to Generalized Linear Models. JASA 50, 460-466. Carroll, R. J. and Pederson, S. (1993). On Robustness in the Logistic Regression Model. JRSS 55, 693-706. Marazzi, A. (1993). Algorithms, routines and S functions for robust statistics. Wadsworth & Brooks/Cole, Pacific Grove, CA. } \seealso{ \code{\link{glmRob.control}}, \code{\link{glmRob.object}}, \code{\link{glmRob.cubif.control}}, \code{\link{glmRob.mallows.control}}, \code{\link{glmRob.misclass.control}}, \code{\link{glm}}. } \examples{ data(breslow.dat) glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), data = breslow.dat, method = "cubif") } \keyword{robust} \keyword{regression} \keyword{models} robust/man/summary.covfm.Rd0000644000176000001440000000356313601150636015500 0ustar ripleyusers\name{summary.covfm} \alias{summary.covClassic} \alias{summary.covRob} \alias{summary.covfm} \title{ Summary Method } \description{ The generic summary method for objects of class "covClassic", "covRob", and "covfm". } \usage{ \method{summary}{covClassic}(object, ...) \method{summary}{covRob}(object, ...) \method{summary}{covfm}(object, ...) } \arguments{ \item{object}{an object of class "covClassic", "covRob", or "covfm".} \item{\dots}{additional arguments for the summary method.} } \value{ an object of class "summary.covClassic", "summary.covRob", or "summary.covfm" respectively. Objects of class "summary.cov" and "summary.covRob" have the following components. Objects of class "summary.covfm" are lists whose elements are "summary.cov" and "summary.covRob" objects. \item{call}{an image of the call that produced the object with all the arguments named.} \item{cov}{a numeric matrix containing the estimate of the covariance/correlation matrix.} \item{center}{a numeric vector containing the estimate of the location vector.} \item{evals}{a numeric vector containing the eigenvalues of the covariance/correlation matrix.} \item{dist}{a numeric vector containing the Mahalanobis distances. Only present if \code{distance = TRUE} in the \code{call}.} \item{corr}{a logical flag. If \code{corr = TRUE} then \code{cov} contains an estimate of the correlation matrix of \code{x}.} } \seealso{ \code{\link{summary}}, \code{\link{covClassic}}, \code{\link{covRob}}, \code{\link{fit.models}}. } \examples{ data(woodmod.dat) woodm.cov <- covClassic(woodmod.dat) ## IGNORE_RDIFF_BEGIN summary(woodm.cov) ## IGNORE_RDIFF_END woodm.covRob <- covRob(woodmod.dat) summary(woodm.covRob) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) summary(woodm.fm) } \keyword{methods} robust/man/glmRob.mallows.control.Rd0000644000176000001440000000167413044465224017254 0ustar ripleyusers\name{glmRob.mallows.control} \alias{glmRob.mallows.control} \title{ Control for Mallows-type Robust GLM Estimator } \description{ Allows users to set parameters for \code{glmRob}. } \usage{ glmRob.mallows.control(wt.fn = wt.carroll, wt.tuning = 8, ...) } \arguments{ \item{wt.fn}{a weight function that might depend on a tuning constant. This function will be evaluated at the square root of the robust Mahalanobis distances of the covariates divided by their dimension.} \item{wt.tuning}{a tuning constant for \code{wt.fn}.} \item{\dots}{additional arguments are ignored.} } \value{ a list is returned, consisting of these parameters packaged to be used by \code{glmRob()}. The values for \code{glmRob.mallows.control()} can be supplied directly in a call to \code{glmRob()}. These values are filtered through \code{glmRob.mallows.control()} inside \code{glmRob()}. } \seealso{ \code{\link{glmRob}}. } \keyword{robust} \keyword{regression} robust/man/drop1.lmRob.Rd0000644000176000001440000000444513044465224014774 0ustar ripleyusers\name{drop1.lmRob} \alias{drop1.lmRob} \title{Compute an Anova Object by Dropping Terms} \description{ \code{drop1.lmRob} is used to investigate a robust Linear Model object by recomputing it, successively omitting each of a number of specified terms. } \usage{ \method{drop1}{lmRob}(object, scope, scale, keep, fast = FALSE, ...) } \arguments{ \item{object}{an lmRob object.} \item{scope}{an optional \code{formula} object describing the terms to be dropped. Typically this argument is omitted, in which case all possible terms are dropped (without breaking hierarchy rules). The \code{scope} can also be a character vector of term labels. If the argument is supplied as a formula, any \code{.} is interpreted relative to the formula implied by the \code{object} argument.} \item{scale}{a single numeric value containing a residual scale estimate. If missing, the scale estimate in \code{object} is used.} \item{keep}{a character vector of names of components that should be saved for each subset model. Only names from the set \code{"coefficients"}, \code{"fitted"} and \code{"residuals"} are allowed. If \code{keep == TRUE}, the complete set is saved. The default behavior is not to keep anything.} \item{fast}{a logical value. If \code{TRUE} the robust initial estimate (used when fitting each of the reduced models) is replaced by a weighted least squares estimate using the robust weights in \code{object}.} \item{\dots}{additional arguments required by the generic drop1 function.} } \value{ An \code{anova} object is constructed, consisting of the term labels, the degrees of freedom, and Robust Final Prediction Errors (RFPE) for each subset model. If \code{keep} is missing, the \code{anova} object is returned. If \code{keep} is present, a list with components \code{"anova"} and \code{"keep"} is returned. In this case, the \code{"keep"} component is a matrix of mode \code{"list"}, with a column for each subset model, and a row for each component kept. } \details{ This function is a method for the generic function \code{\link{drop1}} for class \code{"lmRob"}. } \seealso{ \code{\link{anova}}, \code{\link{drop1}}, \code{\link{lmRob.object}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) drop1(stack.rob) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/glmRob.cubif.control.Rd0000644000176000001440000000212513044465224016656 0ustar ripleyusers\name{glmRob.cubif.control} \alias{glmRob.cubif.control} \title{ Control Parameters for the Bounded Influence Robust GLM Estimator } \description{ Allows users to set parameters for \code{glmRob}. } \usage{ glmRob.cubif.control(epsilon = 0.001, maxit = 50, bpar = 2, cpar = 1.5, trc = FALSE, ...) } \arguments{ \item{epsilon}{a positive numeric values specifying the convergence threshold for the parameters.} \item{maxit}{a positive integer giving the maximum number of iterations.} \item{bpar}{bpar} \item{cpar}{a single positive numeric value specifying the tuning constant for the initial estimate. This is the truncation value for the likelihood equation for the initial estimate. It determines the starting point of the iterative algorithm to calculate the final estimate.} \item{trc}{a logical value. If \code{TRUE} the number of the current iteration is printed on the screen.} \item{\dots}{additional arguments are ignored.} } \value{a list is returned containing the values specified in the Arguments section. } \seealso{ \code{\link{glmRob}}. } \keyword{robust} \keyword{regression} robust/man/plot.lmRob.Rd0000644000176000001440000000334713044465224014725 0ustar ripleyusers\name{plot.lmRob} \alias{plot.lmRob} \title{Diagnostic Regression Plots} \description{ Creates a set plots useful for assessing a robustly fitted linear model. The plot options are (2) Normal QQ-Plot of Residuals, (3) Estimated Kernel Density of Residuals, (4) Robust Residuals vs Robust Distances, (5) Residuals vs Fitted Values, (6) Sqrt of abs(Residuals) vs Fitted Values, (7) Response vs Fitted Values, (8) Standardized Residuals vs Index (Time), (9) Overlaid Normal QQ-Plot of Residuals, and (10) Overlaid Estimated Density of Residuals. For simple linear regression models there is also the option to have a side-by-side plots of the the fit over a scatter plot of the data. } \usage{ \method{plot}{lmRob}(x, which.plots = c(5, 2, 6, 4), ...) } \arguments{ \item{x}{an lmRob object.} \item{which.plots}{either "ask", "all", or an integer vector specifying which plots to draw. If \code{which.plots} is an integer vector, use the plot numbers given in the description above (or in the "ask" menu).} \item{...}{additional arguments are pass to the ploting subfunctions which are listed in the see also section.} } \value{ \code{x} is invisibly returned. } \section{Side Effects}{ The selected plots are drawn on a graphics device. } \details{ This function casts the lmRob object as an lmfm object containing a single model. The actual ploting is then done by the function \code{\link{plot.lmfm}}. } \section{References}{ Atkinson, A. C. (1985). Plots, Transformations and Regression. New York: Oxford University Press. } \seealso{ \code{\link{plot}}, \code{\link{lmRob}}, \code{\link{plot.lmfm}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) plot(stack.rob, which.plots = 6) } \keyword{methods} \keyword{hplot} robust/man/lmRob.object.Rd0000644000176000001440000000766513044465224015224 0ustar ripleyusers\name{lmRob.object} \alias{lmRob.object} \title{ Robust Linear Model Objects } \description{ These are objects of class \code{lmRob} which represent the robust fit of a linear regression model, as estimated by \code{\link{lmRob}} function. } \section{Generation}{ This class of objects is returned from the \code{lmRob} function. } \section{Methods}{ \code{\link{add1}}, \code{\link{anova}}, \code{\link{coef}}, \code{\link{deviance}}, \code{\link{drop1}}, \code{\link{fitted}}, \code{\link{formula}}, \code{\link{labels}}, \code{\link{plot}}, \code{\link{print}}, \code{\link{residuals}}, \code{\link{summary}}, \code{\link{update}}. } \section{Structure}{ The following components must be included in a legitimate \code{"lmRob"} object: } \value{ \item{coefficients}{ vector of coefficients for the robust regression. If \code{est="final"}, these are final estimates; if \code{est="initial"}, these are initial estimates. } \item{T.coefficients}{ the vector of coefficients for the initial estimate, if \code{est="final"}. } \item{scale}{ the scale estimate computed using the initial estimates. } \item{residuals}{ the residual vector corresponding to the estimates returned in \code{coefficients}. } \item{T.residuals}{ the residual vector corresponding to the estimates returned in \code{T.coefficients}. } \item{fitted.values}{ the fitted values corresponding to the estimates returned in \code{coefficients}. } \item{T.fitted.values}{ the fitted values corresponding to the estimates returned in \code{T.coefficients}. } \item{cov}{ the estimated covariance matrix of the estimates in \code{coefficients}. } \item{T.cov}{ the estimated covariance matrix of the estimates in \code{T.coefficients}. } \item{rank}{ the rank of the design matrix \code{x}. } \item{iter.refinement}{ the number of iterations required to refine the initial estimates. } \item{df.residuals}{ the degrees of freedom in the residuals (the number of rows in \code{x} minus the rank of \code{x}). } \item{est}{ a character string that specifies the type of estimates returned. If \code{est="initial"}, the initial estimates are returned; if \code{est="final"}, the final estimates are returned. } \item{control}{ a list of control parameters, passed to the function \code{lmRob} as the \code{robust.control} argument that produced the \code{lmRob} object. } \item{genetic.control}{ a list of control parameters, passed to the function \code{lmRob} as the \code{genetic.control} argument that produced the \code{lmRob} object, if present. } \item{dev}{ the robust deviance if final MM-estimates are returned. } \item{T.dev}{ the robust deviance corresponding to initial S-estimates if applies. } \item{r.squared}{ the fraction of variation in \code{y} explained by the robust regression on \code{x} corresponding to the final MM-estimates in \code{coefficients}, if applies. } \item{T.r.squared}{ the fraction of variation in \code{y} explained by the robust regression on \code{x} corresponding to the initial S-estimates in \code{T.coefficients}, if applies. } \item{M.weights}{ the robust estimate weights corresponding to the final MM-estimates in \code{coefficients}, if applies. } \item{T.M.weights}{ the robust estimate weights corresponding to the initial S-estimates in \code{T.coefficients}, if applies. } \item{iter.final.coef}{ the number of iterations required to compute the final MM-estimates of the coefficients, if applies. } \item{call}{ an image of the call that produced the object, but with the arguments all named and with the actual formula included as the \code{formula} argument. } \item{assign}{ the same as the \code{assign} component of an \code{"lm"} object. } \item{contrasts}{ the same as the \code{contrasts} component of an \code{"lm"} object. } \item{terms}{ the same as the \code{terms} component of an \code{"lm"} object. } } \seealso{ \code{\link{lmRob}}. } \keyword{robust} \keyword{regression} \keyword{methods} \keyword{models} robust/man/glmRob.mallows.Rd0000644000176000001440000000146413044465224015572 0ustar ripleyusers\name{glmRob.mallows} \alias{glmRob.mallows} \title{Mallows Type Estimator} \description{ Computes the Mallows Type Estimator provided by glmRob. } \usage{ glmRob.mallows(x, y, control, offset, null.dev, family, Terms) } \arguments{ \item{x}{model matrix} \item{y}{a numeric vector of Bernoulli responses.} \item{control}{control parameters.} \item{offset}{offset} \item{null.dev}{a logical value. If \code{TRUE} the null deviance is computed and stored.} \item{family}{a binomial family object.} \item{Terms}{the \code{Terms} object created in glmRob.} } \value{ a list similar to \code{\link{glmRob.object}}. } \seealso{\code{link{glmRob}}} \examples{ data(mallows.dat) glmRob(y ~ a + b + c, data = mallows.dat, family = binomial(), method = 'mallows') } \keyword{robust} \keyword{regression} robust/man/plot.covfm.Rd0000644000176000001440000000363613044465224014765 0ustar ripleyusers\name{plot.covfm} \alias{plot.covfm} \alias{plot.covRob} \alias{plot.covClassic} \title{ Plot Method } \description{ Generic plot method for objects with classes \dQuote{covfm}, \dQuote{covRob}, and \dQuote{covClassic}. } \usage{ \method{plot}{covfm}(x, which.plots = c(4, 3, 5), \dots) \method{plot}{covRob}(x, which.plots = c(4, 3, 5), \dots) \method{plot}{covClassic}(x, which.plots = c(4, 3, 5), \dots) } \arguments{ \item{x}{an oject of class "covClassic", "covRob", or "covfm".} \item{which.plots}{either "ask", "all", or an integer vector specifying which plots to draw. If which.plots is an integer vector, use the plot numbers given here (or in the "ask" menu). The plot options are (2) Eigenvalues of Covariance Estimate, (3) Sqrt of Mahalanobis Distances, (4) Ellipses Matrix, and (5) Distance - Distance Plot.} \item{\dots}{additional arguments are passed to the plot subfunctions.} } \value{ \code{x} is invisibly returned. } \section{Side Effects}{ The requested plots are drawn on a graphics device. } \details{ The actual plot functions are only implemented for "fit.models" objects. When this method is dispatched on an object of class "cov" or "covRob" the object is cast as a "fit.models" object containing a single element and plotted with \code{plot.covfm}. The actual plotting is done by the subfunctions listed in the See Also section. } \seealso{ \code{\link{plot}}, \code{\link{covClassic}}, \code{\link{covRob}}, \code{\link{fit.models}}, \code{\link{ddPlot.covfm}}, \code{\link{ellipsesPlot.covfm}}, \code{\link{screePlot.covfm}}, \code{\link{distancePlot.covfm}}. } \examples{ data(woodmod.dat) woodm.cov <- covClassic(woodmod.dat) woodm.covRob <- covRob(woodmod.dat) plot(woodm.cov) plot(woodm.covRob) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) plot(woodm.fm) } \keyword{methods} \keyword{hplot} robust/man/breslow.dat.Rd0000644000176000001440000000365213044465224015120 0ustar ripleyusers\name{breslow.dat} \alias{breslow.dat} \docType{data} \title{Breslow Data} \description{ Patients suffering from simple or complex partial seizures were randomized to receive either the antiepileptic drug progabide or a placebo. At each of four successive postrandomization clinic visits, the number of seizures occuring over the previous two weeks was reported. } \usage{data(breslow.dat)} \format{ A data frame with 59 observations on the following 12 variables. \describe{ \item{\code{ID}}{an integer value specifying the patient identification number.} \item{\code{Y1}}{an integer value, the number of seizures during the first two week period.} \item{\code{Y2}}{an integer value, the number of seizures during the second two week period.} \item{\code{Y3}}{an integer value, the number of seizures during the third two week period.} \item{\code{Y4}}{an integer value, the number of seizures during the fourth two week period.} \item{\code{Base}}{an integer value giving the eight-week baseline seizure count.} \item{\code{Age}}{an integer value giving the age of the parient in years.} \item{\code{Trt}}{the treatment: a factor with levels \code{placebo} and \code{progabide}.} \item{\code{Ysum}}{an integer value, the sum of \code{Y1}, \code{Y2}, \code{Y3} and \code{Y4}.} \item{\code{sumY}}{an integer value, the sum of \code{Y1}, \code{Y2}, \code{Y3} and \code{Y4}.} \item{\code{Age10}}{a numeric value, \code{Age} divided by 10.} \item{\code{Base4}}{a numeric value, \code{Base} divided by 4.} } } \references{ Breslow, N. E., and Clayton, D. G. (1993), "Approximate Inference in Generalized Linear Mixed Models," Journal of the American Statistical Association, Vol. 88, No. 421, pp. 9-25. Thrall, P. F., and Vail, S. C. (1990), "Some Covariance Models for Longitudinal Count Data With Overdispersion," Biometrics, Vol. 46, pp. 657-671. } \examples{ data(breslow.dat) } \keyword{datasets} robust/man/ellipsesPlot.covfm.Rd0000644000176000001440000000200513044465224016453 0ustar ripleyusers\name{ellipsesPlot.covfm} \alias{ellipsesPlot.covfm} \title{Ellipses Plot - Visual Correlation Matrix Comparison} \description{ When there are 3 or more variables in the data, this function produces a matrix with ellipses drawn in the upper triangle. The ellipse in cell \eqn{i,j} of the plot is drawn to be a contour of a standard bivariate normal with correlation \eqn{\rho_{ij}}. One ellipse is drawn in each cell for each model in the \code{covfm} object. When there are 2 variables in the data, this function produces a scatter plot of the data with an overlaid 95\% confidence ellipse for each model in the \code{covfm} object. } \usage{ ellipsesPlot.covfm(x, ...) } \arguments{ \item{x}{a \code{"covfm"} object.} \item{\dots}{additional arguments are ignored.} } \value{ x is invisibly returned. } \examples{ data(woodmod.dat) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) ellipsesPlot.covfm(woodm.fm) } \keyword{hplot} robust/man/qqPlot.fdfm.Rd0000644000176000001440000000134713044465224015066 0ustar ripleyusers\name{qqPlot.fdfm} \alias{qqPlot.fdfm} \title{Comparison Quantile-Quantile Plot} \description{ Side-by-side quantile-quantile plots of the sample versus estimated quantiles. } \usage{ qqPlot.fdfm(x, qqline = TRUE, ...) } \arguments{ \item{x}{an \code{fdfm} object.} \item{qqline}{a logical value. If \code{TRUE} a qqline is included in each panel.} \item{\dots}{additional arguments are passed to \code{xyplot}.} } \examples{ data(los, package = "robustbase") los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), x = los, densfun = "gamma") qqPlot.fdfm(los.fm, xlab = "x-axis label", ylab = "y-axis label", main = "Plot Title", pch = 4, col = "purple") } \keyword{hplot} robust/man/lmRob.fit.compute.Rd0000644000176000001440000000404113044465224016174 0ustar ripleyusers\name{lmRob.fit.compute} \alias{lmRob.fit.compute} \title{Fit a Robust Linear Model} \description{ Fits a robust linear model with high breakdown point and high efficiency estimates. This is used by \code{\link{lmRob}}, but not supposed to be called by the users directly. } \usage{ lmRob.fit.compute(x, y, x1.idx = NULL, nrep = NULL, robust.control = NULL, ...) } \arguments{ \item{x}{a numeric matrix containing the design matrix. } \item{y}{a numeric vector containing the linear model response.} \item{x1.idx}{a numeric vector containing the indices of columns of the design matrix arising from the coding of factor variables.} \item{nrep}{the number of random subsamples to be drawn. If \code{"Exhaustive"} resampling is being used, the value of \code{nrep} is ignored.} \item{robust.control}{a list of control parameters to be used in the numerical algorithms. See \code{lmRob.control} for the possible control parameters and their default settings.} \item{\dots}{additional arguments.} } \value{ an object of class \code{"lmRob"}. See \code{\link{lmRob.object}} for a complete description of the object returned. } \section{References}{ Gervini, D., and Yohai, V. J. (1999). A class of robust and fully efficient regression estimates, mimeo, Universidad de Buenos Aires. Marazzi, A. (1993). \emph{Algorithms, routines, and S functions for robust statistics}. Wadsworth & Brooks/Cole, Pacific Grove, CA. Maronna, R. A., and Yohai, V. J. (1999). Robust regression with both continuous and categorical predictors, mimeo, Universidad de Buenos Aires. Yohai, V. (1988). High breakdown-point and high efficiency estimates for regression, \emph{Annals of Statistics}, 15, 642-665. Yohai, V., Stahel, W. A., and Zamar, R. H. (1991). A procedure for robust estimation and inference in linear regression, in Stahel, W. A. and Weisberg, S. W., Eds., \emph{Directions in robust statistics and diagnostics, Part II}. Springer-Verlag. } \seealso{ \code{\link{lmRob}}, \code{\link{lmRob.control}}. } \keyword{robust} \keyword{regression} \keyword{models} robust/man/weibullRob.Rd0000644000176000001440000000252013044465224014773 0ustar ripleyusers\name{weibullRob} \title{Robust Estimation of Weibull Distribution Parameters} \alias{weibullRob} \description{ Robust estimation of Weibull distribution parameters. } \usage{ weibullRob(x, estim = c("M", "tdmean"), control = weibullRob.control(estim, \dots), \dots) } \arguments{ \item{x}{a numeric vector containing the sample.} \item{estim}{a character string specifying which estimator to use.} \item{control}{a list of control parameters appropriate for the estimator in \code{estim}.} \item{\dots}{control parameters may also be given here.} } \value{ a list of class \dQuote{fitdstn} containing the following elements: \item{estimate}{a named numeric vector containing the parameter estimates.} \item{sd}{a named numeric vector containing the standard deviations of the parameter estimates.} \item{vcov}{a numeric matrix containing the variance-covariance matrix of the estimated parameter vector.} \item{mu}{a single numeric value containing an estimate of the mean.} \item{V.mu}{a single numeric value containing the variance of the estimated mean.} \item{control}{a list containing the control parameters used by the estimator.} The \code{print} method displays the estimated parameters and their standard errors (in parentheses). } \seealso{ \code{\link{weibullRob.control}}, \code{\link{fitdstnRob}}. } \keyword{robust} robust/man/OverlaidDenPlot.fdfm.Rd0000644000176000001440000000151013044465224016631 0ustar ripleyusers\name{overlaidDenPlot.fdfm} \title{Overlaid Density Plot} \alias{overlaidDenPlot.fdfm} \description{ Plot the estimated densities over a histogram of the data. } \usage{ overlaidDenPlot.fdfm(x, trunc = 1.0 - 1e-3, \dots) } \arguments{ \item{x}{an \code{fdfm} object.} \item{trunc}{if non NULL, the maximum x-value of the plot is the largest \code{truncate} quantile among the estimated distributions.} \item{\dots}{additional arguments are passed to the plotting functions.} } \value{ \code{x} is invisibly returned. } \examples{ data(los, package="robustbase") los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), x = los, densfun = "gamma") overlaidDenPlot.fdfm(los.fm, xlab = "x-axis label", ylab = "y-axis label", main = "Plot Title") } \keyword{hplot} robust/man/anova.glmRob.Rd0000644000176000001440000000203113044465224015207 0ustar ripleyusers\name{anova.glmRob} \alias{anova.glmRob} \alias{anova.glmRoblist} \title{ANOVA for Robust Generalized Linear Model Fits} \description{ Compute an analysis of variance table for one or more robust generalized linear model fits. } \usage{ \method{anova}{glmRob}(object, ..., test = c("none", "Chisq", "F", "Cp")) \method{anova}{glmRoblist}(object, ..., test = c("none", "Chisq", "F", "Cp")) } \arguments{ \item{object}{a glmRob object.} \item{\dots}{additional glmRob objects.} \item{test}{a character string specifying the test statistic to be used. Can be one of "F", "Chisq", "Cp" or "none" for no test.} } \value{ an \code{anova} object. } \seealso{ \code{\link{glmRob}}, \code{\link{anova}}, \code{\link{anova.glmRoblist}}. } \examples{ data(breslow.dat) bres.int <- glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), data = breslow.dat) anova(bres.int) bres.main <- glmRob(sumY ~ Age10 + Base4 + Trt, family = poisson(), data = breslow.dat) anova(bres.main, bres.int) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/predict.lmRob.Rd0000644000176000001440000000336613044465224015402 0ustar ripleyusers\name{predict.lmRob} \alias{predict.lmRob} \title{Use predict() on an lmRob Object } \description{ Extracts the fitted values from an \code{lmRob} object and returns a matrix of predictions. } \usage{ \method{predict}{lmRob}(object, newdata, type = "response", se.fit = FALSE, terms = labels(object), ...) } \arguments{ \item{object}{an lmRob object.} \item{newdata}{a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made at the same values used to compute the object. Only those predictors referred to in the right side of the formula in object need be present by name in \code{newdata}.} \item{type}{a single character value specifying the type of prediction. The only choice is "response". If "response" is selected, the predictions are on the scale of the response.} \item{se.fit}{a logical value. If \code{TRUE}, pointwise standard errors are computed along with the predictions.} \item{terms}{this argument is presently unused.} \item{\dots}{additional arguments required by the generic \code{\link{predict}} function.} } \value{ a vector of predictions, or a list consisting of the predictions and their standard errors if \code{se.fit = TRUE}. } \section{Warning}{\code{predict} can produce incorrect predictions when the \code{newdata} argument is used if the formula in \code{object} involves \emph{data-dependent} transformations, such as \code{poly(Age, 3)} or \code{sqrt(Age - min(Age))}.} \seealso{ \code{\link{lmRob}}, \code{\link{predict}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) predict(stack.rob) predict(stack.rob, newdata = stack.dat[c(1,2,4,21), ], se.fit = TRUE) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/weight.funs.Rd0000644000176000001440000000332713044465224015134 0ustar ripleyusers\name{weight.funs} \alias{psi.weight} \alias{rho.weight} \alias{psp.weight} \alias{chi.weight} \title{Weight Functions Psi, Rho, Chi} \description{ %% FIXME ! These functions compute the weights used by lmRob and its associated methods. } \usage{ psi.weight(x, ips = 1, xk = 1.06) rho.weight(x, ips = 1, xk = 1.06) psp.weight(x, ips = 1, xk = 1.06) chi.weight(x, ips = 1, xk = 1.06) } \arguments{ \item{x}{a numeric vector.} \item{ips}{integer determining the weight function: \describe{ \item{\code{ips = 1}}{"optimal"}, \item{\code{ips = 2}}{rescaled bisquare}, \item{\code{ips = 3}}{Huber}, \item{\code{ips = 4}}{smoothed Huber}, which is currently only available for \code{psi.*()} and its derivative \code{psp.*()}. }} \item{xk}{a numeric value specifying the tuning constant.} } \details{ See the section \dQuote{Theoretical Details}, p. 58-59, in chapter 2 of \file{Robust.pdf}. %% Huber isn't there; and notably "smoothed Huber" ain't } \value{ a numeric vector, say \code{r} of the same length as \code{x}, containing the function values \eqn{r_i = f(x_i)}{r[i] = f(x[i])}. } \examples{ x <- seq(-4,4, length=401) f.x <- cbind(psi = psi.weight(x), psp = psp.weight(x), chi = chi.weight(x), rho = rho.weight(x)) es <- expression(psi(x), {psi*minute}(x), chi(x), rho(x)) leg <- as.expression(lapply(seq_along(es), function(i) substitute(C == E, list(C=colnames(f.x)[i], E=es[[i]])))) matplot(x, f.x, type = "l", lwd = 1.5, main = "psi.weight(.) etc -- 'optimal'") abline(h = 0, v = 0, lwd = 2, col = "#D3D3D380") # opaque gray legend("bottom", leg, inset = .01, lty = 1:4, col = 1:4, lwd = 1.5, bg = "#FFFFFFC0") } \keyword{robust} robust/man/lsRobTest.Rd0000644000176000001440000000135413044465224014612 0ustar ripleyusers\name{lsRobTest} \alias{lsRobTest} \title{ Bias Test for Least-Squares Regression Estimates } \description{ Test for bias between least-squares and robust MM linear regression estimates. } \usage{ lsRobTest(object, test = c("T2", "T1"), ...) } \arguments{ \item{object}{an \code{lmRob} object (the output of the \code{\link{lmRob}} function).} \item{test}{either \code{"T1"} or \code{"T2"}. Selects the null hypothesis. T2 (the default ): the error distribution not bias inducing. T1: the residual error distribution is normal.} \item{\dots}{additional arguments are ignored.} } \examples{ rob.fit <- lmRob(stack.loss ~ ., data = stackloss) lsRobTest(rob.fit) lsRobTest(rob.fit, test = "T1") } \keyword{robust} \keyword{regression} robust/man/weibullRob.control.Rd0000644000176000001440000000076113044465224016457 0ustar ripleyusers\name{weibullRob.control} \alias{weibullRob.control} \title{Control Parameters for weibullRob} \description{ Create a list of control parameters for the \code{weibullRob} function. } \usage{ weibullRob.control(estim, \dots) } \arguments{ \item{estim}{a character string specifying the estimator.} \item{\dots}{control parameters appropriate for the estimator given in \code{estim}.} } \value{ a list of control parameters appropriate for the specified estimator. } \keyword{robust} robust/man/lognormRob.control.Rd0000644000176000001440000000076313044465224016473 0ustar ripleyusers\name{lognormRob.control} \alias{lognormRob.control} \title{Control Parameters for lognormRob} \description{ Create a list of control parameters for the \code{lognormRob} function. } \usage{ lognormRob.control(estim, \dots) } \arguments{ \item{estim}{a character string specifying the estimator.} \item{\dots}{control parameters appropriate for the estimator given in \code{estim}.} } \value{ a list of control parameters appropriate for the specified estimator. } \keyword{robust} robust/man/fitdstnRob.Rd0000644000176000001440000000276413044465224015015 0ustar ripleyusers\name{fitdstnRob} \alias{fitdstnRob} \title{Robust Fitting of Univariate Distributions} \description{ Robust Fitting of Univariate Distributions. } \usage{ fitdstnRob(x, densfun, \dots) } \arguments{ \item{x}{A numeric vector containing the sample.} \item{densfun}{a character string naming the distribution. Distributions \sQuote{gamma}, \sQuote{lognormal}, and \sQuote{weibull} are recognized.} \item{\dots}{additional arguments are passed to the fitting functions.} } \value{ a list with class \dQuote{fitdstn} containing the following elements: \item{estimate}{a named numeric vector containing the parameter estimates.} \item{sd}{a named numeric vector containing the standard deviations of the parameter estimates.} \item{vcov}{a numeric matrix containing the variance-covariance matrix of the estimated parameter vector.} \item{mu}{a single numeric value containing an estimate of the mean.} \item{V.mu}{a single numeric value containing the variance of the estimated mean.} \item{control}{a list containing the control parameters used by the estimator.} \item{call}{the matched call.} \item{densfun}{the character string \code{densfun} provided in the arguments.} \item{x}{the data provided in \code{x}.} The \code{print} method displays the estimated parameters and their standard errors (in parentheses). } \seealso{ \code{\link{gammaRob}}, \code{\link{lognormRob}}, \code{\link{weibullRob}}. The classical counterparts, see \code{\link{fitdstn}}. } \keyword{robust} robust/man/rb.lmRob.Rd0000644000176000001440000000152413044465224014345 0ustar ripleyusers\name{rb.lmRob} \alias{rb.lmRob} \title{Robust Bootstrap Standard Errors} \description{ Computes a robust bootstrap estimate of the standard error for each coefficient estimate in a robustly fitted linear model. This function is called by \code{\link{summary.lmRob}} and is not intended to be called directly by users. } \usage{ rb.lmRob(lmRob.object, M = 1000, seed = 99, fixed = TRUE) } \arguments{ \item{lmRob.object}{an lmRob object.} \item{M}{a positive integer giving the number of bootstrap subsamples.} \item{seed}{a positive integer specifying the seed for the random number generator.} \item{fixed}{a logical value. This should be set to \code{TRUE}.} } \value{ a numeric vector of robust bootstrap standard error estimates. } \seealso{ \code{\link{lmRob}}, \code{\link{summary.lmRob}}. } \keyword{robust} \keyword{regression} robust/man/screePlot.covfm.Rd0000644000176000001440000000155613044465224015746 0ustar ripleyusers\name{screePlot.covfm} \alias{screePlot.covfm} \title{Comparison Screeplot} \description{ Draws overlaid screeplots for the models in a \code{covfm} object. } \usage{ screePlot.covfm(x, npcs, strip = "", ...) } \arguments{ \item{x}{a \code{"covfm"} object.} \item{npcs}{a postive integer value specifying the number of components to be plotted.} \item{strip}{a character string printed in the \dQuote{strip} at the top of the plot.} \item{\dots}{additional arguments are passed to \code{xyplot}.} } \value{ the \code{trellis} object is invisibly returned. } \examples{ data(woodmod.dat) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) screePlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", ylab = "y-axis label", pch = 4:5) } \keyword{hplot} robust/man/glmRob.control.Rd0000644000176000001440000000175613044465224015600 0ustar ripleyusers\name{glmRob.control} \alias{glmRob.control} \title{glmRob Control Parameters} \description{ Generates a list of control parameters for glmRob. The main purpose of this function is to implement the default behaviour for glmRob. Use the functions listed in the See Also section to generate control lists for the different robust estimators. } \usage{ glmRob.control(method, ...) } \arguments{ \item{method}{a character vector specifying which extimator the control parameters should be generated for. The choices are \code{"cubif"}, \code{"mallows"}, and \code{"misclass"}.} \item{\dots}{additional arguments are included in the control (if appropriate for the estimator specified by \code{method}).} } \value{ a list of control parameters appropriate for the fitting method specified by the \code{method} argument. } \seealso{ \code{\link{glmRob.cubif.control}}, \code{\link{glmRob.mallows.control}}, \code{\link{glmRob.misclass.control}}. } \keyword{robust} \keyword{regression} robust/man/predict.glmRob.Rd0000644000176000001440000000355613044465224015552 0ustar ripleyusers\name{predict.glmRob} \alias{predict.glmRob} \title{Predict Method for Robust Generalized Linear Model Fits} \description{ Obtains predictions and optionally estimates standard errors of those predictions from a fitted robust generalized linear model object. } \usage{ \method{predict}{glmRob}(object, newdata, type = c("link", "response", "terms"), se.fit = FALSE, terms = labels(object), dispersion = NULL, ...) } \arguments{ \item{object}{a glmRob object.} \item{newdata}{optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used.} \item{type}{a character string specifying the type of prediction. The choices are "link" for predictions on the scale of the linear predictor, "response" for predctions on the scale of the response, and "terms" which returns a matrix giving the fitted values for each term in the model formula on the scale of the linear predictor.} \item{se.fit}{a logical value. If \code{TRUE} then standard errors for the predictions are computed.} \item{terms}{when \code{type = "terms"} all terms are returned. A character vector specifies which terms are to be returned.} \item{dispersion}{the dispersion of the generalized linear model fit to be assumed in computing the standard errors. If omitted, that returned by 'summary' applied to the object is used.} \item{\dots}{additional arguments required by the generic predict method.} } \value{ If \code{se.fit = FALSE}, a vector or matrix of predictions. Otherwise a list with components: \item{fit}{Predictions} \item{se.fit}{Estimated standard errors} } \seealso{ \code{\link{glmRob}}, \code{\link{predict}}. } \examples{ data(breslow.dat) bres.rob <- glmRob(sumY ~ Age10 + Base4 * Trt, family = poisson(), data = breslow.dat) predict(bres.rob) } \keyword{robust} \keyword{regression} \keyword{methods} robust/man/lmRob.Rd0000644000176000001440000001321513044465224013743 0ustar ripleyusers\name{lmRob} \alias{lmRob} \title{High Breakdown and High Efficiency Robust Linear Regression } \description{ Performs a robust linear regression with high breakdown point and high efficiency regression. } \usage{ lmRob(formula, data, weights, subset, na.action, model = TRUE, x = FALSE, y = FALSE, contrasts = NULL, nrep = NULL, control = lmRob.control(...), ...) } \arguments{ \item{formula}{a \code{formula} object, with the response on the left of a ~ operator, and the terms, separated by \code{+} operators, on the right.} \item{data}{a \code{data.frame} in which to interpret the variables named in the \code{formula}, or in the \code{subset} and the \code{weights} argument. If this is missing, then the variables in the \code{formula} should be on the search list. This may also be a single number to handle some special cases - see below for details.} \item{weights}{vector of observation weights; if supplied, the algorithm fits to minimize the sum of a function of the square root of the weights multiplied into the residuals. The length of \code{weights} must be the same as the number of observations. The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous, compared to use of the \code{subset} argument.} \item{subset}{expression saying which subset of the rows of the data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), or a numeric vector indicating which observation numbers are to be included, or a character vector of the row names to be included. All observations are included by default.} \item{na.action}{a function to filter missing data. This is applied to the \code{model.frame} after any \code{subset} argument has been used. The default (with \code{na.fail}) is to create an error if any missing values are found. A possible alternative is \code{na.exclude}, which deletes observations that contain one or more missing values.} \item{model}{a logical flag: if \code{TRUE}, the model frame is returned in component \code{model}.} \item{x}{a logical flag: if \code{TRUE}, the model matrix is returned in component \code{x}.} \item{y}{a logical flag: if \code{TRUE}, the response is returned in component \code{y}.} \item{contrasts}{a list giving contrasts for some or all of the factors appearing in the model formula. The elements of the list should have the same name as the variable and should be either a contrast matrix (specifically, any full-rank matrix with as many rows as there are levels in the factor), or else a function to compute such a matrix given the number of levels.} %% MM: nrep should *really* be part of 'control', and hence %% lmRob.control() ! \item{nrep}{the number of random subsamples to be drawn. If \code{"Exhaustive"} resampling is being used, the value of \code{nrep} is ignored.} \item{control}{a list of control parameters to be used in the numerical algorithms. See \code{\link{lmRob.control}} for the possible control parameters and their default settings.} \item{\dots}{additional arguments are passed to the ccontrol functions.} } \value{ a list describing the regression. Note that the solution returned here is an approximation to the true solution based upon a random algorithm (except when \code{"Exhaustive"} resampling is chosen). Hence you will get (slightly) different answers each time if you make the same call with a different seed. See \code{\link{lmRob.control}} for how to set the seed, and see \code{\link{lmRob.object}} for a complete description of the object returned. } \details{ By default, the \code{lmRob} function automatically chooses an appropriate algorithm to compute a final robust estimate with high breakdown point and high efficiency. The final robust estimate is computed based on an initial estimate with high breakdown point. For the initial estimation, the alternate M-S estimate is used if there are any factor variables in the predictor matrix, and an S-estimate is used otherwise. To compute the S-estimate, a random resampling or a fast procedure is used unless the data set is small, in which case exhaustive resampling is employed. See \code{\link{lmRob.control}} for how to choose between the different algorithms. } \section{References}{ Gervini, D., and Yohai, V. J. (1999). A class of robust and fully efficient regression estimates; mimeo, Universidad de Buenos Aires. Marazzi, A. (1993). \emph{Algorithms, routines, and S functions for robust statistics}. Wadsworth & Brooks/Cole, Pacific Grove, CA. % Maronna, R. A., and Yohai, V. J. (1999). % Robust regression with both continuous and categorical predictors; % mimeo, Universidad de Buenos Aires. Maronna, R. A., and Yohai, V. J. (2000). Robust regression with both continuous and categorical predictors. \emph{Journal of Statistical Planning and Inference} \bold{89}, 197--214. Pena, D., and Yohai, V. (1999). A Fast Procedure for Outlier Diagnostics in Large Regression Problems. \emph{Journal of the American Statistical Association} \bold{94}, 434--445. Yohai, V. (1988). High breakdown-point and high efficiency estimates for regression. \emph{Annals of Statistics} \bold{15}, 642--665. Yohai, V., Stahel, W. A., and Zamar, R. H. (1991). A procedure for robust estimation and inference in linear regression; in Stahel, W. A. and Weisberg, S. W., Eds., \emph{Directions in robust statistics and diagnostics, Part II}. Springer-Verlag. } \seealso{ \code{\link{lmRob.control}}, \code{\link{lmRob.object}}. } \examples{ data(stack.dat) stack.rob <- lmRob(Loss ~ ., data = stack.dat) } \keyword{robust} \keyword{regression} \keyword{models} robust/man/gammaRob.Rd0000644000176000001440000000251213044465224014413 0ustar ripleyusers\name{gammaRob} \alias{gammaRob} \title{Robust Estimation of Gamma Distribution Parameters} \description{ Robust estimation of gamma distribution parameters } \usage{ gammaRob(x, estim = c("M", "tdmean"), control = gammaRob.control(estim, \dots), \dots) } \arguments{ \item{x}{a numeric vector containing the sample.} \item{estim}{a character string specifying which estimator to use.} \item{control}{a list of control parameters appropriate for the estimator in \code{estim}.} \item{\dots}{control parameters may also be given here.} } \value{ a list with class \dQuote{fitdstn} containing the following elements: \item{estimate}{a named numeric vector containing the parameter estimates.} \item{sd}{a named numeric vector containing the standard deviations of the parameter estimates.} \item{vcov}{a numeric matrix containing the variance-covariance matrix of the estimated parameter vector.} \item{mu}{a single numeric value containing an estimate of the mean.} \item{V.mu}{a single numeric value containing the variance of the estimated mean.} \item{control}{a list containing the control parameters used by the estimator.} The \code{print} method displays the estimated parameters and their standard errors (in parentheses). } \seealso{ \code{\link{gammaRob.control}}, \code{\link{fitdstnRob}}. } \keyword{robust} robust/man/glmRob.object.Rd0000644000176000001440000000566313044465224015367 0ustar ripleyusers\name{glmRob.object} \alias{glmRob.object} \title{Robust Generalized Linear Model Fit} \description{These are objects of class \code{glmRob} which represent the robust fit of a generalized linear regression model, as estimated by \code{glmRob()}.} \section{Methods}{ \code{anova}, \code{coefficients}, \code{deviance}, \code{fitted.values}, \code{family}, \code{formula}, \code{plot}, \code{print}, \code{residuals}, \code{summary}. } \section{Structure}{ The following components must be included in a legitimate \code{"glmRob"} object. Residuals, fitted values, and coefficients should be extracted by the generic functions of the same name, rather than by the \code{"\$"} operator. The \code{family} function returns the entire family object used in the fitting, and \code{deviance} can be used to extract the deviance of the fit. } \value{ \item{coefficients}{ the coefficients of the \code{linear.predictors}, which multiply the columns of the model matrix. The names of the coefficients are the names of the single-degree-of-freedom effects (the columns of the model matrix). If the model is over-determined there will be missing values in the coefficients corresponding to inestimable coefficients. } \item{linear.predictors}{ the linear fit, given by the product of the model matrix and the coefficients. } \item{fitted.values}{ the fitted mean values, obtained by transforming \code{linear.predictors} using the inverse link function. } \item{residuals}{ the residuals from the final fit; also known as working residuals, they are typically not interpretable. } \item{deviance}{ up to a constant, minus twice the log-likelihood evaluated at the final \code{coefficients}. Similar to the residual sum of squares. } \item{null.deviance}{ the deviance corresponding to the model with no predictors. } \item{family}{ a 3 element character vector giving the name of the family, the link and the variance function. } \item{rank}{ the number of linearly independent columns in the model matrix. } \item{df.residuals}{ the number of degrees of freedom of the residuals. } \item{call}{ a copy of the call that produced the object. } \item{assign}{ the same as the \code{assign} component of an \code{"lm"} object. } \item{contrasts}{ the same as the \code{contrasts} component of an \code{"lm"} object. } \item{terms}{ the same as the \code{terms} component of an \code{"lm"} object. } \item{ni}{ vector of the number of repetitions on the dependent variable. If the model is poisson then \code{ni} is a vector of \code{1}s. } \item{weights}{ weights from the final fit. } \item{iter}{ number of iterations used to compute the estimates. } \item{y}{ the dependent variable. } \item{contrasts}{ the same as the \code{contrasts} term of an \code{"lm"} object. The object will also contain other components related to the numerical fit that are not relevant for the associated methods. } } \seealso{ \code{\link{glmRob}}. } \keyword{robust} \keyword{regression} \keyword{models} robust/man/distancePlot.covfm.Rd0000644000176000001440000000210213044465224016423 0ustar ripleyusers\name{distancePlot.covfm} \alias{distancePlot.covfm} \title{Side-by-Side Mahalanobis Distance Plot} \description{ Produces side-by-side plots of Mahalanobis distance computed using the location and covariance matrix estimates contained in each element of a \code{covfm} object. } \usage{ distancePlot.covfm(x, level = 0.95, id.n = 3, ...) } \arguments{ \item{x}{a \code{"covfm"} object.} \item{level}{a single numeric value between 0 and 1 giving the chi-squared percent point used to compute the outlyingness threshold.} \item{id.n}{a single nonnegative integer specifying the number of extreme points to label in the plot.} \item{\dots}{additional arguments are passed to \code{xyplot}.} } \value{ the \code{trellis} object is invisibly returned. } \examples{ data(woodmod.dat) woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), data = woodmod.dat) distancePlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", ylab = "y-axis label", pch = 4, col = "purple") } \keyword{hplot} robust/man/stack.dat.Rd0000644000176000001440000000145313044465224014545 0ustar ripleyusers\name{stack.dat} \alias{stack.dat} \title{ Brownlee's Stack-Loss Data } \description{ These data are from the operation of a plant for the oxidation of ammonia to nitric acid, measured on 21 consecutive days. } \usage{ data(stack.dat) } \format{ This data frame contains the following variables: \describe{ \item{Loss}{the percentage of ammonia lost (times 10).} \item{Air.Flow}{air flow into the plant} \item{Water.Temp}{cooling water inlet temperature.} \item{Acid.Conc.}{acid concentration as a percentage (coded by subtracting 50 and then multiplying by 10).} } } \source{ Brownlee, K.A. (1965). \emph{Statistical Theory and Methodology in Science and Engineering}. New York: John Wiley & Sons, Inc. } \examples{ data(stack.dat) stack.dat } \keyword{datasets} robust/man/test.lmRob.Rd0000644000176000001440000000346213044465224014724 0ustar ripleyusers\name{test.lmRob} \alias{test.lmRob} \title{Various Tests of Robust Regression Estimates } \description{ Conducts test for bias of robust MM-estimates and Least Squares (LS) estimates against S-estimates, or permutation test of the slope estimate in a straight line fit. } \usage{ test.lmRob(object, type = "bias", level = NULL, n.permute = 99) } \arguments{ \item{object}{an object of class \code{"lmRob"}.} \item{type}{character string. Valid choices are \code{"bias"} for bias test, or "permutation" for permutation test.} \item{level}{the level of the test for bias of MM-estimate. By default, the \code{level} component of \code{object$robust.control} is used.} \item{n.permute}{a positive integer value specifying the number of permutations to use.} } \value{ the p-value of the permutation test, or an object of class \code{"biasMM"} representing the bias test, in which case the following components ARE included: \item{mm}{a list describing the test of bias for final MM-estimates, with the following components: \code{stat}, the t-statistic; \code{pchi}, a chi-squared p-value; \code{qchi}, the quantile of the chi-squared distribution with degrees of freedom equal to \code{object\$rank} corresponding to the probability input in the level (\code{object$robust.control$level}).} \item{ls}{a list describing the test of bias for LS-estimates, with the following components: \code{stat}, the t-statistic; \code{pchi}, a chi-squared p-value.} \item{level}{the level of the test for bias of MM-estimate.} } \section{References}{ Yohai, V., Stahel, W. A., and Zamar, R. H. (1991). A procedure for robust estimation and inference in linear regression, in Stahel, W. A. and Weisberg, S. W., Eds., \emph{Directions in robust statistics and diagnostics, Part II}. Springer-Verlag. } \keyword{robust} \keyword{regression} robust/DESCRIPTION0000644000176000001440000000214413601152344013326 0ustar ripleyusersPackage: robust Version: 0.4-18.2 Date: 2017-04-26 Title: Port of the S+ "Robust Library" Description: Methods for robust statistics, a state of the art in the early 2000s, notably for robust regression and robust multivariate analysis. Author: Jiahui Wang, Ruben Zamar , Alfio Marazzi , Victor Yohai , Matias Salibian-Barrera , Ricardo Maronna , Eric Zivot , David Rocke , Doug Martin, Martin Maechler , Kjell Konis . Maintainer: ORPHANED Depends: fit.models Imports: graphics, stats, utils, lattice, MASS, robustbase, rrcov License: GPL-2 NeedsCompilation: yes Packaged: 2019-12-26 15:33:24 UTC; ripley Repository: CRAN Date/Publication: 2019-12-26 15:42:28 UTC X-CRAN-Original-Maintainer: Kjell Konis X-CRAN-Comment: Orphaned and corrected on 2019-07-02 as installation issues were not addressed. . LTO robust/tests/0000755000176000001440000000000013044712567012773 5ustar ripleyusersrobust/tests/Run-tests.R0000644000176000001440000000274213044465224015022 0ustar ripleyuserslibrary(robust) sessionInfo() testTRUEfile <- function(file, srcfile = NULL, verbose = TRUE) { exps <- parse(file = file, srcfile=srcfile) if(verbose) cat(length(exps)," expressions :\n") for(i in seq_along(exps)) { if(verbose) cat(" ") if(!isTRUE(eval(exps[[i]], envir = .GlobalEnv))) { ch.ex <- paste(substr(paste(format(exps[[i]])[-1], collapse = " ; "), 1, 60), "...") ## For testing many at once: warning("*** ", ch.ex," was *not* TRUE", immediate. = TRUE) ## Once, the tests work ## stop("*** ", ch.ex," was *not* TRUE") } if(verbose) cat(i %% 10) } } tDir <- system.file("tests_S", package = "robust") tstFiles <- list.files(tDir, pattern = "\\.t$") ## Remove those that are not (yet) available for package 'robust' : .not.yet <- c("asymmetric.t", ## robust & MLE Gamma, Weibull, ... "plots.wblrob.t", ## gammaRob(), weibullRob() not ported "discrob.t", ## robust discrimn.analysis: discRob() not ported "princomprob.t", ## princompRob() not ported "plots.princomprob.t", ## ditto "plots.aovrob.t", ## aovRob() not ported __ FIXME: use lawson data in lmRob()! "covm.t", ## loc/scat estimators all come from robustbase/rrcov now "") (tstFiles <- tstFiles[! match(tstFiles, .not.yet, nomatch=0)]) for(f in tstFiles) { cat("Test File", f,": ") testTRUEfile(file.path(tDir, f), verbose = TRUE) cat("\n\n") } robust/tests/Examples/0000755000176000001440000000000013067233543014546 5ustar ripleyusersrobust/tests/Examples/robust-Ex.Rout.save0000644000176000001440000007215413601151156020250 0ustar ripleyusers R Under development (unstable) (2019-12-26 r77621) -- "Unsuffered Consequences" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "robust" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('robust') Loading required package: fit.models > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("OverlaidDenPlot.fdfm") > ### * OverlaidDenPlot.fdfm > > flush(stderr()); flush(stdout()) > > ### Name: overlaidDenPlot.fdfm > ### Title: Overlaid Density Plot > ### Aliases: overlaidDenPlot.fdfm > ### Keywords: hplot > > ### ** Examples > > data(los, package="robustbase") > los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), + x = los, densfun = "gamma") > overlaidDenPlot.fdfm(los.fm, xlab = "x-axis label", ylab = "y-axis label", + main = "Plot Title") > > > > cleanEx() > nameEx("anova.glmRob") > ### * anova.glmRob > > flush(stderr()); flush(stdout()) > > ### Name: anova.glmRob > ### Title: ANOVA for Robust Generalized Linear Model Fits > ### Aliases: anova.glmRob anova.glmRoblist > ### Keywords: robust regression methods > > ### ** Examples > > data(breslow.dat) > > bres.int <- glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), data = breslow.dat) > anova(bres.int) Analysis of Deviance Table poisson model Response: sumY Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev NULL 58 11983.1 Age10 1 9125.7 57 2857.5 Base4 1 803.0 56 2054.5 Trt 1 -884.6 55 2939.1 Base4:Trt 1 -949.1 54 3888.2 > > bres.main <- glmRob(sumY ~ Age10 + Base4 + Trt, family = poisson(), data = breslow.dat) > anova(bres.main, bres.int) Terms Resid. Df Resid. Dev Test Df Deviance 1 Age10 + Base4 + Trt 55 2939.072 NA NA 2 Age10 + Base4 * Trt 54 3888.204 +Base4:Trt 1 -949.1315 > > > > cleanEx() > nameEx("anova.lmRob") > ### * anova.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: anova.lmRob > ### Title: ANOVA for Robust Linear Model Fits > ### Aliases: anova.lmRob anova.lmRoblist > ### Keywords: robust regression methods > > ### ** Examples > > data(stack.dat) > stack.small <- lmRob(Loss ~ Water.Temp + Acid.Conc., data = stack.dat) > stack.full <- lmRob(Loss ~ ., data = stack.dat) > anova(stack.full) Terms added sequentially (first to last) Chisq Df RobustF Pr(F) (Intercept) 1 Air.Flow 1 41.228 6.026e-11 *** Water.Temp 1 6.522 0.009257 ** Acid.Conc. 1 0.551 0.449386 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > anova(stack.full, stack.small) Response: Loss Terms Df RobustF Pr(F) [1,] 1 1 [2,] 2 1 1 27.354 9.839e-08 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > > > cleanEx() > nameEx("breslow.dat") > ### * breslow.dat > > flush(stderr()); flush(stdout()) > > ### Name: breslow.dat > ### Title: Breslow Data > ### Aliases: breslow.dat > ### Keywords: datasets > > ### ** Examples > > data(breslow.dat) > > > > cleanEx() > nameEx("covClassic") > ### * covClassic > > flush(stderr()); flush(stdout()) > > ### Name: covClassic > ### Title: Classical Covariance Estimation > ### Aliases: covClassic > ### Keywords: robust multivariate > > ### ** Examples > > data(stack.dat) > covClassic(stack.dat) Call: covClassic(data = stack.dat) Classical Estimate of Covariance: Loss Air.Flow Water.Temp Acid.Conc. Loss 103.46 85.76 28.148 21.793 Air.Flow 85.76 84.06 22.657 24.571 Water.Temp 28.15 22.66 9.990 6.621 Acid.Conc. 21.79 24.57 6.621 28.714 Classical Estimate of Location: Loss Air.Flow Water.Temp Acid.Conc. 17.52 60.43 21.10 86.29 > > > > cleanEx() > nameEx("covRob") > ### * covRob > > flush(stderr()); flush(stdout()) > > ### Name: covRob > ### Title: Robust Covariance/Correlation Matrix Estimation > ### Aliases: covRob > ### Keywords: multivariate robust > > ### ** Examples > > data(stackloss) > covRob(stackloss) Call: covRob(data = stackloss) Robust Estimate of Covariance: Air.Flow Water.Temp Acid.Conc. stack.loss Air.Flow 33.93 11.203 22.135 29.41 Water.Temp 11.20 8.298 8.794 12.03 Acid.Conc. 22.14 8.794 37.887 17.60 stack.loss 29.41 12.030 17.605 28.17 Robust Estimate of Location: Air.Flow Water.Temp Acid.Conc. stack.loss 56.92 20.43 86.29 13.73 > > > > cleanEx() > nameEx("covRob.control") > ### * covRob.control > > flush(stderr()); flush(stdout()) > > ### Name: covRob.control > ### Title: Control Parameters for Robust Covariance Estimation > ### Aliases: covRob.control > ### Keywords: utilities > > ### ** Examples > > mcd.control <- covRob.control("mcd", quan = 0.75, ntrial = 1000) > > ds.control <- covRob.control("donostah", prob = 0.95) > > qc.control <- covRob.control("pairwiseqc") > > > > cleanEx() > nameEx("ddPlot.covfm") > ### * ddPlot.covfm > > flush(stderr()); flush(stdout()) > > ### Name: ddPlot.covfm > ### Title: Distance - Distance Plot > ### Aliases: ddPlot.covfm > ### Keywords: hplot > > ### ** Examples > > data(woodmod.dat) > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > ddPlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", + ylab = "y-axis label", pch = 4, col = "purple") > > > > cleanEx() > nameEx("distancePlot.covfm") > ### * distancePlot.covfm > > flush(stderr()); flush(stdout()) > > ### Name: distancePlot.covfm > ### Title: Side-by-Side Mahalanobis Distance Plot > ### Aliases: distancePlot.covfm > ### Keywords: hplot > > ### ** Examples > > data(woodmod.dat) > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > distancePlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", + ylab = "y-axis label", pch = 4, col = "purple") > > > > cleanEx() > nameEx("drop1.lmRob") > ### * drop1.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: drop1.lmRob > ### Title: Compute an Anova Object by Dropping Terms > ### Aliases: drop1.lmRob > ### Keywords: robust regression methods > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > drop1(stack.rob) Single term deletions Model: Loss ~ Air.Flow + Water.Temp + Acid.Conc. scale: 1.837073 Df RFPE 16.032 Air.Flow 1 36.213 Water.Temp 1 20.829 Acid.Conc. 1 16.049 > > > > cleanEx() > nameEx("ellipsesPlot.covfm") > ### * ellipsesPlot.covfm > > flush(stderr()); flush(stdout()) > > ### Name: ellipsesPlot.covfm > ### Title: Ellipses Plot - Visual Correlation Matrix Comparison > ### Aliases: ellipsesPlot.covfm > ### Keywords: hplot > > ### ** Examples > > data(woodmod.dat) > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > ellipsesPlot.covfm(woodm.fm) > > > > cleanEx() > nameEx("glmRob") > ### * glmRob > > flush(stderr()); flush(stdout()) > > ### Name: glmRob > ### Title: Fit a Robust Generalized Linear Model > ### Aliases: glmRob > ### Keywords: robust regression models > > ### ** Examples > > data(breslow.dat) > > glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), + data = breslow.dat, method = "cubif") Call: glmRob(formula = sumY ~ Age10 + Base4 * Trt, family = poisson(), data = breslow.dat, method = "cubif") Coefficients: (Intercept) Age10 Base4 Trtprogabide 1.83516 0.12081 0.13915 -0.39279 Base4:Trtprogabide 0.02182 Degrees of Freedom: 59 Total; 54 Residual Residual Deviance: 3888 > > > > cleanEx() > nameEx("glmRob.mallows") > ### * glmRob.mallows > > flush(stderr()); flush(stdout()) > > ### Name: glmRob.mallows > ### Title: Mallows Type Estimator > ### Aliases: glmRob.mallows > ### Keywords: robust regression > > ### ** Examples > > data(mallows.dat) > > glmRob(y ~ a + b + c, data = mallows.dat, family = binomial(), method = 'mallows') Call: glmRob(formula = y ~ a + b + c, family = binomial(), data = mallows.dat, method = "mallows") Coefficients: (Intercept) a b c -2.04642 0.10810 0.08633 0.12584 Degrees of Freedom: 70 Total; 66 Residual Residual Deviance: 40.06 > > > > cleanEx() > nameEx("glmRob.misclass") > ### * glmRob.misclass > > flush(stderr()); flush(stdout()) > > ### Name: glmRob.misclass > ### Title: Consistent Misclassification Estimator > ### Aliases: glmRob.misclass > ### Keywords: robust regression > > ### ** Examples > > data(leuk.dat) > > glmRob(y ~ ag + wbc, data = leuk.dat, family = binomial(), method = 'misclass') Call: glmRob(formula = y ~ ag + wbc, family = binomial(), data = leuk.dat, method = "misclass") Coefficients: (Intercept) ag wbc -1.265e+00 2.219e+00 -3.276e-05 Degrees of Freedom: 33 Total; 30 Residual Residual Deviance: 29.59 > > > > cleanEx() > nameEx("leuk.dat") > ### * leuk.dat > > flush(stderr()); flush(stdout()) > > ### Name: leuk.dat > ### Title: Leuk Data > ### Aliases: leuk.dat > ### Keywords: datasets > > ### ** Examples > > data(leuk.dat) > > > > cleanEx() > nameEx("lmRob") > ### * lmRob > > flush(stderr()); flush(stdout()) > > ### Name: lmRob > ### Title: High Breakdown and High Efficiency Robust Linear Regression > ### Aliases: lmRob > ### Keywords: robust regression models > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > > > > cleanEx() > nameEx("lmRob.RFPE") > ### * lmRob.RFPE > > flush(stderr()); flush(stdout()) > > ### Name: lmRob.RFPE > ### Title: Robust Final Prediction Errors > ### Aliases: lmRob.RFPE > ### Keywords: robust regression > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > lmRob.RFPE(stack.rob) [1] 16.03201 > > > > cleanEx() > nameEx("lmRob.control") > ### * lmRob.control > > flush(stderr()); flush(stdout()) > > ### Name: lmRob.control > ### Title: Control Parameters for Robust Linear Regression > ### Aliases: lmRob.control > ### Keywords: robust regression > > ### ** Examples > > data(stack.dat) > my.control <- lmRob.control(weight=c("Bisquare","Optimal")) > stack.bo <- lmRob(Loss ~ ., data = stack.dat, control = my.control) > > > > cleanEx() > nameEx("lsRobTest") > ### * lsRobTest > > flush(stderr()); flush(stdout()) > > ### Name: lsRobTest > ### Title: Bias Test for Least-Squares Regression Estimates > ### Aliases: lsRobTest > ### Keywords: robust regression > > ### ** Examples > > rob.fit <- lmRob(stack.loss ~ ., data = stackloss) > lsRobTest(rob.fit) Test for least squares bias H0: composite normal/non-normal regression error distribution Individual coefficient tests: LS Robust Delta Std. Error Stat p-value Air.Flow 0.7156 0.79769 -0.08205 0.1353 -0.6064 0.54427 Water.Temp 1.2953 0.57734 0.71795 0.3366 2.1332 0.03291 Acid.Conc. -0.1521 -0.06706 -0.08506 0.1200 -0.7091 0.47824 Joint test for bias: Test statistic: 6.61 on 3 DF, p-value: 0.08541 > lsRobTest(rob.fit, test = "T1") Test for least squares bias H0: normal regression error distribution Individual coefficient tests: LS Robust Delta Std. Error Stat p-value Air.Flow 0.7156 0.79769 -0.08205 0.02101 -3.906 9.388e-05 Water.Temp 1.2953 0.57734 0.71795 0.05225 13.741 5.764e-43 Acid.Conc. -0.1521 -0.06706 -0.08506 0.01862 -4.568 4.928e-06 Joint test for bias: Test statistic: 274.3 on 3 DF, p-value: 0 > > > > cleanEx() > nameEx("mallows.dat") > ### * mallows.dat > > flush(stderr()); flush(stdout()) > > ### Name: mallows.dat > ### Title: Mallows Data > ### Aliases: mallows.dat > ### Keywords: datasets > > ### ** Examples > > data(mallows.dat) > > > > cleanEx() > nameEx("plot.covfm") > ### * plot.covfm > > flush(stderr()); flush(stdout()) > > ### Name: plot.covfm > ### Title: Plot Method > ### Aliases: plot.covfm plot.covRob plot.covClassic > ### Keywords: methods hplot > > ### ** Examples > > data(woodmod.dat) > > woodm.cov <- covClassic(woodmod.dat) > woodm.covRob <- covRob(woodmod.dat) > > plot(woodm.cov) > plot(woodm.covRob) > > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > plot(woodm.fm) > > > > cleanEx() > nameEx("plot.fdfm") > ### * plot.fdfm > > flush(stderr()); flush(stdout()) > > ### Name: plot.fdfm > ### Title: fdfm Plot Method > ### Aliases: plot.fdfm > ### Keywords: hplot > > ### ** Examples > > data(los, package = "robustbase") > los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), + x = los, densfun = "gamma") > plot(los.fm) > > > > cleanEx() > nameEx("plot.lmRob") > ### * plot.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: plot.lmRob > ### Title: Diagnostic Regression Plots > ### Aliases: plot.lmRob > ### Keywords: methods hplot > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > plot(stack.rob, which.plots = 6) > > > > cleanEx() > nameEx("predict.glmRob") > ### * predict.glmRob > > flush(stderr()); flush(stdout()) > > ### Name: predict.glmRob > ### Title: Predict Method for Robust Generalized Linear Model Fits > ### Aliases: predict.glmRob > ### Keywords: robust regression methods > > ### ** Examples > > data(breslow.dat) > bres.rob <- glmRob(sumY ~ Age10 + Base4 * Trt, family = poisson(), data = breslow.dat) > predict(bres.rob) 1 2 3 4 5 6 7 8 2.592342 2.580261 2.345916 2.548386 4.396928 3.124781 2.627130 4.151528 9 10 11 12 13 14 15 16 3.082281 2.521311 4.079040 3.273100 2.739205 3.731164 5.175793 3.888652 17 18 19 20 21 22 23 24 2.799611 6.071102 2.847937 2.784617 2.602967 2.401954 2.813149 3.111243 25 26 27 28 29 30 31 32 4.110915 2.631499 2.412579 3.735964 4.718229 3.358170 2.448596 2.207231 33 34 35 36 37 38 39 40 2.424433 2.698131 3.052314 2.428606 2.211229 4.380213 3.358083 2.062342 41 42 43 44 45 46 47 48 2.605566 2.448770 3.692188 3.144792 3.394414 2.026098 3.205198 2.187066 49 50 51 52 53 54 55 56 7.784706 2.714298 3.394327 3.152962 3.949632 2.903514 2.472846 2.641810 57 58 59 2.702129 2.400445 2.372284 > > > > cleanEx() > nameEx("predict.lmRob") > ### * predict.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: predict.lmRob > ### Title: Use predict() on an lmRob Object > ### Aliases: predict.lmRob > ### Keywords: robust regression methods > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > predict(stack.rob) 1 2 3 4 5 6 7 8 35.782223 35.849283 30.572054 19.825981 18.671300 19.248641 19.423620 19.423620 9 10 11 12 13 14 15 16 16.057899 13.640618 13.037076 12.526796 13.506497 13.346176 6.655592 6.856772 17 18 19 20 21 8.372955 7.903534 8.413814 13.065807 23.629863 > predict(stack.rob, newdata = stack.dat[c(1,2,4,21), ], se.fit = TRUE) $fit 1 2 4 21 35.78222 35.84928 19.82598 23.62986 $se.fit 1 2 4 21 1.0869527 1.1059685 0.5557136 0.9526912 $residual.scale [1] 1.837073 $df [1] 17 > > > > cleanEx() > nameEx("qqPlot.fdfm") > ### * qqPlot.fdfm > > flush(stderr()); flush(stdout()) > > ### Name: qqPlot.fdfm > ### Title: Comparison Quantile-Quantile Plot > ### Aliases: qqPlot.fdfm > ### Keywords: hplot > > ### ** Examples > > data(los, package = "robustbase") > los.fm <- fit.models(c(Robust = "fitdstnRob", MLE = "fitdstn"), + x = los, densfun = "gamma") > qqPlot.fdfm(los.fm, xlab = "x-axis label", ylab = "y-axis label", + main = "Plot Title", pch = 4, col = "purple") > > > > cleanEx() > nameEx("screePlot.covfm") > ### * screePlot.covfm > > flush(stderr()); flush(stdout()) > > ### Name: screePlot.covfm > ### Title: Comparison Screeplot > ### Aliases: screePlot.covfm > ### Keywords: hplot > > ### ** Examples > > data(woodmod.dat) > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > screePlot.covfm(woodm.fm, main = "Plot Title", xlab = "x-axis label", + ylab = "y-axis label", pch = 4:5) > > > > cleanEx() > nameEx("stack.dat") > ### * stack.dat > > flush(stderr()); flush(stdout()) > > ### Name: stack.dat > ### Title: Brownlee's Stack-Loss Data > ### Aliases: stack.dat > ### Keywords: datasets > > ### ** Examples > > data(stack.dat) > stack.dat Loss Air.Flow Water.Temp Acid.Conc. 1 42 80 27 89 2 37 80 27 88 3 37 75 25 90 4 28 62 24 87 5 18 62 22 87 6 18 62 23 87 7 19 62 24 93 8 20 62 24 93 9 15 58 23 87 10 14 58 18 80 11 14 58 18 89 12 13 58 17 88 13 11 58 18 82 14 12 58 19 93 15 8 50 18 89 16 7 50 18 86 17 8 50 19 72 18 8 50 19 79 19 9 50 20 80 20 15 56 20 82 21 15 70 20 91 > > > > cleanEx() > nameEx("step.lmRob") > ### * step.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: step.lmRob > ### Title: Build a Model in a Stepwise Fashion > ### Aliases: step.lmRob > ### Keywords: robust regression methods > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > > ## The default behavior is to try dropping all terms ## > step.lmRob(stack.rob) Start: RFPE= 16.032 Loss ~ Air.Flow + Water.Temp + Acid.Conc. Single term deletions Model: Loss ~ Air.Flow + Water.Temp + Acid.Conc. scale: 1.837073 Df RFPE 16.032 Air.Flow 1 36.213 Water.Temp 1 20.829 Acid.Conc. 1 16.049 Call: lmRob(formula = Loss ~ ., data = stack.dat) Coefficients: (Intercept) Air.Flow Water.Temp Acid.Conc. -37.65246 0.79769 0.57734 -0.06706 > > ## Keep Water.Temp in the model ## > my.scope <- list(lower = . ~ Water.Temp, upper = . ~ .) > step.lmRob(stack.rob, scope = my.scope) Start: RFPE= 16.032 Loss ~ Air.Flow + Water.Temp + Acid.Conc. Single term deletions Model: Loss ~ Air.Flow + Water.Temp + Acid.Conc. scale: 1.837073 Df RFPE 16.032 Air.Flow 1 36.213 Acid.Conc. 1 16.049 Call: lmRob(formula = Loss ~ ., data = stack.dat) Coefficients: (Intercept) Air.Flow Water.Temp Acid.Conc. -37.65246 0.79769 0.57734 -0.06706 > > > > cleanEx() > nameEx("summary.covfm") > ### * summary.covfm > > flush(stderr()); flush(stdout()) > > ### Name: summary.covfm > ### Title: Summary Method > ### Aliases: summary.covClassic summary.covRob summary.covfm > ### Keywords: methods > > ### ** Examples > > data(woodmod.dat) > woodm.cov <- covClassic(woodmod.dat) > ## IGNORE_RDIFF_BEGIN > summary(woodm.cov) Call: covClassic(data = woodmod.dat) Classical Estimate of Covariance: V1 V2 V3 V4 V5 V1 0.0082920 -0.0002912 0.003602 0.0026908 -0.0028684 V2 -0.0002912 0.0004888 -0.000352 -0.0008388 0.0006124 V3 0.0036022 -0.0003520 0.004185 0.0015788 -0.0016916 V4 0.0026908 -0.0008388 0.001579 0.0039462 -0.0007920 V5 -0.0028684 0.0006124 -0.001692 -0.0007920 0.0027570 Classical Estimate of Location: V1 V2 V3 V4 V5 0.5508 0.1330 0.5087 0.5112 0.9070 Eigenvalues: Eval. 1 Eval. 2 Eval. 3 Eval. 4 Eval. 5 0.0128527 0.0029621 0.0021125 0.0016344 0.0001075 Squared Mahalanobis Distances: 1 2 3 4 5 6 7 8 9 10 11 12 13 4.327 1.552 3.224 3.959 3.277 3.974 9.124 4.536 5.665 7.588 5.075 6.833 4.506 14 15 16 17 18 19 20 1.500 1.945 9.049 4.548 4.637 4.599 5.084 > ## IGNORE_RDIFF_END > > woodm.covRob <- covRob(woodmod.dat) > summary(woodm.covRob) Call: covRob(data = woodmod.dat) Robust Estimate of Covariance: V1 V2 V3 V4 V5 V1 0.038232 0.0066282 -0.0021650 -0.0015136 -0.0048570 V2 0.006628 0.0016512 0.0001382 -0.0010400 -0.0003837 V3 -0.002165 0.0001382 0.0036709 0.0001514 0.0015113 V4 -0.001514 -0.0010400 0.0001514 0.0048313 -0.0014409 V5 -0.004857 -0.0003837 0.0015113 -0.0014409 0.0044166 Robust Estimate of Location: V1 V2 V3 V4 V5 0.5693 0.1189 0.5093 0.5399 0.8964 Eigenvalues: Eval. 1 Eval. 2 Eval. 3 Eval. 4 Eval. 5 0.0402612 0.0063495 0.0039998 0.0019171 0.0002747 Squared Robust Distances: [1] 1.2996 0.3348 0.4099 15.8192 0.4578 18.0052 8.5876 24.2857 8.1617 [10] 5.1665 2.0412 5.3157 5.7099 0.2672 0.3173 5.5845 3.4097 0.4362 [19] 25.9520 3.5364 > > woodm.fm <- fit.models(list(Robust = "covRob", Classical = "covClassic"), + data = woodmod.dat) > summary(woodm.fm) Calls: Robust : covRob(data = woodmod.dat) Classical : covClassic(data = woodmod.dat) Comparison of Covariance/Correlation Estimates: (unique correlation terms) [1,1] [2,1] [3,1] [4,1] [5,1] [2,2] Robust 0.038232 0.0066282 -0.002165 -0.001514 -0.004857 0.0016512 Classical 0.008292 -0.0002912 0.003602 0.002691 -0.002868 0.0004888 [3,2] [4,2] [5,2] [3,3] [4,3] [5,3] Robust 0.0001382 -0.0010400 -0.0003837 0.003671 0.0001514 0.001511 Classical -0.0003520 -0.0008388 0.0006124 0.004185 0.0015788 -0.001692 [4,4] [5,4] [5,5] Robust 0.004831 -0.001441 0.004417 Classical 0.003946 -0.000792 0.002757 Comparison of Location Estimates: V1 V2 V3 V4 V5 Robust 0.5693 0.1189 0.5093 0.5399 0.8964 Classical 0.5508 0.1330 0.5087 0.5112 0.9070 Comparison of Eigenvalues: Eval. 1 Eval. 2 Eval. 3 Eval. 4 Eval. 5 Robust 0.04026 0.006349 0.004000 0.001917 0.0002747 Classical 0.01285 0.002962 0.002112 0.001634 0.0001075 > > > > cleanEx() > nameEx("summary.glmRob") > ### * summary.glmRob > > flush(stderr()); flush(stdout()) > > ### Name: summary.glmRob > ### Title: Summarizing Robust Generalized Linear Model Fits > ### Aliases: summary.glmRob > ### Keywords: methods robust regression > > ### ** Examples > > data(breslow.dat) > bres.rob <- glmRob(sumY ~ Age10 + Base4*Trt, family = poisson(), data = breslow.dat) > bres.sum <- summary(bres.rob) > bres.sum Call: glmRob(formula = sumY ~ Age10 + Base4 * Trt, family = poisson(), data = breslow.dat) Deviance Residuals: Min 1Q Median 3Q Max -54.31624 -1.48734 0.04103 0.87948 8.92507 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1.83516 0.28542 6.4296 1.279e-10 Age10 0.12081 0.07495 1.6118 1.070e-01 Base4 0.13915 0.03541 3.9298 8.501e-05 Trtprogabide -0.39279 0.22101 -1.7772 7.554e-02 Base4:Trtprogabide 0.02182 0.04003 0.5451 5.857e-01 (Dispersion Parameter for poisson family taken to be 1 ) Null Deviance: 11983 on 58 degrees of freedom Residual Deviance: 3888.204 on 54 degrees of freedom Number of Iterations: 9 Correlation of Coefficients: (Intercept) Age10 Base4 Trtprogabide Age10 -0.80956 Base4 -0.62030 0.10855 Trtprogabide -0.46447 0.02404 0.69012 Base4:Trtprogabide 0.52264 -0.06402 -0.88082 -0.89436 > > > > cleanEx() > nameEx("summary.lmRob") > ### * summary.lmRob > > flush(stderr()); flush(stdout()) > > ### Name: summary.lmRob > ### Title: Summarizing Robust Linear Model Fits > ### Aliases: summary.lmRob > ### Keywords: methods robust regression > > ### ** Examples > > data(stack.dat) > stack.rob <- lmRob(Loss ~ ., data = stack.dat) > stack.sum <- summary(stack.rob) > stack.sum Call: lmRob(formula = Loss ~ ., data = stack.dat) Residuals: Min 1Q Median 3Q Max -8.6299 -0.6713 0.3594 1.1507 8.1740 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -37.65246 5.00256 -7.527 8.29e-07 *** Air.Flow 0.79769 0.07129 11.189 2.91e-09 *** Water.Temp 0.57734 0.17546 3.291 0.00432 ** Acid.Conc. -0.06706 0.06512 -1.030 0.31757 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.837 on 17 degrees of freedom Multiple R-Squared: 0.6205 Test for Bias: statistic p-value M-estimate 2.751 0.6004 LS-estimate 2.640 0.6197 > stack.bse <- summary(stack.rob, bootstrap.se = TRUE) > stack.bse Call: lmRob(formula = Loss ~ ., data = stack.dat) Residuals: Min 1Q Median 3Q Max -8.6299 -0.6713 0.3594 1.1507 8.1740 Coefficients: Estimate Std. Error Bootstrap SE t value Pr(>|t|) (Intercept) -37.65246 5.00256 4.43790 -7.527 8.29e-07 *** Air.Flow 0.79769 0.07129 0.05086 11.189 2.91e-09 *** Water.Temp 0.57734 0.17546 0.13551 3.291 0.00432 ** Acid.Conc. -0.06706 0.06512 0.05842 -1.030 0.31757 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.837 on 17 degrees of freedom Multiple R-Squared: 0.6205 Test for Bias: statistic p-value M-estimate 2.751 0.6004 LS-estimate 2.640 0.6197 > > > > cleanEx() > nameEx("weight.funs") > ### * weight.funs > > flush(stderr()); flush(stdout()) > > ### Name: weight.funs > ### Title: Weight Functions Psi, Rho, Chi > ### Aliases: psi.weight rho.weight psp.weight chi.weight > ### Keywords: robust > > ### ** Examples > > x <- seq(-4,4, length=401) > f.x <- cbind(psi = psi.weight(x), psp = psp.weight(x), + chi = chi.weight(x), rho = rho.weight(x)) > es <- expression(psi(x), {psi*minute}(x), chi(x), rho(x)) > leg <- as.expression(lapply(seq_along(es), function(i) + substitute(C == E, list(C=colnames(f.x)[i], E=es[[i]])))) > matplot(x, f.x, type = "l", lwd = 1.5, + main = "psi.weight(.) etc -- 'optimal'") > abline(h = 0, v = 0, lwd = 2, col = "#D3D3D380") # opaque gray > legend("bottom", leg, inset = .01, + lty = 1:4, col = 1:4, lwd = 1.5, bg = "#FFFFFFC0") > > > > cleanEx() > nameEx("woodmod.dat") > ### * woodmod.dat > > flush(stderr()); flush(stdout()) > > ### Name: woodmod.dat > ### Title: Modified Wood Data > ### Aliases: woodmod.dat > ### Keywords: datasets > > ### ** Examples > > data(woodmod.dat) > woodmod.dat V1 V2 V3 V4 V5 1 0.573 0.1059 0.465 0.538 0.841 2 0.651 0.1356 0.527 0.545 0.887 3 0.606 0.1273 0.494 0.521 0.920 4 0.437 0.1591 0.446 0.423 0.992 5 0.547 0.1135 0.531 0.519 0.915 6 0.444 0.1628 0.429 0.411 0.984 7 0.489 0.1231 0.562 0.455 0.824 8 0.413 0.1673 0.418 0.430 0.978 9 0.536 0.1182 0.592 0.464 0.854 10 0.685 0.1564 0.631 0.564 0.914 11 0.664 0.1588 0.506 0.481 0.867 12 0.703 0.1335 0.519 0.484 0.812 13 0.653 0.1395 0.625 0.519 0.892 14 0.586 0.1114 0.505 0.565 0.889 15 0.534 0.1143 0.521 0.570 0.889 16 0.523 0.1320 0.505 0.612 0.919 17 0.580 0.1249 0.546 0.608 0.954 18 0.448 0.1028 0.522 0.534 0.918 19 0.417 0.1687 0.405 0.415 0.981 20 0.528 0.1057 0.424 0.566 0.909 > > data(wood, package = "robustbase") > stopifnot(data.matrix(woodmod.dat) == + data.matrix(wood [,1:5])) > > > > ### *