Learn R Programming

ggm (version 0.8-1)

fitConGraph: Fitting of Gaussian concentration graph models

Description

Fits a concentration graph (a covariance selection model) to a sample covariance matrix, assuming a Gaussian model.

Usage

fitConGraph(amat, S, n, pri = FALSE, alg=2, tol = 1e-06)

Arguments

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.

Value

  • Shatthe fitted covariance matrix.
  • devthe `deviance' of the model.
  • dfthe degrees of freedom.
  • itthe iterations.

Details

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).

References

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.

See Also

UG, fitDag, cliques, marks

Examples

Run this code
## 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)

Run the code above in your browser using DataLab