Animals2             package:robustbase             R Documentation

_B_r_a_i_n _a_n_d _B_o_d_y _W_e_i_g_h_t_s _f_o_r _6_5 _S_p_e_c_i_e_s _o_f _L_a_n_d _A_n_i_m_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     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 'Animals' and 'mammals'.

_U_s_a_g_e:

     Animals2

_F_o_r_m_a_t:


     '_b_o_d_y' body weight in kg

     '_b_r_a_i_n' brain weight in g

_N_o_t_e:

     After loading the 'MASS' package, the data set is simply
     constructed by 'Animals2 <- local({D <- rbind(Animals, mammals);
     unique(D[order(D$body,D$brain),])})'.

     Rousseeuw and Leroy (1987)'s 'brain' data is the same as 'MASS''s
     'Animals' (with Rat and Brachiosaurus interchanged, see the
     example below).

_S_o_u_r_c_e:

     Weisberg, S. (1985) _Applied Linear Regression._ 2nd edition.
     Wiley, pp. 144-5.

     P. J. Rousseeuw  and A. M. Leroy (1987) _Robust Regression and
     Outlier Detection._ Wiley, p. 57.

_R_e_f_e_r_e_n_c_e_s:

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S._ Forth Edition. Springer.

_E_x_a_m_p_l_e_s:

     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, mean(lbrain), var(lbrain)),
          main = "Classical Mahalanobis Distances")
     mcd <- covMcd(lbrain)
     plot(mahalanobis(lbrain,mcd$center,mcd$cov),
          main = "Robust (MCD) Mahalanobis Distances")

