mxPath problem

Posted on
Picture of user. carey Joined: 10/19/2009

This is from BivariateSaturated_PathCov.R in the documentation

> bivSatModel1 <- mxModel("bivSat1",
+ manifestVars= selVars,
+ mxPath(
+ from=c("X", "Y"),
+ arrows=2,
+ free=T,
+ values=1,
+ lbound=.01,
+ labels=c("varX","varY")
+ ))
Error: The model type of model 'bivSat1' does not recognize paths.

any help?
greg

Replied on Thu, 12/31/2009 - 14:39
Picture of user. mspiegel Joined: Jul 31, 2009

Hmm, the version in the repository looks like this:

bivSatModel1 <- mxModel("bivSat1",
    manifestVars= selVars,
    mxPath(
        from=c("X", "Y"), 
        arrows=2, 
        free=T, 
        values=1, 
        lbound=.01, 
        labels=c("varX","varY")
    ),
    mxPath(
        from="X", 
        to="Y", 
        arrows=2, 
        free=T, 
        values=.2, 
        lbound=.01, 
        labels="covXY"
    ),
    mxData(
        observed=cov(testData), 
        type="cov", 
        numObs=1000 
    ),
    type="RAM"
)

The important argument to the mxModel() funciton is type="RAM" which creates a RAM model. Paths must be added to RAM type models.

Replied on Thu, 12/31/2009 - 20:19
Picture of user. carey Joined: Oct 19, 2009

In reply to by mspiegel

strongly suggest that this be documentation be adjusted to note this fact. the following contains the relevant sections for "type" in the documentation to mxModel. there is no mention that type=RAM must be specified with mxPath.

type character vector. The name of the model type to assign to this model.

The model type is determined by a character vector supplied to the ‘type’ argument. The type of a model is a dynamic property, ie. it is allowed to change during the lifetype of the model. To see a list of available types, use the mxTypes command. When a new model is created and no type is specified, the type specified by options("mxDefaultType") is used.

To be estimated, MxModel objects must include objective functions as arguments (mxAlgebraObjective, mxFIMLObjective, mxMLObjective or mxRAMObjective) and executed using the mxRun function. When MxData objects are included in models, the 'type' argument of these objects may require or exclude certain objective functions, or set an objective function as default.

Replied on Mon, 01/04/2010 - 09:34
Picture of user. neale Joined: Jul 31, 2009

For my money, I would say that in this case it would be sensible for mxModel to automagically (aka by default) set the Type="Ram" argument because paths are clearly involved. This would save users - novice and expert alike - time.