R: Fitting of Gaussian DAG models

fitDag {ggm} | R Documentation

## Fitting of Gaussian DAG models

### Description

Fits linear recursive regressions with independent residuals specified by a DAG.

### Usage

    fitDag(amat, S, n)

### Arguments

`amat` | a square matrix with dimnames representing the adjacency matrix of the DAG
`S` | a symmetric positive definite matrix, the sample covariance matrix
`n` | an integer > 0, the sample size

### Details

`fitDag` checks if the order of the nodes in adjacency matrix is the same of `S` and if not it reorders the adjacency matrix to match the order of the variables in `S`. The nodes of the adjacency matrix may form a subset of the variables in `S`.

### Value

`Shat` | the fitted covariance matrix.
`Ahat` | a square matrix of the fitted regression coefficients. The entry `Ahat[i,j]` is minus the regression coefficient of variable `i` in the regression equation `j`. Thus there is a non zero partial regression coefficient `Ahat[i,j]` corresponding to each non zero value `amat[j,i]` in the adjacency matrix.
`Dhat` | a vector containing the partial variances of each variable given the parents.
`dev` | the ‘deviance’ 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.

### See Also

`DAG`, `swp`.

### Examples

    dag <- DAG(y ~ x+u, x ~ z, z ~ u)
    "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")))
    fitDag(dag, S, 200)

[Package ggm version 2.3 Index]