Learn R Programming

ggm (version 0.5)

fitDagLatent: Gaussian DAG model with one latent variable

Description

Fits by maximum likelihood a Gaussian DAG model where one of the nodes of the graph is latent and it is marginalised over.

Usage

fitDagLatent(gmat, Syy, n, latent, norm = 1, seed = 144, maxit = 9000, tol = 1e-06, pri = TRUE)

Arguments

gmat
a square Boolean matrix with dimnames, the edge matrix of the DAG.
Syy
a symmetric positive definite matrix, with dimnames, the sample covariance matrix. The order of the rows needs not match the order of the nodes of the graph. However, the set of nodes of the graph must be a subset of the set of the names of the vari
n
a positive integer, the sample size.
latent
the name of the hidden node.
norm
an integer, the kind of normalization of the latent variable. If norm=1, the latent is scaled to have unit variance. If norm=2, the latent is scaled to have unit partial variance given its parents.
seed
an integer, used by set.seed to specify a random starting point of the EM algorithm.
maxit
an integer denoting the maximum number of iterations allowed for the EM algorithm. If the convergence criterion is not satisfied within maxit iterations the algorithms stops and a warning message is returned.
tol
a small real value, denoting the tolerance used in testing convergence.
pri
logical, if pri=TRUE then the value of the deviance at each iteration is printed.

Value

  • Shata symmetric matrix, the fitted covariance matrix of all the variables including the latent one.
  • Khata symmetric matrix, the fitted concentration matrix, i.e. the inverse of Shat.
  • Aa square matrix with ones along the diagonal, resulting from the triangular decomposition of Shat. The non diagonal entries are partial regression coefficients, with sign changed, attached to the edges of the fitted DAG.
  • Deltaa numeric vector resulting from triangular decomposition of Shat. The values are the partial variances.
  • devthe `deviance' ($-2 \log L$) of the model.
  • ita positive integer, the number of EM algorithm iterations at convergence.
  • dfa positive integer, degrees of freedom of the model.

Details

The EM algorithm used is due to Kiivery (1987).

References

Kiiveri,H. T. (1987). An incomplete data approach to the analysis of covariance structures. Psychometrika, 52, 4, 539--554.

J"oreskog, K.G. & Goldberger, A.S. (1975). Estimation of a model with multiple indicators and multiple causes of a single latent variable. Journal of the American Statistical Association, 10, 631--639.

See Also

fitDag, checkIdent

Examples

Run this code
## data from Joreskog and Goldberger (1975)
V <- matrix(c(1,     0.36,   0.21,  0.10,  0.156, 0.158,
              0.36,  1,      0.265, 0.284, 0.192, 0.324,
              0.210, 0.265,  1,     0.176, 0.136, 0.226,
              0.1,   0.284,  0.176, 1,     0.304, 0.305, 
              0.156, 0.192,  0.136, 0.304, 1,     0.344,
              0.158, 0.324,  0.226, 0.305, 0.344, 1),     6,6)
nod <- c("y1", "y2", "y3", "x1", "x2", "x3")
dimnames(V) <- list(nod,nod)
dag <- DAG(y1 ~ z, y2 ~ z, y3 ~ z, z ~ x1 + x2 + x3, x1~x2+x3, x2~x3) 
fitDagLatent(dag, V, n=530, latent="z", seed=4564)
fitDagLatent(dag, V, n=530, latent="z", norm=2, seed=145)

Run the code above in your browser using DataLab