Description Usage Arguments Details Value References See Also Examples

View source: R/MxFitFunctionAlgebra.R

mxFitFunctionAlgebra returns an MxFitFunctionAlgebra object.

1 2 | ```
mxFitFunctionAlgebra(algebra, numObs = NA, numStats = NA, ..., gradient =
NA_character_, hessian = NA_character_, verbose = 0L, units="-2lnL")
``` |

`algebra` |
A character string indicating the name of an MxAlgebra or MxMatrix object to use for optimization. |

`numObs` |
(optional) An adjustment to the total number of observations in the model. |

`numStats` |
(optional) An adjustment to the total number of observed statistics in the model. |

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

`gradient` |
(optional) A character string indicating the name of an MxAlgebra object. |

`hessian` |
(optional) A character string indicating the name of an MxAlgebra object. |

`verbose` |
(optional An integer to increase the level of runtime log output. |

`units` |
(optional) The units of the fit statistic. |

If you want to fit a multigroup model, the preferred way is to use `mxFitFunctionMultigroup`

.

Fit functions are functions for which free parameter values are chosen such that the value of the objective function is minimized. While the other fit functions in OpenMx require an expectation function for the model, the `mxAlgebraObjective`

function uses the referenced `MxAlgebra`

or `MxMatrix`

object as the function to be minimized.

If a model's fit function is an `mxFitFunctionAlgebra`

objective function, then the referenced algebra in the objective function must return a 1 x 1 matrix (when using OpenMx's default optimizer). There is no restriction on the dimensions of an fit function that is not the primary, or ‘topmost’, objective function.

To evaluate an algebra fit function, place the following objects in a `MxModel`

object: a `mxFitFunctionAlgebra`

, `MxAlgebra`

and `MxMatrix`

entities referenced by the `MxAlgebraObjective`

, and optional `MxBounds`

and `MxConstraint`

objects. This model may then be evaluated using the `mxRun`

function. The results of the optimization may be obtained using the `mxEval`

function on the name of the `MxAlgebra`

, after the model has been run.

First and second derivatives can be provided with the algebra fit function. The dimnames on the gradient and hessian MxAlgebras are matched against names of free variables. Names that do not match are ignored. The fit is assumed to be in deviance units (-2 log likelihood units). If you are working in log likelihood units, the -2 scaling factor is not applied automatically. You have to multiply by -2 yourself.

Returns an MxFitFunctionAlgebra object. MxFitFunctionAlgebra objects should be included with models with referenced `MxAlgebra`

and `MxMatrix`

objects.

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

Other fit functions:
`mxFitFunctionMultigroup`

, `mxFitFunctionML`

,
`mxFitFunctionWLS`

, `mxFitFunctionGREML`

,
`mxFitFunctionR`

, `mxFitFunctionRow`

To create an algebra suitable as a reference function to be minimized see: mxAlgebra

More information about the OpenMx package may be found here.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
# Create and fit a very simple model that adds two numbers using mxFitFunctionAlgebra
library(OpenMx)
# Create a matrix 'A' with no free parameters
A <- mxMatrix('Full', nrow = 1, ncol = 1, values = 1, name = 'A')
# Create an algebra 'B', which defines the expression A + A
B <- mxAlgebra(A + A, name = 'B')
# Define the objective function for algebra 'B'
objective <- mxFitFunctionAlgebra('B')
# Place the algebra, its associated matrix and
# its objective function in a model
tmpModel <- mxModel(model="Addition", A, B, objective)
# Evalulate the algebra
tmpModelOut <- mxRun(tmpModel)
# View the results
tmpModelOut$output$minimum
``` |

OpenMx documentation built on Nov. 17, 2017, 6:50 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.