|Figure 9: ACE path diagram|
- Check first of all that the original script works properly: OpenMx is under development and just because a script is in a manual or the 'demos' folder does not guarantee it is error free. If you get a crash from a script provided with OpenMx, communicate this to the OpenMx community.
- Second, check that you have the necessary libraries open. OpenMx commands need a require(OpenMx) statement at the start of the script, but this may be omitted, because the script writer assumes you will already have OpenMx active.
- You need then to study the error messages that you get, which will mean scrolling back through the output on the console. The error message may, for instance, tell you that a file you are trying to read does not exist. If so, check you have spelt the name correctly. It is possible that the script is looking for the file in the wrong place. With the console window on top, select File/Change Dir from the menu bar, which will allow you to identify, and if necessary reset, the default directory. This is the place where your scripts will default to when reading or writing files.
- Error messages are often helpful in clarifying what is wrong, but can sometimes be misleading. Always identify the first error message – an early error often causes knock-on effects, and so the later errors may disappear once you fix the primary error.
- Common reasons for scripts failing are (a) mistyping, including getting lower and upper case letters wrong; (b) missing brackets; (c) missing comma; (d) missing or misplaced quotes; (e) using regular brackets where square brackets are required, i.e. to refer to parts of matrices. Note too that if you paste a script from a Word or .pdf document, then it may give 'smart quotes' (i.e. angled quotes) which can cause an error.
- It can be helpful to go through the script section by section, pasting each section into the console to check it. You can type names of variables as you go to see if they are correctly computed. Because an mxModel does not run until you give a mxRun command, you can't evaluate results of the model this way, but you can still type in each section of the model (omitting the comma, after the final close bracket), and this will alert you to typographical errors.