Learn R Programming

simsem (version 0.2-8)

simEqualCon: Equality Constraint Object

Description

This function will be used to specify equality constraints.

Usage

simEqualCon(..., modelType, conBeforeFill=TRUE)

Arguments

...
Each equality constraint in the model will be specified as a matrix. Rows represent elements that users wish to constrain. For single-group analysis, two columns are needed in the matrix. The first column indicates row of elements and second columns ind
modelType
Type of analysis: CFA, Path, Path.exo, SEM, or SEM.exo.
conBeforeFill
TRUE if users wish to apply equality constraint before applying the auto-completion on the parameters that users have not specified. FALSE if users wish to apply the auto-completion before applying equality constraint. This optio

Value

  • Object in SimEqualCon that save those equality constraints.

Details

Row names specification depends on type of model. If users specify CFA model, the specification in shown in simSetCFA function. If users specify Path analysis with or without exogenous variables, the specification is shown in simSetPath function. If users specify SEM model with or without exogenous variables, the specification is shown in simSetSEM function. However, basically, the names of matrices you put in these function are also eligible for this function as well.

See Also

  • simSetCFAto see model specification in CFA model
  • simSetPathto see model specification in Path analysis model
  • simSetSEMto see model specification in SEM model
  • SimEqualConfor the simResult

Examples

Run this code
# Example 1: Single-group, one constraint
constraint <- matrix(0, 3, 2)
constraint[1,] <- c(1, 1)
constraint[2,] <- c(2, 1)
constraint[3,] <- c(3, 1)
rownames(constraint) <- rep("LY", 3)
equal.loading <- simEqualCon(constraint, modelType="SEM.exo")

# Example 2: Multiple-group, one constraint
group.con <- matrix(0, 2, 3)
group.con[1,] <- c(1, 2, 1)
group.con[2,] <- c(2, 2, 1)
rownames(group.con) <- rep("BE", 2)
equal.path <- simEqualCon(group.con, modelType="Path")

# Example 3: Single-group, multiple constraints
constraint1 <- matrix(1, 3, 2)
constraint1[,1] <- 1:3
rownames(constraint1) <- rep("LY", 3)
constraint2 <- matrix(2, 3, 2)
constraint2[,1] <- 4:6
rownames(constraint2) <- rep("LY", 3)
constraint3 <- matrix(3, 2, 2)
constraint3[,1] <- 7:8
rownames(constraint3) <- rep("LY", 2)
equal.loading2 <- simEqualCon(constraint1, constraint2, constraint3, modelType="SEM")
summary(equal.loading2)

Run the code above in your browser using DataLab