Learn R Programming

simsem (version 0.2-8)

symMatrix: Create symmetric simMatrix that save free parameters and starting values, as well as fixed values

Description

Create SymMatrix object that save free parameters and starting values, as well as fixed values. This will be used for model specification later, such as for factor residual correlation matrix or measurement error correlation matrix.

Usage

symMatrix(free = NULL, value = NULL)

Arguments

free
Symmetric matrix of free parameters. Use NA to specify free parameters. Use number as fixed value (including zero). The input matrix need to be symmetric matrix. If this argument is not specified, the information from the value a
value
Starting values. Can be either one element or matrix with the same dimension as free parameter matrix. Each element can be numbers (in either as.numeric or as.character format) or the name of distribution object

Value

  • SymMatrix object that will be used for model specification later.

See Also

See VirtualDist for the resulting object. See simMatrix for creating simMatrix and simVector for simVector.

Examples

Run this code
latent.cor <- matrix(NA, 3, 3)
diag(latent.cor) <- 1
RPH <- symMatrix(latent.cor, 0.5)

u46 <- simUnif(0.4, 0.6)
factor.cor <- matrix(NA, 4, 4)
diag(factor.cor) <- 1
factor.cor.start <- matrix("u46", 4, 4)
factor.cor.start[1, 2] <- factor.cor.start[2, 1] <- "0.5"
RPS <- symMatrix(factor.cor, factor.cor.start)

start <- diag(4)
start[1, 2] <- 0.5
start[2, 1] <- 0.5
ST <- symMatrix(value=start)

Run the code above in your browser using DataLab