Sun, 09/06/2009 - 16:21

Here is a very basic script for a univariate second order differential equation that Pascal Deboeck and I wrote yesterday. This is the infamous damped linear oscillator.

In order to give you some sample data to run it on, I have attached a data file and used a read.table file that accesses the data file in this post using its URL.

If you have comments, I'd like to hear them!

Attachment | Size |
---|---|

demoOscillator.txt | 1.03 KB |

LDE_2ndOrder_OneIndicator.R | 3.52 KB |

Hey,

I am a new graduate student and am interested in using this model for my thesis. I am trying to practice with your demo oscillator data, and then plan on testing it with some of my own data. So far the function provided has worked, except it seems that one part of the function is outdated:

Warning message:

In mxMLObjective("R") :

Objective functions like mxMLObjective() have been deprecated in favor of expectation and fit functions.

Please use mxExpectationNormal(covariance= , ...) instead, and add a call to mxFitFunctionML()

See examples at help(mxExpectationNormal)

I was wondering whether someone could direct/guide me on what fit function would be best to use for the LDE estimator? I am new to SEM (e.g., First year MA candidate), so I am at a bit of a learning curve working with these functions in R.

You can ignore the warning if you want. The model still works fine. If the warning message bothers you, then you can replace the line

with the pair of lines

The single line above and the pair of lines are exactly equivalent in terms of the modeling procedures performed by OpenMx. You can verify this for yourself by running the model both ways and comparing the results.

We made the expectation-fit split in 2.0 because we realized that things like the mxMLObjective were really making two decisions: one, the model is for a covariance matrix "R" with a normal distribution (expectation normal), and two, we're going to fit the normal distribution with maximum likelihood (fit function ML).