mxComputeOnce: Compute something once

Description Usage Arguments Details Examples

Description

Some models are optimized for a sparse Hessian. Therefore, it can be much more efficient to compute the inverse Hessian in comparison to computing the Hessian and then inverting it.

Usage

1
2
mxComputeOnce(from, what = NULL, how = NULL, ..., freeSet = NA_character_,
  verbose = 0L, .is.bestfit = FALSE)

Arguments

from

the object to perform the computation (a vector of expectation or fit function names)

what

what to compute

how

to compute it (optional)

...

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

freeSet

names of matrices containing free variables

verbose

the level of debugging output

.is.bestfit

do not use; for backward compatibility

Details

The information matrix is only valid when parameters are at the maximum likelihood estimate. The information matrix is returned in model$output$hessian. You cannot request both the information matrix and the Hessian. The information matrix is invarient to the sign of the log likelihood scale whereas the Hessian is not. Use the how parameter to specify which approximation to use (one of "default", "hessian", "sandwich", "bread", and "meat").

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(demoOneFactor)
factorModel <- mxModel(name ="One Factor",
  mxMatrix(type="Full", nrow=5, ncol=1, free=TRUE, values=0.2, name="A"),
    mxMatrix(type="Symm", nrow=1, ncol=1, free=FALSE, values=1, name="L"),
    mxMatrix(type="Diag", nrow=5, ncol=5, free=TRUE, values=1, name="U"),
    mxAlgebra(expression=A %*% L %*% t(A) + U, name="R"),
    mxFitFunctionML(),mxExpectationNormal(covariance="R", dimnames=names(demoOneFactor)),
    mxData(observed=cov(demoOneFactor), type="cov", numObs=500),
    mxComputeOnce('fitfunction', 'fit'))
factorModelFit <- mxRun(factorModel)
factorModelFit$output$fit  # 972.15


Search within the OpenMx package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.