fitAncestralGraph            package:ggm            R Documentation

_F_i_t_t_i_n_g _o_f _G_a_u_s_s_i_a_n _A_n_c_e_s_t_r_a_l _G_r_a_p_h _M_o_d_e_l_s

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

     Iterative conditional fitting of Gaussian Ancestral Graph Models.

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

     fitAncestralGraph(amat, S, n, tol = 1e-06)

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

    amat: a square matrix, representing the adjacency matrix of an
          ancestral graph. 

       S: a symmetric positive definite matrix with dimnames, the
          sample covariance matrix.

       n: the sample size, a positive integer.

     tol: a small positive number indicating the tolerance used in
          convergence checks.

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

     Ancestral graph models were introduced by Richardson & Spirtes
     (2002) as a class of graphical models whose global Markov property
     is closed under conditioning and marginalization. In the Gaussian
     case, the models can be parameterized using precision parameters,
     regression coefficients, and error covariances (compare Richardson
     & Spirtes, 2002, Section 8). This function finds the MLE 'Lhat' of
     the precision  parameters by fitting a concentration   graph
     model. The MLE 'Bhat' of the regression coefficients and the MLE
     'Ohat' of the error covariances are obtained by iterative
     conditional fitting (Drton & Richardson, 2003a, b). The three sets
     of parameters are  combined to the MLE 'Shat' of the covariance
     matrix by matrix multiplication: 

       'Shat = solve(Bhat) %*% (Lhat+Ohat) %*% t(solve(Bhat))'.

     Note that in Richardson & Spirtes (2002), the matrices Lhat and
     Ohat are defined as submatrices.

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

    Shat: the fitted covariance matrix.

    Lhat: matrix of the fitted precisions associated with undirected
          edges and vertices that do not have an arrowhead pointing at
          them.

    Bhat: matrix of the fitted regression coefficients associated to
          the directed edges.  Precisely said 'Bhat' contains ones on
          the diagonal and the off-diagonal entry (i,j) equals the
          _negated_ MLE of the regression coefficient for variable j in
          the regression of variable i on its parents. Note that this
          (i,j) entry in 'Bhat' corresponds to a directed edge j -> i,
          and thus to a one as (j,i) entry in the adjacency matrix.

    Ohat: matrix of the error covariances and variances of the
          residuals  between regression equations associated with
          bidirected edges and vertices with an arrowhead pointing at
          them.

     dev: the `deviance' of the model.

      df: the degrees of freedom.

      it: the iterations.

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

     Mathias Drton

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

     Drton, M. & Richardson, T. S. (2003a). Iterative Conditional
     Fitting for Gaussian Ancestral Graph Models.  Department of
     Statistics, University of Washington, Technical Report 437, under
     preparation. (Compare also <URL:
     http://www.math.auc.dk/gr/gr2003/material/drton.pdf>)

     Drton, M. & Richardson, T. S. (2003b). A new algorithm for maximum
     likelihood estimation in Gaussian graphical models for marginal
     independence. _Proceedings of the Nineteenth Conference on
     Uncertainty in Artificial Intelligence_, 184-191.

     Richardson, T. Spirtes, P. (2002). Ancestral Graph Markov Models.
     _Annals of Statistics_. 30, 4, 962-1030.

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

     'fitCovGraph', 'icf', 'makeAG', 'fitDag'

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

     ## A covariance matrix
     "S" <- structure(c(2.93, -1.7, 0.76, -0.06,
                       -1.7, 1.64, -0.78, 0.1,
                        0.76, -0.78, 1.66, -0.78,
                       -0.06, 0.1, -0.78, 0.81), .Dim = c(4,4),
                      .Dimnames = list(c("y", "x", "z", "u"), c("y", "x", "z", "u")))
     ## The following should give the same fit.   
     ## Fit an ancestral graph y -> x <-> z <- u
     fitAncestralGraph(ag1 <- makeAG(dag=DAG(x~y,z~u), bg = UG(~x*z)), S, n=100)

     ## Fit an ancestral graph y <-> x <-> z <-> u
     fitAncestralGraph(ag2 <- makeAG(bg= UG(~y*x+x*z+z*u)), S, n=100)

     ## Fit the same graph with fitCovGraph
     fitCovGraph(ag2, S, n=100)    

     ## Another example for the mathematics marks data

     data(marks)
     S <- var(marks)
     mag1 <- makeAG(bg=UG(~mechanics*vectors*algebra+algebra*analysis*statistics))
     fitAncestralGraph(mag1, S, n=88)

     mag2 <- makeAG(ug=UG(~mechanics*vectors+analysis*statistics),
                    dag=DAG(algebra~mechanics+vectors+analysis+statistics))
     fitAncestralGraph(mag2, S, n=88) # Same fit as above

