fitConGraph {ggm} | R Documentation |
Fits a concentration graph (a covariance selection model) to a sample covariance matrix, assuming a Gaussian model.
fitConGraph(amat, S, n, pri = FALSE, alg=2, tol = 1e-06)
amat |
a square Boolean matrix representing the adjacency matrix of the DAG |
S |
a symmetric positive definite matrix, the sample covariance matrix |
n |
an postive integer, the sample size |
pri |
a logical value. If TRUE a the value
of the deviance at each iteration is printed. |
alg |
and integer specifying the algorithm: if alg=1
then the covariance matrix is updated, if alg=2
the concentration matrix is updated.
|
tol |
a small positive number indicating the tolerance used in convergence tests. |
Algorithms for fitting Gaussian graphical models specified by undirected graphs are discussed in Speed & Kiiveri (1986). This function is based on the iterative proportional fitting algorithm described on p. 184 of Whittaker (1990).
Shat |
the fitted covariance matrix. |
dev |
the `deviance' of the model. |
df |
the degrees of freedom. |
it |
the iterations. |
Giovanni M. Marchetti
Cox, D. R. & Wermuth, N. (1996). Multivariate dependencies. London: Chapman & Hall.
Speed, T.P. & Kiiveri, H (1986). Gaussian Markov distributions over finite graphs. Annals of Statistics, 14, 138–150.
Whittaker, J. (1990). Graphical models in applied multivariate statistics. Chichester: Wiley.
## A model for the sample covariance matrix of the ## mathematics marks (Whittaker, 1990) data(marks) S <- cov(marks) * 87 / 88 ## A butterfly concentration graph fitConGraph(UG(~ mechanics*vectors*algebra + algebra*analysis*statistics), S , n = 88)