mxExpectationLISREL {OpenMx}R Documentation

Create MxExpectationLISREL Object

Description

This function creates a new MxExpectationLISREL object.

Usage

mxExpectationLISREL(LX=NA, LY=NA, BE=NA, GA=NA, PH=NA, PS=NA, TD=NA, TE=NA, TH=NA,
                    TX = NA, TY = NA, KA = NA, AL = NA,
                    dimnames = NA, thresholds = NA,
	 threshnames = deprecated(), verbose=0L, ...,
  expectedCovariance=NULL, expectedMean=NULL, discrete = as.character(NA))

Arguments

LX

An optional character string indicating the name of the 'LX' matrix.

LY

An optional character string indicating the name of the 'LY' matrix.

BE

An optional character string indicating the name of the 'BE' matrix.

GA

An optional character string indicating the name of the 'GA' matrix.

PH

An optional character string indicating the name of the 'PH' matrix.

PS

An optional character string indicating the name of the 'PS' matrix.

TD

An optional character string indicating the name of the 'TD' matrix.

TE

An optional character string indicating the name of the 'TE' matrix.

TH

An optional character string indicating the name of the 'TH' matrix.

TX

An optional character string indicating the name of the 'TX' matrix.

TY

An optional character string indicating the name of the 'TY' matrix.

KA

An optional character string indicating the name of the 'KA' matrix.

AL

An optional character string indicating the name of the 'AL' matrix.

dimnames

An optional character vector that is currently ignored

thresholds

An optional character string indicating the name of the thresholds matrix.

threshnames

[Deprecated]

verbose

integer. Level of runtime diagnostic output.

...

Not used. Forces remaining arguments to be specified by name.

expectedCovariance

An optional character string indicating the name of a matrix for the model implied covariance.

expectedMean

An optional character string indicating the name of a matrix for the model implied mean.

discrete

An optional character string indicating the name of the discrete matrix.

Details

Expectation functions define the way that model expectations are calculated. The mxExpectationLISREL calculates the expected covariance and means of a given MxData object given a LISREL model. This model is defined by LInear Structural RELations (LISREL; Jöreskog & Sörbom, 1982, 1996). Arguments 'LX' through 'AL' must refer to MxMatrix objects with the associated properties of their respective matrices in the LISREL modeling approach.

The full LISREL specification has 13 matrices and is sometimes called the extended LISREL model. It is defined by the following equations.

\eta = \alpha + B \eta + \Gamma \xi + \zeta

y = \tau_y + \Lambda_y \eta + \epsilon

x = \tau_x + \Lambda_x \xi + \delta

The table below is provided as a quick reference to the numerous matrices in LISREL models. Note that NX is the number of manifest exogenous (independent) variables, the number of Xs. NY is the number of manifest endogenous (dependent) variables, the number of Ys. NK is the number of latent exogenous variables, the number of Ksis or Xis. NE is the number of latent endogenous variables, the number of etas.

Matrix Word Abbreviation Dimensions Expression Description
\Lambda_x Lambda x LX NX x NK Exogenous Factor Loading Matrix
\Lambda_y Lambda y LY NY x NE Endogenous Factor Loading Matrix
B Beta BE NE x NE Regressions of Latent Endogenous Variables Predicting Endogenous Variables
\Gamma Gamma GA NE x NK Regressions of Latent Exogenous Variables Predicting Endogenous Variables
\Phi Phi PH NK x NK cov(\xi) Covariance Matrix of Latent Exogenous Variables
\Psi Psi PS NE x NE cov(\zeta) Residual Covariance Matrix of Latent Endogenous Variables
\Theta_{\delta} Theta delta TD NX x NX cov(\delta) Residual Covariance Matrix of Manifest Exogenous Variables
\Theta_{\epsilon} Theta epsilon TE NY x NY cov(\epsilon) Residual Covariance Matrix of Manifest Endogenous Variables
\Theta_{\delta \epsilon} Theta delta epsilson TH NX x NY cov(\delta, \epsilon) Residual Covariance Matrix of Manifest Exogenous with Endogenous Variables
\tau_x tau x TX NX x 1 Residual Means of Manifest Exogenous Variables
\tau_y tau y TY NY x 1 Residual Means of Manifest Endogenous Variables
\kappa kappa KA NK x 1 mean(\xi) Means of Latent Exogenous Variables
\alpha alpha AL NE x 1 Residual Means of Latent Endogenous Variables

From the extended LISREL model, several submodels can be defined. Subtypes of the LISREL model are defined by setting some of the arguments of the LISREL expectation function to NA. Note that because the default values of each LISREL matrix is NA, setting a matrix to NA can be accomplished by simply not giving it any other value.

The first submodel is the LISREL model without means.

\eta = B \eta + \Gamma \xi + \zeta

y = \Lambda_y \eta + \epsilon

x = \Lambda_x \xi + \delta

The LISREL model without means requires 9 matrices: LX, LY, BE, GA, PH, PS, TD, TE, and TH. Hence this LISREL model has TX, TY, KA, and AL as NA. This can be accomplished be leaving these matrices at their default values.

The TX, TY, KA, and AL matrices must be specified if either the mxData type is “cov” or “cor” and a means vector is provided, or if the mxData type is “raw”. Otherwise the TX, TY, KA, and AL matrices are ignored and the model without means is estimated.

A second submodel involves only endogenous variables.

\eta = B \eta + \zeta

y = \Lambda_y \eta + \epsilon

The endogenous-only LISREL model requires 4 matrices: LY, BE, PS, and TE. The LX, GA, PH, TD, and TH must be NA in this case. However, means can also be specified, allowing TY and AL if the data are raw or if observed means are provided.

Another submodel involves only exogenous variables.

x = \Lambda_x \xi + \delta

The exogenous-model model requires 3 matrices: LX, PH, and TD. The LY, BE, GA, PS, TE, and TH matrices must be NA. However, means can also be specified, allowing TX and KA if the data are raw or if observed means are provided.

The model that is run depends on the matrices that are not NA. If all 9 matrices are not NA, then the full model is run. If only the 4 endogenous matrices are not NA, then the endogenous-only model is run. If only the 3 exogenous matrices are not NA, then the exogenous-only model is run. If some endogenous and exogenous matrices are not NA, but not all of them, then appropriate errors are thrown. Means are included in the model whenever their matrices are provided.

The MxMatrix objects included as arguments may be of any type, but should have the properties described above. The mxExpectationLISREL will not return an error for incorrect specification, but incorrect specification will likely lead to estimation problems or errors in the mxRun function.

Like the mxExpectationRAM, the mxExpectationLISREL evaluates with respect to an MxData object. The MxData object need not be referenced in the mxExpectationLISREL function, but must be included in the MxModel object. mxExpectationLISREL requires that the 'type' argument in the associated MxData object be equal to 'cov', 'cor', or 'raw'.

To evaluate, place mxExpectationLISREL objects, the mxData object for which the expected covariance approximates, referenced MxAlgebra and MxMatrix objects, and optional MxBounds and MxConstraint objects in an MxModel object. This model may then be evaluated using the mxRun function. The results of the optimization can be found in the 'output' slot of the resulting model, and may be obtained using the mxEval function.

Value

Returns a new MxExpectationLISREL object. One and only one MxExpectationLISREL object can be included with models using one and only one fit function object (e.g., MxFitFunctionML) and with referenced MxAlgebra, MxData and MxMatrix objects.

References

Jöreskog, K. G. & Sörbom, D. (1996). LISREL 8: User's Reference Guide. Lincolnwood, IL: Scientific Software International.

Jöreskog, K. G. & Sörbom, D. (1982). Recent developments in structural equation modeling. Journal of Marketing Research, 19, 404-416.

The OpenMx User's guide can be found at https://openmx.ssri.psu.edu/documentation/.

See Also

demo("LISRELJointFactorModel")

Examples

   
# Create and fit a model using mxExpectationLISREL, and mxFitFunctionML

library(OpenMx)

vNames <- paste("v",as.character(1:6),sep="")
dimList <- list(vNames, vNames)
covData <- matrix(
  c(0.9223099, 0.1862938, 0.4374359, 0.8959973, 0.9928430, 0.5320662,
    0.1862938, 0.2889364, 0.3927790, 0.3321639, 0.3371594, 0.4476898,
    0.4374359, 0.3927790, 1.0069552, 0.6918755, 0.7482155, 0.9013952,
    0.8959973, 0.3321639, 0.6918755, 1.8059956, 1.6142005, 0.8040448,
    0.9928430, 0.3371594, 0.7482155, 1.6142005, 1.9223567, 0.8777786,
    0.5320662, 0.4476898, 0.9013952, 0.8040448, 0.8777786, 1.3997558
    ), nrow=6, ncol=6, byrow=TRUE, dimnames=dimList)

# Create LISREL matrices

mLX <- mxMatrix("Full", values=c(.5, .6, .8, rep(0, 6), .4, .7, .5),
          name="LX", nrow=6, ncol=2,
          free=c(TRUE,TRUE,TRUE,rep(FALSE, 6),TRUE,TRUE,TRUE),
          dimnames=list(vNames, c("x1","x2")))
mTD <- mxMatrix("Diag", values=c(rep(.2, 6)), 
          name="TD", nrow=6, ncol=6, free=TRUE,
          dimnames=dimList)
mPH <- mxMatrix("Symm", values=c(1, .3, 1), 
          name="PH", nrow=2, ncol=2, free=c(FALSE, TRUE, FALSE),
          dimnames=list(c("x1","x2"),c("x1","x2")))

# Create a LISREL expectation with LX, TD, and PH matrix names

expFunction <- mxExpectationLISREL(LX="LX", TD="TD", PH="PH")

# Create fit function and data

tmpData <- mxData(observed=covData, type="cov", numObs=100)
fitFunction <- mxFitFunctionML()

# Create the model, fit it, and print a summary.

tmpModel <- mxModel(model="exampleModel",
                    mLX, mTD, mPH, expFunction, fitFunction, tmpData)
tmpModelOut <- mxRun(tmpModel)
summary(tmpModelOut)


#--------------------------------------
# Fit factor model with means

require(OpenMx)

data(demoOneFactor)
nvar <- ncol(demoOneFactor)
varnames <- colnames(demoOneFactor)

factorMeans <- mxMatrix("Zero", 1, 1, name="Kappa",
                        dimnames=list("F1", NA))
xIntercepts <- mxMatrix("Full", nvar, 1, free=TRUE, name="TauX",
                        dimnames=list(varnames, NA))
factorLoadings <- mxMatrix("Full", nvar, 1, TRUE, .6, name="LambdaX",
                           labels=paste("lambda", 1:nvar, sep=""),
                           dimnames=list(varnames, "F1"))
factorCovariance <- mxMatrix("Diag", 1, 1, FALSE, 1, name="Phi")
xResidualVariance <- mxMatrix("Diag", nvar, nvar, TRUE, .2, name="ThetaDelta",
                              labels=paste("theta", 1:nvar, sep=""))

liModel <- mxModel(model="LISREL Factor Model",
	factorMeans, xIntercepts, factorLoadings,
	factorCovariance, xResidualVariance,
	mxExpectationLISREL(LX="LambdaX", PH="Phi",
		TD="ThetaDelta", TX="TauX", KA="Kappa"),
	mxFitFunctionML(),
	mxData(cov(demoOneFactor), "cov",
		means=colMeans(demoOneFactor), numObs=nrow(demoOneFactor))
)

liRun <- mxRun(liModel)

summary(liRun)

[Package OpenMx version 2.21.11 Index]