bug in manifest var ordering?

First off, thanks to the OpenMx team for all your hard work! Hopefully this is a simple issue.
For starters, here's my mxVersion():
OpenMx version: 2.13.2 [GIT v2.13.2]
R version: R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu
Default optimizer: CSOLNP
NPSOL-enabled?: No
OpenMP-enabled?: Yes
I'm encountering unexpected behavior when I reorder manifest vars AND use a cov matrix in mxData. Here's how to reproduce the behavior:
data(demoOneFactor)
# Scramble the order of the manifest vars
manifests <- sample(names(demoOneFactor), ncol(demoOneFactor))
latents <- c("G")
m1 <- 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=FALSE, values=1.0),
mxData(cov(demoOneFactor), type="cov", numObs=500)
)
summary(mxRun(m1))
When the above is run, I get inconsistent outputs for the path weights.
Run 1 output:
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A x4 G 0.57666353 0.020407456
2 One Factor.A[2,6] A x5 G 0.79545294 0.026616043
3 One Factor.A[3,6] A x1 G 0.70207018 0.023963325
4 One Factor.A[4,6] A x3 G 0.39675456 0.015518629
5 One Factor.A[5,6] A x2 G 0.50315695 0.018195994
6 One Factor.S[1,1] S x4 x4 0.04074550 0.003142852
7 One Factor.S[2,2] S x5 x5 0.03621450 0.003667524
8 One Factor.S[3,3] S x1 x1 0.03930826 0.003398649
9 One Factor.S[4,4] S x3 x3 0.04073255 0.002804281
10 One Factor.S[5,5] S x2 x2 0.03794390 0.002797373
Run 2:
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A x2 G 0.57666350 0.020407523
2 One Factor.A[2,6] A x3 G 0.39675451 0.015518674
3 One Factor.A[3,6] A x1 G 0.50315690 0.018196057
4 One Factor.A[4,6] A x4 G 0.70207014 0.023963421
5 One Factor.A[5,6] A x5 G 0.79545288 0.026616170
6 One Factor.S[1,1] S x2 x2 0.04074549 0.003142851
7 One Factor.S[2,2] S x3 x3 0.04073254 0.002804280
8 One Factor.S[3,3] S x1 x1 0.03794392 0.002797376
9 One Factor.S[4,4] S x4 x4 0.03930825 0.003398648
10 One Factor.S[5,5] S x5 x5 0.03621451 0.003667526
Run 3:
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A x1 G 0.39675452 0.015518630
2 One Factor.A[2,6] A x5 G 0.57666350 0.020407448
3 One Factor.A[3,6] A x2 G 0.70207015 0.023963315
4 One Factor.A[4,6] A x3 G 0.79545288 0.026616026
5 One Factor.A[5,6] A x4 G 0.50315690 0.018195986
6 One Factor.S[1,1] S x1 x1 0.04073254 0.002804280
7 One Factor.S[2,2] S x5 x5 0.04074549 0.003142852
8 One Factor.S[3,3] S x2 x2 0.03930825 0.003398648
9 One Factor.S[4,4] S x3 x3 0.03621451 0.003667526
10 One Factor.S[5,5] S x4 x4 0.03794392 0.002797376
Look at the estimates for x1 (for example). I would expect the estimate of x1 to be consistent across runs, even if the order is scrambled. If I change the model to use the raw data instead of the cov matrix, I get expected behavior (that is, x1 has a consistent estimate across runs, even though order is scrambled):
data(demoOneFactor)
# Scramble the order of the manifest vars
manifests <- sample(names(demoOneFactor), ncol(demoOneFactor))
latents <- c("G")
m1 <- 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=FALSE, values=1.0),
mxPath(from='one', to=manifests),
mxData(demoOneFactor, type='raw')
)
summary(mxRun(m1))
Run 1:
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A x3 G 0.57666368 0.020407423
2 One Factor.A[2,6] A x2 G 0.50315710 0.018195993
3 One Factor.A[3,6] A x4 G 0.70207038 0.023963286
4 One Factor.A[4,6] A x5 G 0.79545315 0.026616017
5 One Factor.A[5,6] A x1 G 0.39675465 0.015518631
6 One Factor.S[1,1] S x3 x3 0.04074549 0.003142852
7 One Factor.S[2,2] S x2 x2 0.03794394 0.002797378
8 One Factor.S[3,3] S x4 x4 0.03930828 0.003398651
9 One Factor.S[4,4] S x5 x5 0.03621449 0.003667524
10 One Factor.S[5,5] S x1 x1 0.04073253 0.002804279
Run 2:
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A x3 G 0.57666351 0.020407089
2 One Factor.A[2,6] A x5 G 0.79545288 0.026615509
3 One Factor.A[3,6] A x4 G 0.70207015 0.023962871
4 One Factor.A[4,6] A x1 G 0.39675451 0.015518388
5 One Factor.A[5,6] A x2 G 0.50315690 0.018195638
6 One Factor.S[1,1] S x3 x3 0.04074549 0.003142852
7 One Factor.S[2,2] S x5 x5 0.03621451 0.003667527
8 One Factor.S[3,3] S x4 x4 0.03930825 0.003398649
9 One Factor.S[4,4] S x1 x1 0.04073254 0.002804280
10 One Factor.S[5,5] S x2 x2 0.03794392 0.002797376
etc, etc.
Thanks for looking in to this!
I reproduce the apparently
I reproduce the apparently buggy behavior you report with `type="cov"`. But for me, the parameters table from `summary()` identifies rows and columns by number, not name, even though the matrices in question have dimnames, e.g.
free parameters:
name matrix row col Estimate Std.Error A
1 One Factor.A[1,6] A 1 6 0.70207014 0.023963267
2 One Factor.A[2,6] A 2 6 0.50315689 0.018195962
3 One Factor.A[3,6] A 3 6 0.57666350 0.020407396
4 One Factor.A[4,6] A 4 6 0.79545288 0.026615970
5 One Factor.A[5,6] A 5 6 0.39675452 0.015518605
6 One Factor.S[1,1] S 1 1 0.03930825 0.003398649
7 One Factor.S[2,2] S 2 2 0.03794393 0.002797376
8 One Factor.S[3,3] S 3 3 0.04074549 0.003142852
9 One Factor.S[4,4] S 4 4 0.03621451 0.003667526
10 One Factor.S[5,5] S 5 5 0.04073253 0.002804280
My `mxVersion()`:
OpenMx version: 2.14.11.18 [GIT v2.14.11-18-g2a64d2ad-dirty]
R version: R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu
Default optimizer: CSOLNP
NPSOL-enabled?: Yes
OpenMP-enabled?: Yes
Log in or register to post comments
gah
Thanks for reporting this. I tested raw data carefully, but might have missed the cov data case. I'll take a look.
Log in or register to post comments
In reply to gah by jpritikin
fixed
This bug is fixed in v2.14.11-25-gcd9a95ca3
Thank you for your report.
Log in or register to post comments