You are here

Revision of errors from Wed, 09/02/2009 - 14:21

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

General strategies for locating errors

  • Use the traceback() function in R after an error occurs.It will print out the sequence of function calls that lead to the error.

"Argument is missing, with no default"

  • Variations include:
    • Error in single.na(to) : argument is missing, with no default
  • Typical cause: A leading or trailing comma in your code makes R think that you wanted to pass in a parameter, but left it empty (hence "missing, with not default")
    • Examples:
    • leading comma
      to=c(,'x','y','z')
    • trailing comma
      mxMatrix("Name"
                          nrow=3,ncol=3,free=TRUE, values=.5,
                          )
                      
    • Cure: remove the errant comma
<h3>Error in convertVFN(... NAs introduced by coercion</h3>
<ul><li>Whenever you see NAs being introduced by coercion, suspect that you have the wrong type of value for a parameter: For instance, perhaps you are setting a number to string or vice versa... the coercion will fail, leaving an NA, which R warns you about.</li>
    <li>Example:
        <em>#You say:</em>
        <pre>
            mxMatrix(type = "Full", nrow = 1, ncol = 1, free = FALSE, 
            values = "l1", labels = "aa", 
            lbound = 0, ubound = 2, name = "la"),
        </pre>
    </li>
    We try and convert the character "l1" to a numeric <strong>value</strong>, can't, return an NA... hence the error: NAs induced by coercion.
    <li>The error:
        <pre>
            Warning messages:
            1: In convertVFN(values, free, labels, lbound, ubound, nrow, ncol) :
            NAs introduced by coercion...
        </pre>
    </li>
    <li>Solution: in this case, set the value to a numeric, (and remember that to equate values, you set the labels to be the same)</li>
</ul>

<h3>$status[[3]] [CHARSXP: "Covariance matrix is not positive-definite."]</h3>
<ul>
    <li>Look at your starting values. if you have used starting values 1s, you are building an initial expected covariance that is exactly singular. At the first iteration, OpenMx can't invert the expected covariance matrix, and crashes.</li>
    <li><strong>Solution</strong>: Try changing your starting values (say, by making all of the covariances and free regressions .5) and see if it runs.</li>
</ul>