This function calculates the within group agreement measure rwg for single item measures as described in James, Demaree and Wolf (1984). The rwg is calculated as rwg = 1(Observed Group Variance/Expected Random Variance). James et al. (1984) recommend truncating the Observed Group Variance to the Expected Random Variance in cases where the Observed Group Variance was larger than the Expected Random Variance. This truncation results in an rwg value of 0 (no agreement) for groups with large variances.
1  rwg(x, grpid, ranvar=2)

x 
A vector representing the construct on which to estimate agreement. 
grpid 
A vector identifying the groups from which x originated. 
ranvar 
The random variance to which actual group variances are compared. The value of 2 represents the variance from a rectangular distribution in the case where there are 5 response options (e.g., Strongly Disagree, Disagree, Neither, Agree, Strongly Agree). In cases where there are not 5 response options, the rectangular distribution is estimated using the formula ranvar=(A^21)/12 where A is the number of response options. While the rectangular distribution is widely used, other random values may be more appropriate. 
grpid 
The group identifier 
rwg 
The rwg estimate for the group 
gsize 
The group size 
Paul Bliese paul.bliese@moore.sc.edu
Bliese, P. D. (2000). Withingroup agreement, nonindependence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349381). San Francisco, CA: JosseyBass, Inc.
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating withingroup interrater reliability with and without response bias. Journal of Applied Psychology, 69, 8598.
ad.m
rwg.j
rwg.sim
rgr.agree
rwg.j.lindell
1 2 3 4 
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.