composite_r_matrix: Matrix formula to estimate the correlation between two...

Description Usage Arguments Details Value References Examples

View source: R/composites.R

Description

\loadmathjax

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

Usage

1
2
3
4
5
6
7
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).

Details

This is computed as:

\mjdeqn\rho

_XY\frac\mathbfw_X^T\mathbfR_XY\mathbfw_Y\sqrt\left(\mathbfw_X^T\mathbfR_XX\mathbfw_X\right)\left(\mathbfw_Y^T\mathbfR_YY\mathbfw_Y\right)r_composite = (t(wt_x) Rxy wt_y) / (sqrt(t(wt_x) Rxx wt_x) * sqrt(t(wt_y) Ryy wt_y))

where \mjeqn\rho_XYr_composite is the composite correlation, \mjeqn\mathbfwwt is a vector of weights, and \mjeqn\mathbfRR is a correlation matrix. The subscripts of \mjeqn\mathbfwwt and \mjeqn\mathbfRR indicate the variables indexed within the vector or matrix.

Value

A composite correlation

References

Mulaik, S. A. (2010). Foundations of factor analysis. Boca Raton, FL: CRC Press. pp. 83–84.

Examples

1
2
3
4
composite_r_scalar(mean_rxy = .3, k_vars_x = 4, mean_intercor_x = .4)
R <- reshape_vec2mat(.4, order = 5)
R[-1,1] <- R[1,-1] <- .3
composite_r_matrix(r_mat = R, x_col = 2:5, y_col = 1)

Example output

-----------------------------------------------------  psychmeta version 2.3.3  --

Please report any bugs to github.com/psychmeta/psychmeta/issues
or issues@psychmeta.com

We work hard to produce these open-source tools for the R community, 
please cite psychmeta when you use it in your research: 
  Dahlke, J. A., & Wiernik, B. M. (2018). psychmeta: An R package for 
     psychometric meta-analysis. Applied Psychological Measurement. 
     Advance online publication. https://doi.org/10.1177/0146621618795933

Find info about psychmeta on the web at psychmeta.com and twitter.com/psychmetaR

Attaching package: 'psychmeta'

The following object is masked from 'package:stats':

    filter

[1] 0.4045199
[1] 0.4045199

psychmeta documentation built on June 1, 2021, 9:13 a.m.