File: Animals2.Rd

package info (click to toggle)
robustbase 0.99-4-1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,552 kB
  • sloc: fortran: 3,245; ansic: 3,243; sh: 15; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 2,038 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
\name{Animals2}
\alias{Animals2}
\title{Brain and Body Weights for 65 Species of Land Animals}
\description{
  A data frame with average brain and body weights for 62 species
  of land mammals and three others.

  Note that this is simply the union of \code{\link[MASS]{Animals}}
  and \code{\link[MASS]{mammals}}.
}
\usage{
Animals2
}
\format{
  \describe{
    \item{\code{body}}{body weight in kg}
    \item{\code{brain}}{brain weight in g}
  }
}
\source{
  Weisberg, S. (1985)
  \emph{Applied Linear Regression.}
  2nd edition.
  Wiley, pp. 144--5.

  P. J. Rousseeuw  and A. M. Leroy (1987)
  \emph{Robust Regression and Outlier Detection.}
  Wiley, p. 57.
}
\references{
  Venables, W. N. and Ripley, B. D. (2002)
  \emph{Modern Applied Statistics with S.} Forth Edition. Springer.
}
\note{
  After loading the \CRANpkg{MASS} package, the data set is simply constructed by
  \code{Animals2 <- local({D <- rbind(Animals, mammals);
      unique(D[order(D$body,D$brain),])})}.

  Rousseeuw and Leroy (1987)'s \sQuote{brain} data is the same as
  \CRANpkg{MASS}'s \code{Animals} (with Rat and Brachiosaurus interchanged,
  see the example below).
}
\examples{
data(Animals2)
## Sensible Plot needs doubly logarithmic scale
plot(Animals2, log = "xy")

## Regression example plot:
plotbb <- function(bbdat) {
  d.name <- deparse(substitute(bbdat))
  plot(log(brain) ~ log(body), data = bbdat, main = d.name)
  abline(       lm(log(brain) ~ log(body), data = bbdat))
  abline(MASS::rlm(log(brain) ~ log(body), data = bbdat), col = 2)
  legend("bottomright", leg = c("lm", "rlm"), col=1:2, lwd=1, inset = 1/20)
}
plotbb(bbdat = Animals2)

## The `same' plot for Rousseeuw's subset:
data(Animals, package = "MASS")
brain <- Animals[c(1:24, 26:25, 27:28),]
plotbb(bbdat = brain)

lbrain <- log(brain)
plot(mahalanobis(lbrain, colMeans(lbrain), var(lbrain)),
     main = "Classical Mahalanobis Distances")
mcd <- covMcd(lbrain)
plot(mahalanobis(lbrain,mcd$center,mcd$cov),
     main = "Robust (MCD) Mahalanobis Distances")
}
\keyword{datasets}