beta2cov: Compute a covariance matrix from regression coefficients and...

View source: R/beta2cov.R

beta2covR Documentation

Compute a covariance matrix from regression coefficients and variances

Description

Compute a covariance matrix, S, from a lower triangular matrix containing regression coefficients (direct effects), B and the variances of the variables V.

Usage

beta2cov(B, V = NULL)

Arguments

B

A lower triangular matrix containing regression coefficients (direct effects).

V

A vector containing the variance of the covariance matrix. If V = NULL (default), then diag(S) = diag(p) where p is the number of variables,

Value

A covariance matrix.

Examples

beta <- matrix(c( 0,  0,  0,
                 .4,  0,  0,
                 .2, .5,  0),
                 ncol = 3, nrow = 3, byrow = TRUE)
beta2cov(beta)

quantmeth/pathanalysis documentation built on Aug. 6, 2023, 8:56 a.m.