makeModel              package:maanova              R Documentation

_M_a_k_e _m_o_d_e_l _o_b_j_e_c_t _f_o_r _N-_d_y_e _M_i_c_r_o _A_r_r_a_y _e_x_p_e_r_i_m_e_n_t

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

     This is the function to make an object of class 'mamodel'  for a
     Micro Array experiment.

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

     makeModel(data, design, formula, random=~1, covariate=~1)

_A_r_g_u_m_e_n_t_s:

    data: An object of class 'madata'.

  design: A data frame representing the experimental design. By
          default, it is a field in madata. But you can always make a
          data frame and pass it to the function.

 formula: The ANOVA model formula.

  random: The formula for random terms. ~1 means only the residual is
          random (fixed model). Note that all random terms should be in
          the ANOVA model formula.

covariate: The formula for covariates. ~1 means no covariates. The
          covariates will be continuous values in the design matrix.

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

     The user needs to specify the ANOVA model by formula. It can be a
     fixed or mixed effect model. This function will check the validity
     of the data, calculate some parameters, construct and design
     matrices and wrap up everything together to create an output
     object.

     The model formula is for a gene-specific model. All terms in the
     formula should be corresponding to the factor names in design
     except "Spot" and "Label". "Spot" represents the spotting effect
     and "Label" represents the labelling effects. They are from the
     within slide technical replicates. If there is no replicated
     spots, These two terms cannot be fitted. Also these two terms
     cannot be fitted for one-dye system (e.g., affymetric arrays).
     (Note that Dye effect should not be fitted in one-dye system).

     A typical formual will be like "~Array+Dye+Sample", which means
     you want to fit Array effect, Dye effect and Sample effect in the
     ANOVA model. In this case, you need to have Array, Dye and Sample
     columns in your input design file. Make sure you have enough
     degree of freedom when making a model. Also you need to be careful
     about confounding problem.

     If you have multiple factors in your experiment, you can specify
     the main and interaction effect in the formula. At this time, only
     two-way interactions are allowed.

     For most mixed effect models, Array should be treated as random
     factor. Sample should be treated as random if you have biological
     replicates. Note that the reference sample (0's in Sample) will
     always be treated as fixed even if you specify Sample as random.

_V_a_l_u_e:

     An object of class 'mamodel' with the following fields: 

       X: Design matrix for fixed terms.

    dimX: Number of columns in X for each fixed term.

       Z: Design matrix for random terms. This will be absent for fixed
          model.

    dimZ: Number of columns in Z for each random term.This will be
          absent for fixed model.

      df: The degree of freedom for each term in the model.

   mixed: An integer to indicate whether this is a fixed or mixed
          effect model. 0 means fixed and 1 means mixed.

  design: The input experimental design as a data frame.

 formula: The input model formula.

  random: The input formula for random terms.

covariate: The input formula for covariates.

_A_u_t_h_o_r(_s):

     Hao Wu

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

     Kerr and Churchill(2001), Statistical design and the analysis of
     gene expression microarrays, _Genetical Research_, *77*:123-128.

     Kerr, Martin and Churchill(2000), Analysis of variance for gene
     expression microarray data, _Journal of Computational Biology_,
     *7*:819-837.

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

     #load in data
     data(paigen)
     # make data object with rep 2
     paigen <- createData(paigen.raw, 2)
     # make full model for fixed effect model
     model.full.fix <- makeModel(data=paigen,
           formula=~Dye+Array+Spot+Strain+Diet+Strain:Diet)
     summary(model.full.fix)
     # make full model for mixed effect model
     model.full.mix <- makeModel(data=paigen,
           formula=~Dye+Array+Spot+Strain+Diet+Strain:Diet+Sample,
           random=~Array+Spot+Sample)
     summary(model.full.mix)

