You are here

Small bug: mxPath does not check that length(labels)==length(variables)

3 posts / 0 new
Last post
Matifou's picture
Offline
Joined: 12/08/2009 - 09:29
Small bug: mxPath does not check that length(labels)==length(variables)

Hi

I just saw a small inconsistency... don't know if this forum categroy is the right one to report that? If one which one would be more appropriate?

It is just that when using mxPath() if length(labels ) is smaller than number of variables, not all variables will be estimated, while in the graph all will be shown, for example using the seminal example from start page:

mxPath(from=manifests, arrows=2, labels="a"),

Estimation will lead only one manifests (with arrow=2), while graph will show all. Maybe should a check be added to ensure consistency? Thanks!

For complete example:

data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel1 <- mxModel("One Factor", type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents, to=manifests),
mxPath(from=manifests, arrows=2, labels="a"),
mxPath(from=latents, arrows=2,
free=F, values=1.0),
mxData(cov(demoOneFactor), type="cov",
numObs=500))
summary(mxRun(factorModel1))
omxGraphviz(factorModel1)

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
all vectors are "recycled" to

all vectors are "recycled" to the length needed, so your one label was applied to all the paths created, fixing them all equal.

works the same here

mxPath(from=c("a","b","c"), arrows = 2, free = F)

the last to are expanded to length 3

--> three 2-headed paths, all fixed

Matifou's picture
Offline
Joined: 12/08/2009 - 09:29
Oh ok! Then sorry, this was

Oh ok! Then sorry, this was an interpretation error from me!

So giving same name to variables restricted to same value so one parameter, but it is still logic that the graph shows three paths...

Sorry for the question and thanks for information!