General strategies

No replies
mspiegel's picture
Joined: 07/31/2009
  1. Use the traceback() function in R after an error occurs.
    It will print out the sequence of function calls that lead to the error.
  2. Simplify your code. This may help you locate an error more easily. For example, replace the following:
    foo <- mxModel(mxMatrix('Full', 1, 2, name = 'a'), 
        mxAlgebra(a + a, 'b'), mxAlgebraObjective('b'))

    aMatrix <- mxMatrix('Full', 1, 2, name = 'a')
    bAlgebra <- mxAlgebra(a + a, name = 'b')
    objective <- mxAlgebraObjective('b')
    model <- mxModel(aMatrix, bAlgebra, objective)