You are here

Example Script for LDE estimation

3 posts / 0 new
Last post
Steve's picture
Joined: 07/30/2009 - 14:03
Example Script for LDE estimation
Plain text icon demoOscillator.txt1.03 KB
Binary Data LDE_2ndOrder_OneIndicator.R3.52 KB

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!

amullings09's picture
Joined: 12/21/2014 - 17:45
Help with LDE function


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.

mhunter's picture
Joined: 07/31/2009 - 15:26
Change script or ignore warning

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).

Log in or register to post comments