getPsi.B: getPsi.B

View source: R/helperFunctions.R

getPsi.BR Documentation

getPsi.B

Description

Computes the implied Psi matrix from Beta, when all coefficients in Beta should be standardized.

Usage

getPsi.B(B, sPsi = NULL, standResCov = TRUE)

Arguments

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 defines whether to treat these as unstandardized or as standardized.

standResCov

whether elements in sPsi referring to residual covariances (between endogenous variables) shall treated as correlation or as covariance.

Value

Psi

Examples

## 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)

semPower documentation built on Nov. 15, 2023, 1:08 a.m.