--- title: "create_parameter_table" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{create_parameter_table} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} %\DeclareUnicodeCharacter{2194}{$\leftrightarrow$} %\DeclareUnicodeCharacter{2192}{$\rightarrow$} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ```{r setup, include = FALSE} library(mxsem) ``` 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`: ```{r} 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) ``` 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.