Description Usage Arguments Details Value Examples

Automatically set starting values for an MxModel

1 | ```
mxAutoStart(model, type = c("ULS", "DWLS"))
``` |

`model` |
The MxModel for which starting values are desired |

`type` |
The type of starting values to obtain, currently unweighted or diagonally weighted least squares, ULS or DWLS |

This function automatically picks very good starting values for many models (RAM, LISREL, Normal), including multiple group versions of these. It works for models with algebras. Models of continuous, ordinal, and joint ordinal-continous variables are also acceptable. It works for model with covariance or raw data. However, it does not currently work for models with definition variables, state space models, and item factor analysis models.

The method used to obtain new starting values is quite simple. The user's model is changed to an unweighted least squares (ULS) model. The ULS model is estimated and its final point estimates are returned as the new starting values. Optionally, diagonally weighted least squares (DWLS) can be used instead with the `type`

argument.

Please note that ULS is sensitive to the scales of your variables. For example, if you have variables with means of 20 and variances of 0.001, then ULS will "weight" the means 20,000 times more than the variances and might result in zero variance estimates. Likewise if one variable has a variance of 20 and another has a variance of 0.001, the same problem may arise. To avoid this, make sure your variables are scaled accordingly. You could also use `type='DWLS'`

to have the function use diagonally weighted least squares to obtain starting values. Of course, using diagonally weighted least squares will take much much longer and will usually not provide better starting values than unweighted least squares.

an MxModel with new free parameter values

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ```
# Use the frontpage model with negative variances to show better
# starting values
library(OpenMx)
data(demoOneFactor)
latents = c("G") # the latent factor
manifests = names(demoOneFactor) # manifest variables to be modeled
m1 <- mxModel("One Factor", type = "RAM",
manifestVars = manifests, latentVars = latents,
mxPath(from = latents, to = manifests),
mxPath(from = manifests, arrows = 2, values=-.2),
mxPath(from = latents, arrows = 2, free = FALSE, values = 1.0),
mxPath(from = "one", to = manifests),
mxData(demoOneFactor, type = "raw")
)
# Starting values imply negative variances!
mxGetExpected(m1, 'covariance')
# Use mxAutoStart to get much better starting values
m1s <- mxAutoStart(m1)
mxGetExpected(m1s, 'covariance')
``` |

```
To take full advantage of multiple cores, use:
mxOption(NULL, 'Number of Threads', parallel::detectCores())
x1 x2 x3 x4 x5
x1 -0.2 0.0 0.0 0.0 0.0
x2 0.0 -0.2 0.0 0.0 0.0
x3 0.0 0.0 -0.2 0.0 0.0
x4 0.0 0.0 0.0 -0.2 0.0
x5 0.0 0.0 0.0 0.0 -0.2
sh: 1: wc: Permission denied
sh: 1: cannot create /dev/null: Permission denied
x1 x2 x3 x4 x5
x1 0.1985443 0.2000551 0.2293397 0.2791290 0.3162417
x2 0.2000551 0.2916950 0.2907948 0.3539260 0.4009836
x3 0.2293397 0.2907948 0.3740354 0.4057345 0.4596806
x4 0.2791290 0.3539260 0.4057345 0.5332788 0.5594766
x5 0.3162417 0.4009836 0.4596806 0.5594766 0.6703023
```

OpenMx documentation built on Oct. 5, 2018, 5:05 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.