litters                 package:DAAG                 R Documentation

_M_o_u_s_e _L_i_t_t_e_r_s

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

     Data on the body and brain weights of 20 mice, together with the
     size of the litter.  Two mice were taken from each litter size.

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

     litters

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

     This data frame contains the following columns:

     _l_s_i_z_e litter size

     _b_o_d_y_w_t body weight

     _b_r_a_i_n_w_t brain weight

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

     Wainright P, Pelkman C and Wahlsten D 1989. The quantitative
     relationship between nutritional effects on preweaning growth     
      and behavioral development in mice. Developmental Psychobiology  
      22: 183-193.

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

     print("Multiple Regression - Example 6.2")

     pairs(litters, labels=c("lsize\n\n(litter size)", "bodywt\n\n(Body Weight)",  "brainwt\n\n(Brain Weight)"))
       # pairs(litters) gives a scatterplot matrix with less adequate labeling

     mice1.lm <- lm(brainwt ~ lsize, data = litters) # Regress on lsize
     mice2.lm <- lm(brainwt ~ bodywt, data = litters) #Regress on bodywt
     mice12.lm <- lm(brainwt ~ lsize + bodywt, data = litters) # Regress on lsize & bodywt

     summary(mice1.lm)$coef # Similarly for other coefficients.
     # results are consistent with the biological concept of brain sparing

     pause()

     hat(model.matrix(mice12.lm))  # hat diagonal
     pause()

     plot(lm.influence(mice12.lm)$hat, residuals(mice12.lm))

     print("Diagnostics - Example 6.3")

     mice12.lm <- lm(brainwt ~ bodywt+lsize, data=litters)
     oldpar <-par(mfrow = c(1,2))
     bx <- mice12.lm$coef[2]; bz <- mice12.lm$coef[3]
     res <- residuals(mice12.lm)
     plot(litters$bodywt, bx*litters$bodywt+res, xlab="Body weight",
       ylab="Component + Residual")
     panel.smooth(litters$bodywt, bx*litters$bodywt+res) # Overlay
     plot(litters$lsize, bz*litters$lsize+res, xlab="Litter size", 
       ylab="Component + Residual")
     panel.smooth(litters$lsize, bz*litters$lsize+res)
     par(oldpar)

