| lav_constraints | R Documentation |
Utility functions for equality and inequality constraints.
lav_con_parse(partable = NULL, constraints = NULL, theta = NULL,
debug = FALSE, box_fast = NULL)
lav_pt_con_ceq(partable, con = NULL, debug = FALSE,
txt_only = FALSE)
lav_pt_con_ciq(partable, con = NULL, debug = FALSE,
txt_only = FALSE)
lav_pt_con_def(partable, con = NULL, debug = FALSE,
txt_only = FALSE, warn = TRUE)
partable |
A lavaan parameter table. |
constraints |
A character string containing the constraints. |
theta |
A numeric vector. Optional vector with values for the model parameters in the parameter table. |
debug |
Logical. If TRUE, show debugging information. |
box_fast |
Logical. If |
con |
An optional partable where the operator is one of ‘==’, ‘>’, ‘<’ or ‘:=’ |
txt_only |
Logical. If TRUE, only the body of the function is returned as a character string. If FALSE, a function is returned. |
warn |
Logical. If FALSE, warnings are suppressed. |
This is a collection of lower-level constraint-related functions that are used in the lavaan code. They are made public at the request of package developers. Below is a brief description of what they do:
The lav_con_parse function parses the constraints
specification (provided as a string, see example), and generates
a list with useful information about the constraints.
The lav_pt_con_ceq function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the slack values for each equality constraint. If the equality
constraints hold perfectly, this function returns zeroes.
The lav_pt_con_ciq function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the slack values for each inequality constraint.
The lav_pt_con_def function creates a function
which takes the (unconstrained) parameter vector as input, and
returns the computed values of the defined parameters.
myModel <- 'x1 ~ a*x2 + b*x3 + c*x4'
myParTable <- lavParTable(myModel, as_data_frame = FALSE)
con <- ' a == 2*b
b - c == 5 '
conInfo <- lav_con_parse(myParTable, constraints = con)
myModel2 <- 'x1 ~ a*x2 + b*x3 + c*x4
a == 2*b
b - c == 5 '
ceq <- lav_pt_con_ceq(partable = lavParTable(myModel2))
ceq( c(2,3,4) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.