fitUg {ggm}R Documentation

Gaussian Markov models specified by an UG

Description

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

Usage

fitUg(gmat, V, n, cov = FALSE, pri = FALSE, tol = 1e-06)

Arguments

gmat a square Boolean matrix representing the edge matrix of the DAG
V a symmetric positive definite matrix, the sample covariance matrix
n an integer >0, the sample size
cov a logical value. If cov=TRUE, then it is fitted a covariance graph. Else it is fitted a concentration graph.
pri a logical value. If TRUE a the value of the criterion at each iteration is printed.
tol a positive number indicating the tolerance used in convergence tests.

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

Value

type a character string indicating the type of the graph, concentration or covariance.
cliques a list of numeric vectors indicating the cliques of the UG.
Vhat the fitted covariance matrix.
Rhat the fitted correlation matrix.
Phat the fitted partial correlation matrix.
dev the `deviance' (-2 log L) of the model.
df the degrees of freedom

Author(s)

Giovanni M. Marchetti

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

## A model for the sample covariance matrix of the
## mathematics marks (cfr. Whittaker, 1990)
data(marks)
V <- cov(marks) * 87 / 88
## A butterfly concentration graph
fitUg(UG(~ mec*vec*alg + alg*ana*sta),V , n=88)

## Correlations among four strategies to cope with stress for 
## 72 students. Cfr. Cox & Wermuth (1996), p. 73.
##  Y = cognitive avoidance
##  X = vigilance
##  V = blunting
##  U = monitoring

R <- matrix(c(
   1.00, -0.20,  0.46,  0.01,
  -0.20,  1.00,  0.00,  0.47,
   0.46,  0.00,  1.00, -0.15,
   0.01,  0.47, -0.15,  1.00), 4, 4)
nam <- c("Y", "X", "V", "U") 
dimnames(R) <- list(nam, nam)

## A chordless 4-cycle covariance graph

gr <- UG(~ Y*X + X*U + U*V + V*Y)
fitUg(gr, R, 72, cov=TRUE)

[Package Contents]