Revision of mxModel Help from Fri, 11/20/2009 - 07:12

The revisions let you track differences between multiple versions of a post.

Wiki home page

Please add material here as you learn...

If you have questions not answers, then add those here: That's how a wiki works.

Basic Examples

<em># Create an empy model, and place it in an object.</em>
model <- mxModel()
 
<em># Create a model named 'firstdraft' with one matrix</em>
 
<pre>
	model <- mxModel('firstdraft', mxMatrix('Full', nrow = 3, ncol = 3, name = "A"))

# Add other matrices to model 'firstdraft', and rename that model 'finaldraft'

model <- mxModel(model, name= "finaldraft",
                 mxMatrix('Symm', nrow = 3, name = "S"),
                 mxMatrix('Iden', nrow = 3, name = "F"))

# Add data to the model from an existing data frame in object 'data'
data <- data.frame()
model <- mxModel(model, mxData(data, type='raw'))

# View the matrix named "A" in MxModel object 'model'
model[["A"]]

# View the data associated with MxModel object 'model'
model@data

Remove an object from a model

You can remove paths, matrices, algebras, and other objects from a model using mxModel, with the to-be-modified model as its first parameter, and then a comma delimited list of the names of the objects you want to remove, setting remove to TRUE
e.g.

  aModel <- <strong>mxModel</strong>("aModel", mxMatrix(name="myMatrix", type="Full",nrow=8,ncol=5))
  aMinus <- <strong>mxModel</strong>(aModel,  "myMatrix", remove=<font	color="green">TRUE</font>)