makeAG                  package:ggm                  R Documentation

_A_n_c_e_s_t_r_a_l _G_r_a_p_h_s

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

     Defines an ancestral graph from the directed, undirected and
     undirected components and checks if the components are compatible
     with an ancestral graph.

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

     makeAG(dag = NULL, ug = NULL, bg = NULL)

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

     dag: the adjacency matrix of a directed acyclic graph specifying
          the arrows of the ancestral graph.

      ug: the adjacency matrix of an undirected graph specifying the
          lines of the ancestral graph.

      bg: the adjacency matrix of an undirected graph specifying the
          bidirected edges of the ancestral graph.

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

     An ancestral graph is a mixed graph with three types of edges:
     undirected, directed and bidirected edges. The following
     conditions must hold: (i) no undirected edge meets an arrowhead;
     (ii) no directed cycles; (iii) spouses cannot be ancestors. For
     details see Richardson & Spirtes (2002).

     The function checks if, given the matrices of the undirected,
     directed and bidirected edges, the above three conditions are
     respected. If so, a resulting adjacency matrix E=[e_{ij} is
     returned, with the following convention. If (i,j) is a directed
     edge, then e_{ij} = 1 and e_{ji}=0. If (i,j) is an undirected
     edge, then e_{ij} = e_{ji} = 1. Finally, if (i,j) is a bidirected
     edge, then e_{ij} = e_{ji} = 2.

     Note that the three adjacency matrices must have labels and may be
     defined using the functions 'DAG' and 'UG'.

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

     a square matrix obtained by combining the three graph components
     into an adjacency matrix of an ancestral graph. See the details
     for the coding of the adjacency matrix.

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

     Giovanni M. Marchetti, Mathias Drton

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

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

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

     'UG', 'DAG'

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

     ## Examples from Richardson and Spirtes (2002)
     ## Not run: a1 <- makeAG(dag=DAG(a~b, b~d, d~c), bg=UG(~a*c))  # Not an AG. (a2) p.969
     a2 <- makeAG(dag=DAG(b ~ a, d~c), bg=UG(~a*c+c*b+b*d))           # Fig. 3 (b1) p.969
      a3 <- makeAG(ug = UG(~ a*c), dag=DAG(b ~ a, d~c), bg=UG(~ b*d)) # Fig. 3 (b2) p.969
      a5 <- makeAG(bg=UG(~alpha*beta+gamma*delta), dag=DAG(alpha~gamma,
     delta~beta))  # Fig. 6 p. 973
     ## Another Example
      a4 <- makeAG(ug=UG(~y0*y1), dag=DAG(y4~y2, y2~y1), bg=UG(~y2*y3+y3*y4))

