fitDagLatent {ggm} | R Documentation |
Fitting Gaussian DAG models 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(amat, Syy, n, latent, norm = 1, seed,
maxit = 9000, tol = 1e-06, pri = FALSE)
Arguments
amat |
a square matrix with dimnames representing the adjacency matrix of the DAG. |
Syy |
a symmetric positive definite matrix,
with dimnames, the sample covariance
matrix of the observed variables.
The set of the observed nodes of the graph must be a subset
of the set of the names of the variables in |
n |
a positive integer, the sample size. |
latent |
the name of the latent variable. |
norm |
an integer, the kind of normalization of the latent
variable.
If |
seed |
an integer, used by |
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 |
Details
For the EM algorithm used see Kiiveri (1987).
Value
Shat |
the fitted covariance matrix of all the variables
including the latent one. The latent variable is the last.
If |
Ahat |
a square matrix of the fitted regression coefficients. The entry
|
Dhat |
a vector containing the partial variances of each
variable given the parents. If |
dev |
the ‘deviance’ of the model. |
df |
the degrees of freedom of the model. |
it |
the number of EM algorithm iterations at convergence. |
Author(s)
Giovanni M. Marchetti
References
Kiiveri,H. T. (1987). An incomplete data approach to the analysis of covariance structures. Psychometrika, 52, 4, 539–554.
Joreskog, K.G. and 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
Examples
## 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)