qtlCorrSecondOrder        package:MetaNetwork        R Documentation

_C_a_l_c_u_l_a_t_e _t_h_e _s_e_c_o_n_d-_o_r_d_e_r _c_o_r_r_e_l_a_t_i_o_n

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

     Calculate the second-order partial correlation between any pair of
     QTL profiles to decompose the confounded effect of multiple QTLs.

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

     qtlCorrSecondOrder(corrZeroOrder, topCorNo=20, filename = NULL)

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

corrZeroOrder: a zero order correlation matrix that has been calculated
          before.
           See 'corrZeroOrder' example data.

topCorNo: (optional) to reduce computing time, limit the pairwise 
          conditioning to only the 'topCorNo' top correlated compounds.
           Default is 20. To condition on all pairs, set topCorNo to
          nrow(corrZeroOrder).

filename: (optional) path of the file where the correlations are to be
          stored. Default NULL. 

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

     First-order correlation between x and y conditional on a single 
     variable z are calculated by


 r_{xy arrowvert z} = frac {r_{xy} - r_{xz}r_{yz}} {sqrt{(1-r_{xz}^2)(1-r_{yz}^2)}}


     where r_{xy}, r_{xz} and r_{yz} are zero-order correlation
     coefficients  between traits x and y, x and z,  and y and z,
     respectively (provided as 'corrZeroOrder'. 

     Then second-order partial correlation between x and y, conditional
     on a pair  of variables z and k is a function of the first-order
     coefficients.


 r_{xyarrowvert zk} = frac{r_{xyarrowvert z} - r_{xkarrowvert z}r_{ykarrowvert z}} {sqrt{(1-r_{xkarrowvert z}^2)(1-r_{ykarrowvert z}^2)}}


     For each pair x and y, the second-order partial correlations are
     calculated conditional on each pair z and k and the minimal value
     is stored.

     In order to save computing time, conditional variables z and k can
      be chosen from 'topCorNo' top correlated variable x and y (e.g.
     'topCorNo' = 20).

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

     Returns a matrix of second-order partial correlations.

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

     Jingyuan Fu <j.fu@rug.nl>,  Morris Swertz <m.a.swertz@rug.nl>, 
     Ritsert Jansen <r.c.jansen@rug.nl>

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

     Keurentjes JJB, FU J, de vos CHR, Lommen A, Hall RD, Bino RJ, van
     der Plas LHW, Jansen RC,  Vreugdenhil D, and Koornneef M. The
     genetics of plant metabolism. Nature Genetics (2006) 7: 842-849.

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

     Fu J, Swertz MA, Keurentjes JJB, Jansen RC. MetaNetwork: a
     computational tool for the  genetic study of metabolism. Nature
     Protocols (2007). 

     <URL: http://gbic.biol.rug.nl/supplementary/2007/MetaNetwork>

_S_e_e _A_l_s_o:

     Use 'qtlCorrZeroOrder' to calculate 'corrZeroOrder' zero order
     correlation.

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

     ## load the example data provided with this package                         
     data(markers)   
     data(genotypes)
     data(traits)                                                       
                                                  
     ##OR: load your own data                     
     #markers        <- loadData("markers.csv")
     #genotypes      <- loadData("genotypes.csv")
     #traits         <- loadData("traits.csv")  
                                                  
     ##calculate the two part qtl
     qtlProfiles     <- qtlMapTwoPart(genotypes=genotypes, traits=traits, spike=4)
       
     ##set the qtl threshold
     qtlThres        <- 3.79

     ##OR: estimate the threshold yourself
     #qtlThres       <- qtlThreshold(genotypes, traits, spike=4)
       
     ##calculate zero order correlation
     corrZeroOrder   <- qtlCorrZeroOrder(markers, qtlProfiles, qtlThres)

     ##calculate the second order correlation
     corrSecondOrder <- qtlCorrSecondOrder(corrZeroOrder=corrZeroOrder)

     ##view the correlations
     corrSecondOrder[1:5,1:5]

