Pastes                 package:lme4                 R Documentation

_P_a_s_t_e _s_t_r_e_n_g_t_h _b_y _b_a_t_c_h _a_n_d _c_a_s_k

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

     Paste str

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

     data(Pastes)

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

     A data frame with 60 observations on the following 4 variables.

     '_s_t_r_e_n_g_t_h' paste strength.

     '_b_a_t_c_h' delivery batch from which the sample was sample.  A factor
          with 10 levels: 'A' to 'J'.

     '_c_a_s_k' cask within the delivery batch from which the sample was
          chosen.  A factor with 3 levels: 'a' to 'c'.

     '_s_a_m_p_l_e' the sample of paste whose strength was assayed, two
          assays per sample. A factor with 30 levels: 'A:a' to 'J:c'.

_D_e_t_a_i_l_s:

     The data are described in Davies and Goldsmith (1972) as coming
     from " deliveries of a chemical paste product contained in casks
     where, in addition to sampling and testing errors, there are
     variations in quality between deliveries ... As a routine, three
     casks selected at random from each delivery were sampled and the
     samples were kept for reference. ... Ten of the delivery batches
     were sampled at random and two analytical tests carried out on
     each of the 30 samples".

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

     O.L. Davies and P.L. Goldsmith (eds), _Statistical Methods in
     Research and Production, 4th ed._, Oliver and Boyd, (1972),
     section 6.5

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

     str(Pastes)
     dotplot(cask ~ strength | reorder(batch, strength), Pastes,
             strip = FALSE, strip.left = TRUE, layout = c(1, 10),
             ylab = "Cask within batch",
             xlab = "Paste strength", jitter.y = TRUE)
     ## Modifying the factors to enhance the plot
     Pastes <- within(Pastes, batch <- reorder(batch, strength))
     Pastes <- within(Pastes, sample <- reorder(reorder(sample, strength),
               as.numeric(batch)))
     dotplot(sample ~ strength | batch, Pastes,
             strip = FALSE, strip.left = TRUE, layout = c(1, 10),
             scales = list(y = list(relation = "free")),
             ylab = "Sample within batch",
             xlab = "Paste strength", jitter.y = TRUE)
     ## Four equivalent models differing only in specification
     (fm1 <- lmer(strength ~ (1|batch) + (1|sample), Pastes))
     (fm2 <- lmer(strength ~ (1|batch/cask), Pastes))
     (fm3 <- lmer(strength ~ (1|batch) + (1|batch:cask), Pastes))
     (fm4 <- lmer(strength ~ (1|batch/sample), Pastes))
     ## fm4 results in redundant labels on the sample:batch interaction
     head(ranef(fm4)[[1]])
     ## compare to fm1
     head(ranef(fm1)[[1]])
     ## This model is different and NOT appropriate for these data
     (fm5 <- lmer(strength ~ (1|batch) + (1|cask), Pastes))
     image(fm1@L, sub = "Structure of random effects interaction in pastes model")

