Learn R Programming

psychmeta (version 0.2.4)

composite_r_matrix: Matrix formula to estimate the correlation between two weighted or unweighted composite variables

Description

This function computes the weighted (or unweighted, by default) composite correlation between a set of X variables and a set of Y variables.

Usage

composite_r_matrix(r_mat, x_col, y_col, wt_vec_x = rep(1, length(x_col)),
  wt_vec_y = rep(1, length(y_col)))

Arguments

r_mat

Correlation matrix from which composite correlations are to be computed.

x_col

Column indices of variables from 'r_mat' in the X composite (specify a single variable if Y is an observed variable rather than a composite).

y_col

Column indices of variables from 'r_mat' in the Y composite (specify a single variable if Y is an observed variable rather than a composite).

wt_vec_x

Weights to be used in forming the X composite (by default, all variables receive equal weight).

wt_vec_y

Weights to be used in forming the Y composite (by default, all variables receive equal weight).

Value

A composite correlation

Details

This is computed as:

$$\rho_{XY}\frac{\mathbf{w}_{X}^{T}\mathbf{R}_{XY}\mathbf{w}_{Y}}{\sqrt{\left(\mathbf{w}_{X}^{T}\mathbf{R}_{XX}\mathbf{w}_{X}\right)\left(\mathbf{w}_{Y}^{T}\mathbf{R}_{YY}\mathbf{w}_{Y}\right)}}$$

where \(\rho_{XY}\) is the composite correlation, \(\mathbf{w}\) is a vector of weights, and \(\mathbf{R}\) is a correlation matrix. The subscripts of \(\mathbf{w}\) and \(\mathbf{R}\) indicate the variables indexed within the vector or matrix.

References

Mulaik, S. A. (2010). Foundations of factor analysis. Boca Raton, FL: CRC Press. pp. 83<U+2013>84.

Examples

Run this code
# NOT RUN {
r_mat <- matrix(.4, 3, 3)
r_mat[,1] <- r_mat[1,] <- .3
diag(r_mat) <- 1
composite_r_matrix(r_mat = r_mat, x_col = 2:3, y_col = 1)
# }

Run the code above in your browser using DataLab