create_parameter_table

The core function of mxsem is to create a parameter table, where all loadings, regressions, and (co-)variances are specified. This parameter table is then used to set up an mxModel with the mxPath-function. It can be useful to visually inspect the parameter table created by mxsem. To this end, set the return_parameter_table-argument to TRUE:

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 ~ g1*ind60
    dem65 ~ g2*ind60 + g3*dem60

  # residual correlations
    y1 ~~ y5
    y2 ~~ y4 + y6
    y3 ~~ y7
    y4 ~~ y8
    y6 ~~ y8
    
! delta_a
! g1g3
a2   := a1 + delta_a
g1g3 := g1*g3
'

model_list <- mxsem(model = model,
                    data  = OpenMx::Bollen,
                    return_parameter_table = TRUE)

print(model_list$parameter_table)
#> $parameter_table
#>      lhs op   rhs modifier lbound ubound  free
#> 1  ind60 =~    x1      1.0                TRUE
#> 2  ind60 =~    x2                         TRUE
#> 3  ind60 =~    x3                         TRUE
#> 4  dem60 =~    y1      1.0                TRUE
#> 5  dem60 =~    y2       a1                TRUE
#> 6  dem60 =~    y3        b                TRUE
#> 7  dem60 =~    y4       c1                TRUE
#> 8  dem65 =~    y5      1.0                TRUE
#> 9  dem65 =~    y6       a2               FALSE
#> 10 dem65 =~    y7        b                TRUE
#> 11 dem65 =~    y8       c2                TRUE
#> 12 dem60  ~ ind60       g1                TRUE
#> 13 dem65  ~ ind60       g2                TRUE
#> 14 dem65  ~ dem60       g3                TRUE
#> 15    y1 ~~    y5                         TRUE
#> 16    y2 ~~    y4                         TRUE
#> 17    y2 ~~    y6                         TRUE
#> 18    y3 ~~    y7                         TRUE
#> 19    y4 ~~    y8                         TRUE
#> 20    y6 ~~    y8                         TRUE
#> 21 ind60 ~~ ind60                         TRUE
#> 22 dem60 ~~ dem60                         TRUE
#> 23 dem65 ~~ dem65                         TRUE
#> 24    y1 ~~    y1                         TRUE
#> 25    y2 ~~    y2                         TRUE
#> 26    y3 ~~    y3                         TRUE
#> 27    y4 ~~    y4                         TRUE
#> 28    y6 ~~    y6                         TRUE
#> 29    x1 ~~    x1                         TRUE
#> 30    x2 ~~    x2                         TRUE
#> 31    x3 ~~    x3                         TRUE
#> 32    y5 ~~    y5                         TRUE
#> 33    y7 ~~    y7                         TRUE
#> 34    y8 ~~    y8                         TRUE
#> 35    y1  ~     1                         TRUE
#> 36    y2  ~     1                         TRUE
#> 37    y3  ~     1                         TRUE
#> 38    y4  ~     1                         TRUE
#> 39    y6  ~     1                         TRUE
#> 40    x1  ~     1                         TRUE
#> 41    x2  ~     1                         TRUE
#> 42    x3  ~     1                         TRUE
#> 43    y5  ~     1                         TRUE
#> 44    y7  ~     1                         TRUE
#> 45    y8  ~     1                         TRUE
#> 
#> $user_defined
#> character(0)
#> 
#> $algebras
#>    lhs op        rhs
#> 1   a2 := a1+delta_a
#> 2 g1g3 :=      g1*g3
#> 
#> $variables
#> $variables$manifests
#>  [1] "y1" "y2" "y3" "y4" "y6" "x1" "x2" "x3" "y5" "y7" "y8"
#> 
#> $variables$latents
#> [1] "ind60" "dem60" "dem65"
#> 
#> 
#> $new_parameters
#> [1] "delta_a" "g1g3"   
#> 
#> $new_parameters_free
#> [1] "TRUE"  "FALSE"

The element parameter_table$parameter_table specifies all loadings (op is =~), regressions (op is ~), and (co-)variances (op is ~~). The modifier specifies parameter labels, lbound is the lower bound and ubound is the upper bound for parameters. Finally, free specifies if a parameter is estimated (TRUE) or fixed (FALSE).

If there are algebras, these are listed in the parameter_table$algebras data.frame. Note that the new parameters delta_a and g1g3 used in these algebras are listed in parameter_table$new_parameters, while parameter_table$new_parameters_free specifies for each of these new parameters if they are free or fixed. In this case g1g3 is fixed because it is the product of two other parameters.

The variables specify which of the variables are manifest (observed) and which are latent (unobserved). Each manifest variable must also be found in the data set.