File: mxComputeOnce.Rd

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (59 lines) | stat: -rw-r--r-- 2,084 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/MxCompute.R
\name{mxComputeOnce}
\alias{mxComputeOnce}
\alias{MxComputeOnce-class}
\title{Compute something once}
\usage{
mxComputeOnce(
  from,
  what = NULL,
  how = NULL,
  ...,
  freeSet = NA_character_,
  verbose = 0L,
  .is.bestfit = FALSE
)
}
\arguments{
\item{from}{the object to perform the computation (a vector of expectation or fit function names)}

\item{what}{what to compute}

\item{how}{to compute it (optional)}

\item{...}{Not used.  Forces remaining arguments to be specified by name.}

\item{freeSet}{names of matrices containing free variables}

\item{verbose}{integer. Level of run-time diagnostic output. Set to zero to disable}

\item{.is.bestfit}{do not use; for backward compatibility}
}
\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.
}
\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 invariant to the
sign of the log likelihood scale whereas the Hessian is not.
Use the \code{how} parameter to specify which approximation to use
(one of "default", "hessian", "sandwich", "bread", and "meat").
}
\examples{
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
}