Description Usage Arguments Details Value Author(s) References See Also Examples
Iterative conditional fitting of Gaussian Ancestral Graph Models.
1 | fitAncestralGraph(amat, S, n, tol = 1e-06)
|
amat |
a square matrix, representing the adjacency matrix of an ancestral graph. |
S |
a symmetric positive definite matrix with row and col names, the sample covariance matrix. |
n |
the sample size, a positive integer. |
tol |
a small positive number indicating the tolerance used in convergence checks. |
In the Gaussian case, the models can be parameterized using precision parameters, regression coefficients, and error covariances (compare Richardson and Spirtes, 2002, Section 8). This function finds the MLE L of the precision parameters by fitting a concentration graph model. The MLE B of the regression coefficients and the MLE O of the error covariances are obtained by iterative conditional fitting (Drton and Richardson, 2003, 2004). The three sets of parameters are combined to the MLE S of the covariance matrix by matrix multiplication:
S = B^(-1) (L+O) B^(-t).
Note that in Richardson and Spirtes (2002), the matrices L and O are defined as submatrices.
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 |
Ohat |
matrix of the error covariances and variances of the residuals between regression equations associated with bi-directed edges and vertices with an arrowhead pointing at them. |
dev |
the ‘deviance’ of the model. |
df |
the degrees of freedom. |
it |
the iterations. |
Mathias Drton
Drton, M. and Richardson, T. S. (2003). 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.
Drton, M. and Richardson, T. S. (2004). Iterative Conditional Fitting for Gaussian Ancestral Graph Models. Proceedings of the 20th Conference on Uncertainty in Artificial Intelligence, Department of Statistics, 130-137.
Richardson, T. S. and Spirtes, P. (2002). Ancestral Graph Markov Models. Annals of Statistics. 30(4), 962-1030.
fitCovGraph
, icf
,
makeMG
, fitDag
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ## 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 <- makeMG(dg=DAG(x~y,z~u), bg = UG(~x*z)), S, n=100)
## Fit an ancestral graph y <-> x <-> z <-> u
fitAncestralGraph(ag2 <- makeMG(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 <- makeMG(bg=UG(~mechanics*vectors*algebra+algebra*analysis*statistics))
fitAncestralGraph(mag1, S, n=88)
mag2 <- makeMG(ug=UG(~mechanics*vectors+analysis*statistics),
dg=DAG(algebra~mechanics+vectors+analysis+statistics))
fitAncestralGraph(mag2, S, n=88) # Same fit as above
|
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Attaching package: 'ggm'
The following object is masked from 'package:igraph':
pa
$Shat
y x z u
y 2.930000 -1.4344254 0.0000000 0.0000000
x -1.434425 1.3799680 -0.3430373 0.0000000
z 0.000000 -0.3430373 1.5943070 -0.7442518
u 0.000000 0.0000000 -0.7442518 0.8100000
$Lhat
[,1] [,2] [,3] [,4]
[1,] 0 0.0000000 0.0000000 0
[2,] 0 0.6777235 -0.3430373 0
[3,] 0 -0.3430373 0.9104666 0
[4,] 0 0.0000000 0.0000000 0
$Bhat
y x z u
y 1.000000 0 0 0.0000000
x 0.489565 1 0 0.0000000
z 0.000000 0 1 0.9188294
u 0.000000 0 0 1.0000000
$Ohat
y x z u
y 0 0.0000000 0.0000000 0
x 0 0.6777235 -0.3430373 0
z 0 -0.3430373 0.9104666 0
u 0 0.0000000 0.0000000 0
$dev
[1] 21.57711
$df
[1] 3
$it
[1] 4
$Shat
y x z u
y 2.930000 -1.4344255 0.0000000 0.0000000
x -1.434425 1.3799680 -0.3430373 0.0000000
z 0.000000 -0.3430373 1.5943070 -0.7442518
u 0.000000 0.0000000 -0.7442518 0.8100000
$Lhat
[,1] [,2] [,3] [,4]
[1,] 0 0 0 0
[2,] 0 0 0 0
[3,] 0 0 0 0
[4,] 0 0 0 0
$Bhat
y x z u
y 1 0 0 0
x 0 1 0 0
z 0 0 1 0
u 0 0 0 1
$Ohat
y x z u
y 2.930000 -1.4344255 0.0000000 0.0000000
x -1.434425 1.3799680 -0.3430373 0.0000000
z 0.000000 -0.3430373 1.5943070 -0.7442518
u 0.000000 0.0000000 -0.7442518 0.8100000
$dev
[1] 21.57711
$df
[1] 3
$it
[1] 14
$Shat
y x z u
y 2.930000 -1.4344255 0.0000000 0.0000000
x -1.434425 1.3799680 -0.3430373 0.0000000
z 0.000000 -0.3430373 1.5943070 -0.7442518
u 0.000000 0.0000000 -0.7442518 0.8100000
$dev
[1] 21.57711
$df
[1] 3
$it
[1] 14
$Shat
mechanics vectors algebra analysis statistics
mechanics 305.68848 127.04336 53.15421 0.00000 0.00000
vectors 127.04336 172.84222 43.11507 0.00000 0.00000
algebra 53.15421 43.11507 88.39060 84.78364 92.65154
analysis 0.00000 0.00000 84.78364 220.38036 155.53553
statistics 0.00000 0.00000 92.65154 155.53553 297.75536
$Lhat
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0 0 0
[2,] 0 0 0 0 0
[3,] 0 0 0 0 0
[4,] 0 0 0 0 0
[5,] 0 0 0 0 0
$Bhat
mechanics vectors algebra analysis statistics
mechanics 1 0 0 0 0
vectors 0 1 0 0 0
algebra 0 0 1 0 0
analysis 0 0 0 1 0
statistics 0 0 0 0 1
$Ohat
mechanics vectors algebra analysis statistics
mechanics 305.68848 127.04336 53.15421 0.00000 0.00000
vectors 127.04336 172.84222 43.11507 0.00000 0.00000
algebra 53.15421 43.11507 88.39060 84.78364 92.65154
analysis 0.00000 0.00000 84.78364 220.38036 155.53553
statistics 0.00000 0.00000 92.65154 155.53553 297.75536
$dev
[1] 31.97538
$df
[1] 4
$it
[1] 21
$Shat
mechanics vectors algebra analysis statistics
mechanics 3.056885e+02 1.270434e+02 53.15421 1.247322e-08 8.803090e-09
vectors 1.270434e+02 1.728422e+02 43.11507 5.183837e-09 3.658542e-09
algebra 5.315421e+01 4.311507e+01 88.39060 8.478364e+01 9.265154e+01
analysis 1.247322e-08 5.183837e-09 84.78364 2.203804e+02 1.555355e+02
statistics 8.803090e-09 3.658542e-09 92.65154 1.555355e+02 2.977554e+02
$Lhat
[,1] [,2] [,3] [,4] [,5]
[1,] 0 0 0.00000 0 0
[2,] 0 0 0.00000 0 0
[3,] 0 0 37.12009 0 0
[4,] 0 0 0.00000 0 0
[5,] 0 0 0.00000 0 0
$Bhat
mechanics vectors algebra analysis statistics
mechanics 1.0000000 0.0000000 0 0.0000000 0.0000000
vectors 0.0000000 1.0000000 0 0.0000000 0.0000000
algebra -0.1010961 -0.1751394 1 -0.2615174 -0.1745604
analysis 0.0000000 0.0000000 0 1.0000000 0.0000000
statistics 0.0000000 0.0000000 0 0.0000000 1.0000000
$Ohat
mechanics vectors algebra analysis statistics
mechanics 0 0 0.00000 0 0
vectors 0 0 0.00000 0 0
algebra 0 0 37.12009 0 0
analysis 0 0 0.00000 0 0
statistics 0 0 0.00000 0 0
$dev
[1] 31.97538
$df
[1] 4
$it
[1] 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.