AvgDailyGain            package:SASmixed            R Documentation

_A_v_e_r_a_g_e _d_a_i_l_y _w_e_i_g_h_t _g_a_i_n _o_f _s_t_e_e_r_s _o_n _d_i_f_f_e_r_e_n_t _d_i_e_t_s

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

     The 'AvgDailyGain' data frame has 32 rows and 6 columns.

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

     This data frame contains the following columns:

     _I_d the animal number

     _B_l_o_c_k an ordered factor indicating the barn in which the steer was
          housed.

     _T_r_e_a_t_m_e_n_t an ordered factor with levels '0' < '10' < '20' < '30'
          indicating the amount of medicated feed additive added to the
          base ration.

     _a_d_g a numeric vector of average daily weight gains over a period
          of 160 days.

     _I_n_i_t_W_t a numeric vector giving the initial weight of the animal

     _T_r_t the 'Treatment' as a numeric variable

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

     Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R.
     D. (1996), _SAS System for Mixed Models_, SAS Institute (Data Set
     5.3).

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

     str(AvgDailyGain)
     if (require("lattice", quietly = TRUE, character = TRUE)) {
       ## plot of adg versus Treatment by Block
       xyplot(adg ~ Treatment | Block, AvgDailyGain, type = c("g", "p", "r"),
              xlab = "Treatment (amount of feed additive)",
              ylab = "Average daily weight gain (lb.)", aspect = "xy",
              index.cond = function(x, y) coef(lm(y ~ x))[1])
     }
     if (require("lme4", quietly = TRUE, character = TRUE)) {
       options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly"))
       ## compare with output 5.1, p. 178
       print(fm1Adg <- lmer(adg ~ InitWt * Treatment - 1 + (1 | Block),
                              AvgDailyGain))
       print(anova(fm1Adg))   # checking significance of terms
       print(fm2Adg <- lmer(adg ~ InitWt + Treatment + (1 | Block),
                              AvgDailyGain))
       print(anova(fm2Adg))
       print(lmer(adg ~ InitWt + Treatment - 1 + (1 | Block), AvgDailyGain))
     }

