set the starting values of an OpenMx model. This is just an interface to omxSetParameters.
Examples
library(mxsem)
model <- '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + a1*y2 + b*y3 + c1*y4
dem65 =~ y5 + a2*y6 + b*y7 + c2*y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
'
fit <- mxsem(model = model,
data = OpenMx::Bollen) |>
set_starting_values(values = c("a1" = .4, "c1" = .6)) |>
mxTryHard()
#> Running untitled30 with 41 parameters
#>
#> Beginning initial fit attempt
#> Running untitled30 with 41 parameters
#>
#> Lowest minimum so far: 3096.94452072239
#>
#> Solution found
#>
#>
#> Solution found! Final fit=3096.9445 (started at 202112.01) (1 attempt(s): 1 valid, 0 errors)
#> Start values from best fit:
#> 2.17951993792048,1.81811344697602,1.4490411159914,0.604498874576992,1.29147141297118,1.17388155801408,1.30214914395505,0.898492666048198,1.13247270222666,1.20957809765594,1.91458668528174,7.40452834915067,4.99236366345596,1.3205372122458,3.15117599902524,2.17541553682278,5.01524359759759,0.0813524969674625,0.120528406392437,0.466700441185688,0.59097031719018,2.30230303625964,0.731344443440538,3.52501100826446,0.353176091251635,1.41225221955599,3.32139920008917,0.448634236200055,3.71721514264804,0.164479622054279,5.46466709551259,4.2564441740175,6.56311112389727,4.45253330116101,2.97807466585473,5.05438391946534,4.79219479788137,3.55768994680503,5.13625227567731,6.1962643529472,4.04339004204786