balancedGrouped             package:nlme             R Documentation

_C_r_e_a_t_e _a _g_r_o_u_p_e_d_D_a_t_a _o_b_j_e_c_t _f_r_o_m _a _m_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     Create a 'groupedData' object from a data matrix.  This function
     can be used only with balanced data.  The opposite conversion,
     from a 'groupedData' object to a 'matrix', is done with 'asTable'.

_U_s_a_g_e:

     balancedGrouped(form, data, labels=NULL, units=NULL)

_A_r_g_u_m_e_n_t_s:

    form: A formula of the form 'y ~ x | g' giving the name of the
          response, the primary covariate, and the grouping factor.

    data: A matrix or data frame containing the values of the response
          grouped according to the levels of the grouping factor (rows)
          and the distinct levels of the primary covariate (columns).
          The 'dimnames' of the matrix are used to construct the levels
          of the grouping factor and the primary covariate.

  labels: an optional list of character strings giving labels for the
          response and the primary covariate.  The label for the
          primary covariate is named 'x' and that for the response is
          named 'y'.  Either label can be omitted.

   units: an optional list of character strings giving the units for
          the response and the primary covariate.  The units string for
          the primary covariate is named 'x' and that for the response
          is named 'y'.  Either units string can be omitted.

_V_a_l_u_e:

     A balanced 'groupedData' object.

_A_u_t_h_o_r(_s):

     Jose Pinheiro Jose.Pinheiro@pharma.novartis.com and Douglas Bates
     bates@stat.wisc.edu

_R_e_f_e_r_e_n_c_e_s:

     Pinheiro, J. C. and Bates, D. M. (2000), _Mixed-Effects Models in
     S and S-PLUS_, Springer, New York.

_S_e_e _A_l_s_o:

     'groupedData', 'isBalanced', 'asTable'

_E_x_a_m_p_l_e_s:

     OrthoMat <- asTable( Orthodont )
     Orth2 <- balancedGrouped(distance ~ age | Subject, data = OrthoMat,
         labels = list(x = "Age",
                       y = "Distance from pituitary to pterygomaxillary fissure"),
         units = list(x = "(yr)", y = "(mm)"))
     Orth2[ 1:10, ]        ## check the first few entries

     # Pinheiro and Bates, p. 109
     ergoStool.mat <- asTable(ergoStool)
     balancedGrouped(effort~Type|Subject,
                     data=ergoStool.mat)

