qpIPF                package:qpgraph                R Documentation

_I_t_e_r_a_t_i_v_e _p_r_o_p_o_r_t_i_o_n_a_l _f_i_t_t_i_n_g _a_l_g_o_r_i_t_h_m

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

     Performs maximum likelihood estimation of a sample covariance
     matrix given the independence constraints from in input list of
     (maximal) cliques.

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

     qpIPF(vv, clqlst, tol = 0.001, verbose = FALSE, R.code.only = FALSE)

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

      vv: input matrix, in the context of this package, the sample
          covariance matrix.

  clqlst: list of maximal cliques obtained from an undirected graph by
          using the function 'qpGetCliques'.

     tol: tolerance under which the iterative algorithm stops.

 verbose: show progress on calculations.

R.code.only: logical; if FALSE then the faster C implementation is used
          (default); if TRUE then only R code is executed.

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

     The Iterative proportional fitting algorithm (see, Whittaker,
     1990, pp. 182-185) adjusts the input matrix to the independence
     constraints in the undirected graph from where the input list of
     cliques belongs to, by going through each of the cliques fitting
     the marginal distribution over the clique for the fixed
     conditional distribution of the clique. It stops when the adjusted
     matrix at the current iteration differs from the matrix at the
     previous iteration in less or equal than a given tolerance value.

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

     The input matrix adjusted to the constraints imposed by the list
     of cliques, i.e., a maximum likelihood estimate of the sample
     covariance matrix that includes the independence constraints
     encoded in the undirected graph formed by the given list of
     cliques.

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

     R. Castelo and A. Roverato

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

     Castelo, R. and Roverato, A. A robust procedure for Gaussian
     graphical model search from microarray data with p larger than n.
     _J. Mach. Learn. Res._, 7:2621-2650, 2006.

     Whittaker, J. _Graphical models in applied multivariate
     statistics._ Wiley, 1990.

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

     'qpGetCliques' 'qpPAC'

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

     nVar <- 50 # number of variables
     maxCon <- 5  # maximum connectivity per variable
     nObs <- 10 # number of observations to simulate

     I <- qpRndGraph(n.vtx=nVar, n.bd=maxCon)
     K <- qpI2K(I)
     Sigma <- qpDscale(solve(K)) # true covariance matrix

     X <- qpSampleMvnorm(K, nObs)

     # scaled sample covariance matrix
     S <- qpDscale(cov(X))

     # more efficient scaled sample covariance matrix
     clqs <- qpGetCliques(I, verbose=FALSE)
     S2 <- qpIPF(S, clqs)
     S2 <- qpDscale(S2)

     # mean squared error of S
     mean((abs(Sigma-S)^2)[upper.tri(Sigma)])

     # mean squared error of S2
     mean((abs(Sigma-S2)^2)[upper.tri(Sigma)])

