View source: R/helperFunctions.R
getPsi.B | R Documentation |
Computes the implied Psi matrix from Beta, when all coefficients in Beta should be standardized.
getPsi.B(B, sPsi = NULL, standResCov = TRUE)
B |
matrix of regression coefficients (all-y notation). May only contain non-zero values either above or below the diagonal. |
sPsi |
matrix of (residual) correlations/covariances. This is not the Psi matrix, but defines the desired correlations/covariances beyond those implied by B. Can be NULL for no correlations. Standardized and unstandardized residual covariances (between endogenous variables) cannot have the same value, so |
standResCov |
whether elements in |
Psi
## Not run:
# mediation model
B <- matrix(c(
c(.00, .00, .00),
c(.10, .00, .00),
c(.20, .30, .00)
), byrow = TRUE, ncol = 3)
Psi <- getPsi.B(B)
# CLPM with residual correlations
B <- matrix(c(
c(.00, .00, .00, .00),
c(.30, .00, .00, .00),
c(.70, .10, .00, .00),
c(.20, .70, .00, .00)
), byrow = TRUE, ncol = 4)
sPsi <- matrix(c(
c(1, .00, .00, .00),
c(.00, 1, .00, .00),
c(.00, .00, 1, .30),
c(.00, .00, .30, 1)
), byrow = TRUE, ncol = 4)
# so that residual cor is std
Psi <- getPsi.B(B, sPsi, standResCov = TRUE)
# so that residual cor is unsstd
Psi <- getPsi.B(B, sPsi, standResCov = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.