You are here

Add omxCheck...() statements to demos

Hi Tim,

Can you add omxCheckCloseEnough() statements to OneFactorMatrixDemo.R and TwinAnalysis_Multivariate_Matrix_Raw.R? There may be a bug in the way the optimizer handles the second demo, but we can't be certain until we know what the correct answer is supposed to be. Also I went ahead and made some R style changes to TwinAnalysis_Multivariate_Matrix_Raw.R. Until we get an OpenMx wiki page on R style guidelines, use the Google R style guide: http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html, particularly items (7) and (8).

Reporter: 
Created: 
Fri, 09/18/2009 - 12:14
Updated: 
Fri, 02/08/2013 - 12:11

Comments

We think the bug mentioned earlier has been fixed in r826, but we won't know for sure until omxCheckCloseEnough() are added.

hi mike,
Is there some information on how to implement close enough such that it runs mx locally?

I didn't do this based on an existing mx output, so I don't have the right values to just paste in.

I think I understand the question. omxCloseEnough() takes three arguments: omxCheckCloseEnough(a, b, epsilon = 10^(-15)). 'a' is a numeric vector or matrix, 'b' is a numeric vector or matrix, and 'epsilon' is the maximum allowed difference between the elements of 'a' and the elements of 'b'. You can run mx 1.0 from OpenMx using the function omxOriginalMx(), which takes two arguments: 'mx.filename' is a string that is the name of the mx script to run, and 'output.directory' is a string that is the name of the directory where all the output files will be dumped. Both parameters must have relative paths to the current working directory. Also you must have 'mx' appear somewhere in your $PATH. It's ok to use omxOriginalMx() to get the correct values for omxCloseEnough(). It's not ok to use omxOriginalMx() in either the demo or models/passing scripts. We do not assume that our developers or users have installed Mx 1.0.

thanks michael,
I made this page to explain that

http://openmx.psyc.virginia.edu/wiki/writing-demo-scripts

can (should?) we have a folder "/trunk/demo/mx/"

to contain the original mx script (and data if necessary). That way the OpenMx script can contain point to local mx scripts and data. As the scripts change and new demos are written, the base mx script can be modified or used as a basis for a new demo: Much easier, and verifiable (errors may be in the mx1.6 script).

t

The mx-scripts cannot go in "/trunk/demo/mx/" because the R build system will complain if it locates files in the demo directory tree that are not R files. But feel free to place them in a /trunk/inst/mx directory, as files and directories in the inst directory tree are put in the binary release. If you include large data files, keep in mind that you are increasing the size of the binary release (although text files are compressed fairly well in .zip or .tar.gz format).

Again, closed for quite a while, but just now marked as such.