Bug when latents contain a dot in name?

3 replies [Last post]
Matifou's picture
Offline
Joined: 12/08/2009

Hi

I don't know if this is the right place to post this question/remark...

I think there is a bug when one of the variables contain a "." While it is expressely forbidden for indicator variables:
Erreur : The name 'x1.1' is illegal because it contains the '.' character

it is not checked for the latents variables, leading to potential errors when using graphVIz ( See modified example below).

Simple workaround would be to add "" to all variables names when exporting to graphViz, this is only a guess but probably using something like: "\"graph@latentVars[[i]]\""

Example:
require(OpenMx)
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G.FALSE")
factorModel <- mxModel("One Factor", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents, to=manifests),
mxPath(from=manifests, arrows=2),
mxPath(from=latents, arrows=2,
free=F, values=1.0),
mxData(cov(demoOneFactor), type="cov",
numObs=500))
Run<-mxRun(factorModel)
omxGraphviz(Run)

Steve's picture
Offline
Joined: 07/30/2009
We use a dot to reference

We use a dot to reference between submodels.

Suppose I have two MxModels, "G" and "H" that are nested within the same MxModel. Suppose MxModel "G" has a variable named "x". I can refer to the variable (or named entity) in "G" by using "G.x" even if I am using that reference in MxModel "H". So, this is a legal construct.

However, it doesn't refer to anything in your example above since there is no MxModel named "G" and no named entity inside "G" called "FALSE".

In addition, expect very, very bad things to happen if you name your variables "TRUE" or "FALSE"!

mspiegel's picture
Offline
Joined: 07/31/2009
Hmm. Steve's comments are

Hmm. Steve's comments are correct. The period character has a special meaning when applied to named entities (See the FAQ for a description of named entities). But I think that the manifest and latent variables are not named entities. If memory serves me correctly, then the manifest and latent variables are only used as row and column names for the A, S, and F matrices. So I believe there shouldn't be any unusual restrictions for their names.

I can believe that placing a period character might confuse the graphviz programs. I'll have to take a look at this after I return from traveling.

neale's picture
Offline
Joined: 07/31/2009
Can we trap names with dots

Can we trap names with dots and names such as TRUE or FALSE so that users are protected from "very, very bad things"?