simsem (version 0.2-8)

simSetPath: Create a set of matrices of parameter and parameter values to generate and analyze data that belongs to Path analysis model

Description

This function will create set of matrices of free parameters and parameter values that belongs to path analysis model. The requirement is to specify indicator correlation or covariance matrix and regression coefficient matrix.

Usage

simSetPath(..., exo = FALSE)

Arguments

...
Each element of model specification, as described in Details
exo
specify TRUE if users wish to specify both exogenous and endogenous indicators.

Value

  • SimSet object that represents the path analysis simModel. This will be used for specifying data or analysis models later.

Details

The matrices and vectors in the endogenous side are
  • BEfor regression coefficient matrix (need to beSimMatrixobject).
  • PSfor residual covariance matrix (need to beSymMatrixobject).
  • RPSfor residual correlation matrix (need to beSymMatrixobject).
  • VPSfor residual indicator variance (need to beSimVectorobject).
  • VEfor total indicator variance (need to beSimVectorobject). NOTE: Either total indicator variance or residual indicator variance is specified. Both cannot be simultaneously specified.
  • ALfor indicator intercept (need to beSimVectorobject).
  • MEfor indicator total mean (need to beSimVectorobject). NOTE: Either indicator intercept or indicator total mean is specified. Both cannot be simultaneously specified.
There are two required matrices for the specification in the endogenous side only: BE, and RPS (or PS). If users wish to include the exogenous side in their models, these options are available,
  • GAfor regression coefficient matrix from exogenous variable to endogenous variable (need to beSimMatrixobject).
  • PHfor exogenous factor covariance (need to beSymMatrixobject).
  • RPHfor exogenous factor correlation (need to beSymMatrixobject).
  • VPHorVKfor exogenous variable variance (need to beSimVectorobject).
  • KAorMKfor exogenous variable mean (need to beSimVectorobject). NOTE: Either total indicator variance or residual indicator variance is specified. Both cannot be simultaneously specified.
There are four required matrices for the specification in both exogenous and endogenous sides: BE, RPS (or PS), GA, and RPH (or PH). If users specify the correlation/variance format (instead of the covariance format), the default specifications are
  1. All indicator variances are equal to 1. Residual variances are automatically implied from total indicator variances.
  2. All residual variances are free parameters.
  3. All indicator means are equal to 0. Intercepts are automatically implied from total indicator mean.
  4. All indicator intercepts are free parameters.

See Also

  • See classSimSetfor simResult details.
  • SeeSimMatrix,SymMatrix, orSimVectorfor input details.
  • UsesimSetCFAto specify CFA model and usesimSetSEMto specify full structural equation modeling.

Examples

Run this code
u35 <- simUnif(0.3, 0.5)
u57 <- simUnif(0.5, 0.7)
u1 <- simUnif(-0.1, 0.1)
n31 <- simNorm(0.3, 0.1)

path.BE <- matrix(0, 4, 4)
path.BE[3, 1:2] <- NA
path.BE[4, 3] <- NA
starting.BE <- matrix("", 4, 4)
starting.BE[3, 1:2] <- "u35"
starting.BE[4, 3] <- "u57"
BE <- simMatrix(path.BE, starting.BE)

residual.error <- diag(4)
residual.error[1,2] <- residual.error[2,1] <- NA
RPS <- symMatrix(residual.error, "n31")

Path.Model <- simSetPath(RPS = RPS, BE = BE)

u35 <- simUnif(0.3, 0.5)
u57 <- simUnif(0.5, 0.7)
u1 <- simUnif(-0.1, 0.1)
n31 <- simNorm(0.3, 0.1)

path.GA <- matrix(0, 2, 2)
path.GA[1, 1:2] <- NA
GA <- simMatrix(path.GA, "u35")

path.BE <- matrix(0, 2, 2)
path.BE[2, 1] <- NA
BE <- simMatrix(path.BE, "u57")

exo.cor <- matrix(NA, 2, 2)
diag(exo.cor) <- 1
RPH <- symMatrix(exo.cor, "n31")

RPS <- symMatrix(diag(2))

Path.Exo.Model <- simSetPath(RPS = RPS, BE = BE, RPH = RPH, GA = GA, exo=TRUE)

Run the code above in your browser using DataLab