R Functions and User Interface

Posted on
Picture of user. carey Joined: 10/19/2009

Scope of functions available to OpenMx

folks,
short and sweet: how can OpenMx access user-written functions and functions from other packages? e.g., i would like to access alpha and sumx in the following code:

alpha <- .3
sumx <- function (x) {
sum(x)
}
x <- c(1, 2, 3)
testModel <- mxModel("testModel", mxAlgebra(expression="alpha * sumx(x)", name="test"))
mxRun(testModel)

Posted on
Picture of user. neale Joined: 07/31/2009

Error messages not informative enough

Example:

Running modelThreshReparam3
Error: The expected covariance matrix associated with the FIML objective in model 'modelThreshReparam3' is not of the same length as the dimnames provided by the objective function.

This should read:

Running modelThreshReparam3
Error: The expected covariance matrix associated with the FIML objective in model 'modelThreshReparam3' is not of the same length as the dimnames provided by the objective function.
The expected covariance matrix is of dimension 4x4, but the length of the dimnames in the objective function is 3

Posted on
Picture of user. pdeboeck Joined: 08/04/2009

Outputting mxModel

Is there a function to output an mxModel to a file? I was running a simulation, and rather than extracting a few specific elements, I wanted to save the results from each model fit to a file. I tried dput(). While a file was written, I can not retrieve it using dget(). My ideal would be to be able to save the entirety of mxModel for future reference. Ideas?
Posted on
Picture of user. tbates Joined: 07/31/2009
Posted on
Picture of user. mhunter Joined: 07/31/2009

Acceptable Functions for mxAlgebra

I'm trying to run a model where I need to round a value in an mxMatrix to an integer. I'm doing this in an mxAlgebra. In the help files for mxAlgebra, I noticed that there is no 'round' function listed. (There are lots of other functions: min, max, abs, sum, etc.) Is there a reason for its exclusion, or was it just forgotten?

In R, if you type ?Arith to get the help page for the S4 generic mathematical operators. An mxAlgebra should probably be able to handle all of these, and already does handle most of them.

Posted on
Picture of user. tbates Joined: 07/31/2009

mxCI

I wonder if others would like the confidence intervals report to include the initial value in the middle as a convenience
i.e.,
confidence intervals:

                lbound        estimate        ubound
top.a[1,1]   0.6275213     0.713             0.7931507

rather than
                lbound    ubound
top.a[1,1]   0.6275213  0.7931507
Posted on
Picture of user. Ryne Joined: 07/31/2009

Default M matrix in type="RAM" models

Hi all,

I'm writing a simple latent change score demo using mxPath, and found something interesting. I believe we've talked about default means models before, but I don't recall.

Posted on
Picture of user. tbates Joined: 07/31/2009

mxAlgebra efficiency

When seeking to optimize mxAlgebra, would there be a speed benefit (or cost?) to saying instead of, for example:

mxAlgebra(rbind (cbind(A+C+E, .5%x%A+C),
cbind(.5%x%A+C , A+C+E) ), name="DZCov")

instead saying:

mxAlgebra( A+C+E , name="ACE")
mxAlgebra( .5%x%A+C+E, name="halfACE")

mxAlgebra(rbind (cbind(ACE, hACE),
cbind(hACE, ACE) ), name="DZCov")

Posted on
Picture of user. tbrick Joined: 07/31/2009

Mx1's \mnor and \allint

A recently posted issue requested the implementation of Mx1's \mnor and \allint functions, which perform integrations between thresholds on a multivariate normal distribution. This functionality is already being used in FIML Objectives if the data are ordinal (using code supplied by Alan Genz), so the back-end implementation is not difficult.

Posted on
Picture of user. neale Joined: 07/31/2009

Mixture distribution, zygosity example

I seem to have this almost working but for a pesky error:

Error: The job for model 'twinACE' exited abnormally with the error message: Objective returned invalid value.
Execution halted

Script and data files attached (albeit with an extra _ in the name of the latter, ffs).