# Example of using a definition variable in a RAM model

3 posts / 0 new
Offline
Joined: 07/31/2009 - 14:25
Example of using a definition variable in a RAM model

Hi,
Are there any example scripts for how to add a definition variable to a RAM model, and how to then use that in an algebra on a path?

Here's one adding a definition variable for means, but not including its value in an algebra, and then using that algebra to se the value for another path.

http://openmx.psyc.virginia.edu/docs/OpenMx/2.5.1/DefinitionMeans_Path.html

Offline
Joined: 05/24/2012 - 00:35
like this?

inst/models/nightly/univACErSEM.R

Offline
Joined: 07/31/2009 - 14:25
Example rather than test (and creating a moderated path in RAM)

Thanks Josh,
Wanting an example to point people to with comments on most lines explaining how the script works. Also one just showing "Here is how to create a moderated path in RAM" rather than more complex example for learning.

Reading through univACErSEM.R now: The definition variables are used on paths directly, rather than being used to moderate a path (i.e., compute the path based on the definition variable. e.g.

mxMatrix(name= "beta1", 1,1)
mxAlgebra(name= "BMIalg", latentBMI + beta1 * data.BMI_SNP)