Title: | Multilevel Functions |
---|---|
Description: | Tools used by organizational researchers for the analysis of multilevel data. Includes four broad sets of tools. First, functions for estimating within-group agreement and reliability indices. Second, functions for manipulating multilevel and longitudinal (panel) data. Third, simulations for estimating power and generating multilevel data. Fourth, miscellaneous functions for estimating reliability and performing simple calculations and data transformations. |
Authors: | Paul Bliese [aut, cre], Gilad Chen [ctb], Patrick Downes [ctb], Donald Schepker [ctb], Jonas Lang [ctb] |
Maintainer: | Paul Bliese <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.7 |
Built: | 2024-12-04 07:09:37 UTC |
Source: | CRAN |
Calculates the average deviation of the mean or median as a measure of within-group agreement as proposed by Burke, Finkelstein and Dusig (1999). A basic rule for interpreting whether or not the results display practically significant levels of agreement is whether the AD value is smaller than A/6 where A represents the number of response options. For instance, A would be 5 on a five-point response option format of strongly disagree, disagree, neither, agree, strongly agree (see Dunlap, Burke & Smith-Crowe, 2003). To estimate statistical significance see the ad.m.sim function and help files.
ad.m(x, grpid, type="mean")
ad.m(x, grpid, type="mean")
x |
A vector representing a single item or a matrix representing a scale of interest. If a matrix, each column of the matrix represents a scale item, and each row represents an individual respondent. |
grpid |
A vector identifying the groups from which x originated. |
type |
A character string for either the mean or median. |
grpid |
The group identifier |
AD.M |
The average deviation around the mean or median for each group |
gsize |
Group size |
Paul Bliese [email protected]
Burke, M. J., Finkelstein, L. M., & Dusig, M. S. (1999). On average deviation indices for estimating interrater agreement. Organizational Research Methods, 2, 49-68.
Dunlap, W. P., Burke, M. J., & Smith-Crowe, K. (2003). Accurate tests of statistical significance for rwg and average deviation interrater agreement indices. Journal of Applied Psychology, 88, 356-362.
ad.m.sim
awg
rwg
rwg.j
rgr.agree
rwg.sim
rwg.j.sim
data(bhr2000) #Examples for multiple item scales AD.VAL<-ad.m(bhr2000[,2:12],bhr2000$GRP) AD.VAL[1:5,] summary(AD.VAL) summary(ad.m(bhr2000[,2:12],bhr2000$GRP,type="median")) #Example for single item measure summary(ad.m(bhr2000$HRS,bhr2000$GRP))
data(bhr2000) #Examples for multiple item scales AD.VAL<-ad.m(bhr2000[,2:12],bhr2000$GRP) AD.VAL[1:5,] summary(AD.VAL) summary(ad.m(bhr2000[,2:12],bhr2000$GRP,type="median")) #Example for single item measure summary(ad.m(bhr2000$HRS,bhr2000$GRP))
Uses procedures detailed in Dunlap, Burke, and Smith-Crowe (2003) and Cohen, Doveh, and Nahum-Shani (2009) to estimate the significance of the average deviation of the mean or median (AD.M). Dunlap et al. proposed a strategy to use Monte Carlo techniques to estimate the significane of single item AD.M measures. Cohen et al., (2009) expanded these ideas to cover multiple item scales, ADM(J), and account for correlations among items. The ad.m.sim function is flexible and covers single item or multiple item measures. In the case of multiple item measures, correlations among items can be included (preferred method) or excluded. In the Monte Carlo simulations conducted by both Dunlap et al. (2003) and Cohen et al., (2009), 100,000 repetitions were used. In practice, it will require considerable time to perform 100,000 repetitions and 10,000 should suffice. The examples use 500 repetitions simply to speed up the process.
ad.m.sim(gsize, nitems=1, nresp, itemcors=NULL, type="mean",nrep)
ad.m.sim(gsize, nitems=1, nresp, itemcors=NULL, type="mean",nrep)
gsize |
Simulated group size. |
nitems |
Number of items to simulate. The default is 1 for single item measures. If itemcors are provided, the nitems option will be ignored, so the nitems option is only necessary for multiple item scales where no correlation matrix is provided. |
nresp |
The number of response options on the items. For instance, nresp would equal 5 for a 5-point response option of strongly disagree, disagree, neither, agree, strongly agree. |
itemcors |
An optional matrix providing correlations among items. |
type |
A character string with either "mean" or "median". |
nrep |
The number of simulation repetitions. |
ad.m |
Simulated estimates of AD.M values for each of the nrep runs. |
gsize |
Simulated group size. |
nresp |
Simulated number of response options. |
nitems |
Number of items. Either provided in the call (default of 1) or calculated from the itemcors correlation matrix. |
ad.m.05 |
Estimated p=.05 value. Observed values equal to or smaller than this value are considered significant. |
pract.sig |
Estimate of practical significance calculated as nresp/6 (see ad.m). |
Paul Bliese [email protected]
Cohen, A., Doveh, E., & Nahum-Shani, I. (2009). Testing agreement for multi-item scales with the indices rwg(j) and adm(j). Organizational Research Methods, 12, 148-164.
Dunlap, W. P., Burke, M. J., & Smith-Crowe, K. (2003). Accurate tests of statistical significance for rwg and average deviation interrater agreement indices. Journal of Applied Psychology, 88, 356-362.
ad.m
rgr.agree
rwg.sim
rwg.j.sim
#Example from Dunlap et al. (2003), Table 3. The listed significance #value (p=.05) for a group of size 5 with a 7-item response format is #0.64 or less. Use more than 500 iterations in practice. SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=500) summary(SIMOUT) #Example with a multiple item scale basing item correlations on observed #correlations among 11 leadership items in the lq2002 data set. Estimate #in Cohen et al., (2009) is 0.99 data(lq2002) SIMOUT<-ad.m.sim(gsize=10, nresp=5, itemcors=cor(lq2002[,3:13]), type="mean", nrep=500) summary(SIMOUT) quantile(SIMOUT,c(.05,.10))
#Example from Dunlap et al. (2003), Table 3. The listed significance #value (p=.05) for a group of size 5 with a 7-item response format is #0.64 or less. Use more than 500 iterations in practice. SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=500) summary(SIMOUT) #Example with a multiple item scale basing item correlations on observed #correlations among 11 leadership items in the lq2002 data set. Estimate #in Cohen et al., (2009) is 0.99 data(lq2002) SIMOUT<-ad.m.sim(gsize=10, nresp=5, itemcors=cor(lq2002[,3:13]), type="mean", nrep=500) summary(SIMOUT) quantile(SIMOUT,c(.05,.10))
Calculates the awg index proposed by Brown and Hauenstein (2005). The awg agreement index can be applied to either a single item vector or a multiple item matrix representing a scale. The awg is an analogue to Cohen's kappa. Brown and Hauenstein (pages 177-178) recommend interpreting the awg similarly to how the rwg (James et al., 1984) is commonly interpreted with values of .70 indicating acceptable agreement; values between .60 and .69 as reasonable agreement, and values less than .60 as unacceptable levels of agreement.
awg(x, grpid, range=c(1,5))
awg(x, grpid, range=c(1,5))
x |
A vector representing a single item or a matrix representing a scale of interest. If a matrix, each column of the matrix represents a scale item, and each row represents an individual respondent. |
grpid |
A vector identifying the groups from which x originated. |
range |
A vector with the lower and upper response options (e.g., c(1,5)) for a five-point scale from strongly disagree to strongly agree. |
grpid |
The group identifier. |
a.wg |
The awg estimate for each group. |
nitems |
The number of scale items when x is a matrix or dataframe representing a multi-item scale. This value is not returned when x is a vector. |
nraters |
The number of raters. Given that the awg estimate is based on the sample estimate of variance with N-1 in the denominator, Brown and Hauenstein (2005) contend that awg can be estimated on as few as A-1 raters where A represents the number of response options specified by the range option (5 as the default). Note that in many situations nraters will correspond to group size. |
Paul Bliese [email protected]
Brown, R. D. & Hauenstein, N. M. A. (2005). Interrater Agreement Reconsidered: An Alternative to the rwg Indices. Organizational Research Methods, 8, 165-184.
Wagner, S. M., Rau, C., & Lindemann, E. (2010). Multiple informant methodology: A critical review and recommendations. Sociological Methods and Research, 38, 582-618.
data(lq2002) #Examples for multiple item scales awg.out<-awg(lq2002[,3:13],lq2002$COMPID,range=c(1,5)) summary(awg.out) #Example for single item measure awg.out<-awg(lq2002$LEAD05,lq2002$COMPID,range=c(1,5)) summary(awg.out)
data(lq2002) #Examples for multiple item scales awg.out<-awg(lq2002[,3:13],lq2002$COMPID,range=c(1,5)) summary(awg.out) #Example for single item measure awg.out<-awg(lq2002$LEAD05,lq2002$COMPID,range=c(1,5)) summary(awg.out)
The complete data used in Bliese and Halverson (1996). The dataset contains 4 variables: Cohesion (COHES), Leadership Climate (LEAD), Well-Being (WBEING) and Work Hours (HRS). Each of these variables has two variants - a group mean version that replicates each group mean for every individual in the group, and a within-group version where the group mean is subtracted from each individual response (i.e., a group-mean centered or demeaned variable). The group mean version is designated with a G. (e.g., G.HRS), and the within-group version is designated with a W. (e.g., W.HRS).
data(bh1996)
data(bh1996)
A data frame with 13 columns and 7,382 observations from 99 groups
[,1] | GRP | numeric | Group Identifier |
[,2] | COHES | numeric | Cohesion |
[,3] | G.COHES | numeric | Average Group Cohesion |
[,4] | W.COHES | numeric | Group-Mean Centered Cohesion |
[,5] | LEAD | numeric | Leadership |
[,6] | G.LEAD | numeric | Average Group Leadership |
[,7] | W.LEAD | numeric | Group-Mean Centered Leadership |
[,8] | HRS | numeric | Work Hours |
[,9] | G.HRS | numeric | Average Group Work Hours |
[,10] | W.HRS | numeric | Group-Mean Centered Work Hours |
[,11] | WBEING | numeric | Well-Being |
[,12] | G.WBEING | numeric | Average Group Well-Being |
[,13] | W.WBEING | numeric | Group-Mean Centered Well-Being |
Bliese, P. D. & Halverson, R. R. (1996). Individual and nomothetic models of job stress: An examination of work hours, cohesion, and well-being. Journal of Applied Social Psychology, 26, 1171-1189.
The complete data used in Bliese, Halverson and Rothberg (2000). Contains 14 variables referencing individual ratings of US Army Company leadership, work hours, and the degree to which individuals find comfort from religion. The leadership and workhours variables are subsets of the Bliese and Halveson (1996) data (bh1996); however, in the case of leadership, the data set contains the 11 scale items whereas the bh1996 data set contains only the scale score. Most items are on a strongly disagree to strongly agree scale. The RELIG item is on a never to always scale.
data(bhr2000)
data(bhr2000)
A data frame with 14 columns and 5,400 observations from 99 groups
[,1] | GRP | numeric | Group ID |
[,2] | AF06 | numeric | Officers get willing and whole-hearted cooperation |
[,3] | AF07 | numeric | NCOS most always get willing and whole-hearted cooperation |
[,4] | AP12 | numeric | I am impressed by the quality of leadership in this company |
[,5] | AP17 | numeric | I would go for help with a personal problem to the chain of command |
[,6] | AP33 | numeric | Officers in this Company would lead well in combat |
[,7] | AP34 | numeric | NCOs in this Company would lead well in combat |
[,8] | AS14 | numeric | My officers are interested in my personal welfare |
[,9] | AS15 | numeric | My NCOs are interested in my personal welfare |
[,10] | AS16 | numeric | My officers are interested in what I think and feel about things |
[,11] | AS17 | numeric | My NCOs are intested in what I think and fell about things |
[,12] | AS28 | numeric | My chain-of-command works well |
[,13] | HRS | numeric | How many hours do you usually work in a day |
[,14] | RELIG | numeric | How often do you gain strength of comfort from religious beliefs |
Bliese, P. D. & Halverson, R. R. (1996). Individual and nomothetic models of job stress: An examination of work hours, cohesion, and well-being. Journal of Applied Social Psychology, 26, 1171-1189.
Bliese, P. D., Halverson, R. R., & Rothberg, J. (2000). Using random group resampling (RGR) to estimate within-group agreement with examples using the statistical language R.
An experimental function that implements a 2-level bootstrap to estimate non-parametric bootstrap confidence intervals of the ICC1 using the percentile method. The bootstrap first draws a sample of level-2 units with replacement, and in a second stage draws a sample of level-1 observations with replacement from the level-2 units. Following each bootstrap replication, the ICC(1) is estimated using the lme function (default) or the ANOVA method.
boot.icc(x, grpid, nboot, aov.est=FALSE)
boot.icc(x, grpid, nboot, aov.est=FALSE)
x |
A vector representing the variable upon which to estimate the ICC values. |
grpid |
A vector representing the level-2 unit identifier. |
nboot |
The number of bootstrap iterations. Computational demands underlying a 2-level bootstrap are heavy, so the examples use 100; however, the number of interations should generally be 10,000. |
aov.est |
An option to estimate the ICC values using aov. |
Provides ICC(1) estimates for each bootstrap draw.
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
## Not run: data(bh1996) ICC.OUT<-boot.icc(bh1996$WBEING,bh1996$GRP,100) quantile(ICC.OUT,c(.025,.975)) ## End(Not run)
## Not run: data(bh1996) ICC.OUT<-boot.icc(bh1996$WBEING,bh1996$GRP,100) quantile(ICC.OUT,c(.025,.975)) ## End(Not run)
Contains the complete data used in Chen (2005). Chen (2005) examined newcomer adaptation in 65 project teams. The level of analysis was the team. In the study, team leaders assessed the initial team performance (TMPRF) at time 1 and then assessed newcomer performance over three additional time points (NCPRF.T1, NCPRF.T2, NCPRF.T3). Initial team expectations (TMEXP) and initial newcomer empowerment (NCEMP) were also assessed and modeled, but were not analyzed as repeated measures. To specify Table 2 model in Chen (2005), these data need to be converted to univariate or stacked form (see the make.univ function). Using the default values of make.univ and creating a dataframe called chen2005.univ, the specific lme model for Table 2 in Chen (2005) is:
lme(MULTDV~NCEMP*TIME+TMEXP*TIME+TMPRF*TIME,random=~TIME|ID,chen2005.univ)
data(chen2005)
data(chen2005)
A data frame with 7 columns and 65 team-level observations
[,1] | ID | numeric | Team Identifier |
[,2] | TMPRF | numeric | Initial Team Performance (time 1 in article) |
[,3] | TMEXP | numeric | Team Expectations (time 1 in article) |
[,4] | NCEMP | numeric | Initial Newcomer Empowerment(time 2 in article) |
[,5] | NCPRF.T1 | numeric | Newcomer Performance Time 1 (time 2 in article) |
[,6] | NCPRF.T2 | numeric | Newcomer Performance Time 2 (time 3 in article) |
[,7] | NCPRF.T3 | numeric | Newcomer Performance Time 3 (time 4 in article) |
Chen, G.(2005). Newcomer adaptation in teams: Multilevel antecedents and outcomes. Academy of Management Journal, 48, 101-116.
Contains five cohesion measures provided by 11 individuals. The individuals providing the measures are members of four platoons further nested within two larger units. This data file is used for demonstative purposes in the document "Multilevel Modeling in R" that accompanies this package.
data(cohesion)
data(cohesion)
A data frame with 7 columns and 11 observations
[,1] | UNIT | numeric | Higher-level Unit Identifier |
[,2] | PLATOON | numeric | Lower-level Platoon Identifier |
[,3] | COH01 | numeric | First Cohesion Variable |
[,4] | COH02 | numeric | Second Cohesion Variable |
[,5] | COH03 | numeric | Third Cohesion Variable |
[,6] | COH04 | numeric | Fourth Cohesion Variable |
[,7] | COH05 | numeric | Fifth Cohesion Variable |
Tests for statistical differences between two independent correlations using the formula provided on page 54 of Cohen & Cohen (1983). The function returns a z-score estimate.
cordif(rvalue1,rvalue2,n1,n2)
cordif(rvalue1,rvalue2,n1,n2)
rvalue1 |
Correlation value from first sample. |
rvalue2 |
Correlation value from second sample. |
n1 |
The sample size of the first correlation. |
n2 |
The sample size of the second correlation. |
Produces a single value, the z-score for the differences between the correlations.
Paul Bliese [email protected]
Cohen, J. & Cohen, P. (1983). Applied multiple regression/correlation analysis for the behavioral sciences (2nd Ed.). Hillsdale, NJ: Lawrence Erlbaum Associates.
cordif(rvalue1=.51,rvalue2=.71,n1=123,n2=305)
cordif(rvalue1=.51,rvalue2=.71,n1=123,n2=305)
Tests for statistical differences between two dependent correlations using the formula provided on page 56 of Cohen & Cohen (1983). The function returns a t-value, the DF, and the p-value.
cordif.dep(r.x1y,r.x2y,r.x1x2,n)
cordif.dep(r.x1y,r.x2y,r.x1x2,n)
r.x1y |
The correlation between x1 and y where y is typically the outcome variable. |
r.x2y |
The correlation between x2 and y where y is typically the outcome variable. |
r.x1x2 |
The correlation between x1 and x2 (the correlation between the two predictors). |
n |
The sample size. |
Returns three values. A t-value, DF and p-value.
Paul Bliese [email protected]
Cohen, J. & Cohen, P. (1983). Applied multiple regression/correlation analysis for the behavioral sciences (2nd Ed.). Hillsdale, nJ: Lawrence Erlbaum Associates.
cordif.dep(r.x1y=.30,r.x2y=.60,r.x1x2=.10,n=305)
cordif.dep(r.x1y=.30,r.x2y=.60,r.x1x2=.10,n=305)
Calculates Cronbach's alpha estimate of reliability for a multi-item scale.
cronbach(items)
cronbach(items)
items |
An matrix or data frame where each column represents an item in a multi-item scale. |
Alpha |
Estimate of Cronbach's Alpha. |
N |
The number of observations on which the Alpha was estimated. |
Paul Bliese [email protected]
Cronbach L. J. (1951) Coefficient Alpha and the internal structure of tests. Psychometrika, 16,297-334
data(bhr2000) cronbach(bhr2000[,2:11])
data(bhr2000) cronbach(bhr2000[,2:11])
Creates time-varying covariates for estimating a discontinuous growth model (DGM). Creating time-varying covariates requires only simple recoding of a time vector when data are balanced and the discontinuity event occurs at the same time for each group. When data are not balanced and one or more events occurs at different times for each group, coding the time-varying covariates is complex. For instance, if the event of interest was employee turnover in a store in a given month, it is likely that stores would differ on how many months of data were available and on the specific months when turnover occurred. With these irregularly-timed events and different time windows for each store, it would be challenging to create time-varying covariates for the DGM specific to each store's circumstances.
dgm.code(grp,time,event,n.events=FALSE,first.obs=FALSE)
dgm.code(grp,time,event,n.events=FALSE,first.obs=FALSE)
grp |
A vector representing the group ID in the panel data. Each group ID is repeated n times as represented in the panel. |
time |
A vector from 0:n-1 where n represents the number of observations within each panel. Within each group, the time vector can vary in length. |
event |
A vector containing 1 for each time the event of interest for a group occurs and a 0 in all other cases. |
n.events |
Controls how many events for which to create time-varying covariates. In cases where some groups encounter numerous events, this argument can be used to limit the coding to a small number (e.g., 2 or 3). Default is to create as many time related covariates as occur in the group with the most events (which is often not useful). |
first.obs |
Controls what to do if the first observation is an event. If TRUE, then the first observation is changed to a zero and treated as a non-event. If FALSE, the function provides a list of the groups where the event is the first observation. The reason why the first observation is flagged is that it is not possible to estimate a discontinuous growth model if the event occurs on the first observation. |
Produces a data.frame with the columns
[, c("grp","time","event","trans1","post1","time.a","tot.events","event.first")]
If numerous events are coded, the data.frame will contain more trans and post values (trans2, post2, etc.) corresponding to the maximum number of events experienced by a group unless n.events is set to limit the number of events. The data.frame must be merged back to the original data.frame for subsequent analyses. See examples.
Paul Bliese [email protected]
Bliese, P. D., & Lang, J. W. B. (2016). Understanding relative and absolute change in discontinuous growth models: Coding alternatives and implications for hypothesis testing. Organizational Research Methods, 19, 562-592.
Bliese, P. D., Kautz, J., & Lang, J. W. (2020). Discontinuous growth models: Illustrations, recommendations, and an R function for generating the design matrix. In Y. Griep & S. D. Hansen (Eds.), Handbook on the Temporal Dynamics of Organizational Behavior (pp. 319-350). Northampton, MA: Edward Elgar Publishers, Inc.
########## # Example 1: Coding trans, post and time.a in data where # every event occurs at the same time for each person ########## # Read data from library data(tankdat) # Add a marker (1 or 0) indicating an event tankdat$taskchange<-0 tankdat$taskchange[tankdat$TIME==6]<-1 # Run function with defaults OUT<-with(tankdat,dgm.code(ID,TIME,taskchange)) names(OUT) names(tankdat) # Merge original data and dgm codes and reorder tankdat.dgm<-merge(tankdat,OUT,by.x=c("ID","TIME"),by.y=c("grp","time")) tankdat.dgm<-tankdat.dgm[order(tankdat.dgm$ID,tankdat.dgm$TIME),] # Examine data tankdat.dgm[1:12,] ########## # Example 2: Coding trans, post and time.a in data where every transition # event occurs at the different times for each person ########## # Read data from library data(tankdat) # Add a marker (1 or 0) indicating an event at random set.seed(343227) tankdat$taskchange<-rbinom(nrow(tankdat),1,prob=.1) tankdat[1:24,] #ID 1 had one event at TIME 10. ID 2 had 3 events # Run function with defaults ## Not run: OUT<-with(tankdat,dgm.code(ID,TIME,taskchange)) ## End(Not run) # returns an error showing the 24 groups that started with an event. # Either drop these groups or change the first.obs option to TRUE # which changes these first events to 0 (non-events) OUT<-with(tankdat,dgm.code(ID,TIME,taskchange,first.obs=TRUE)) OUT[1:24,] OUT[OUT$grp==9,] #Notice the event.first value of 1 for group 9 indicating that the #first value was present and recoded. # In the default setting, one ID had 4 events. It may be preferable # to restrict the number of events to 3 or more and code accordingly OUT<-with(tankdat,dgm.code(ID,TIME,taskchange,n.events=3,first.obs=TRUE)) OUT[1:24,]
########## # Example 1: Coding trans, post and time.a in data where # every event occurs at the same time for each person ########## # Read data from library data(tankdat) # Add a marker (1 or 0) indicating an event tankdat$taskchange<-0 tankdat$taskchange[tankdat$TIME==6]<-1 # Run function with defaults OUT<-with(tankdat,dgm.code(ID,TIME,taskchange)) names(OUT) names(tankdat) # Merge original data and dgm codes and reorder tankdat.dgm<-merge(tankdat,OUT,by.x=c("ID","TIME"),by.y=c("grp","time")) tankdat.dgm<-tankdat.dgm[order(tankdat.dgm$ID,tankdat.dgm$TIME),] # Examine data tankdat.dgm[1:12,] ########## # Example 2: Coding trans, post and time.a in data where every transition # event occurs at the different times for each person ########## # Read data from library data(tankdat) # Add a marker (1 or 0) indicating an event at random set.seed(343227) tankdat$taskchange<-rbinom(nrow(tankdat),1,prob=.1) tankdat[1:24,] #ID 1 had one event at TIME 10. ID 2 had 3 events # Run function with defaults ## Not run: OUT<-with(tankdat,dgm.code(ID,TIME,taskchange)) ## End(Not run) # returns an error showing the 24 groups that started with an event. # Either drop these groups or change the first.obs option to TRUE # which changes these first events to 0 (non-events) OUT<-with(tankdat,dgm.code(ID,TIME,taskchange,first.obs=TRUE)) OUT[1:24,] OUT[OUT$grp==9,] #Notice the event.first value of 1 for group 9 indicating that the #first value was present and recoded. # In the default setting, one ID had 4 events. It may be preferable # to restrict the number of events to 3 or more and code accordingly OUT<-with(tankdat,dgm.code(ID,TIME,taskchange,n.events=3,first.obs=TRUE)) OUT[1:24,]
Calculates the group-mean reliability from a linear mixed effects (lme) model. If group sizes are identical, the group-mean reliabilty estimate equals the ICC(2) estimate from an ANOVA model. When group sizes differ, however, a group-mean reliability estimate is calculated for each group based on the Spearman-Brown formula, the overall ICC, and group size for each group.
gmeanrel(object)
gmeanrel(object)
object |
A Linear Mixed Effect (lme) object. |
ICC |
Intraclass Correlation Coefficient |
Group |
A vector containing all the group names. |
GrpSize |
A vector containing all the group sizes. |
MeanRel |
A vector containing the group-mean reliability estimate for each group. |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and Analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bartko, J.J. (1976). On various intraclass correlation reliability coefficients. Psychological Bulletin, 83, 762-765.
data(bh1996) library(nlme) tmod<-lme(WBEING~1,random=~1|GRP,data=bh1996) gmeanrel(tmod)
data(bh1996) library(nlme) tmod<-lme(WBEING~1,random=~1|GRP,data=bh1996) gmeanrel(tmod)
Uses random group resampling (RGR) to create a distribution of pseudo group means. Pseudo group means are then contrasted with actual group means to provide a visualization of the group-level properties of the data. It is, in essense, a way of visualizing the ICC1 or an F-Value from an ANOVA model.
graph.ran.mean(x, grpid, nreps, limits, graph=TRUE, bootci=FALSE)
graph.ran.mean(x, grpid, nreps, limits, graph=TRUE, bootci=FALSE)
x |
The vector representing the construct of interest. |
grpid |
A vector identifying the groups associated with x. |
nreps |
A number representing the number of random groups to generate. Because groups are created with the exact size characteristics of the actual groups, the total number of pseudo groups created may be calculated as nreps * Number Actual Groups. The value chosen for nreps only affects the smoothness of the pseudo group line – values greater than 25 should provide sufficiently smooth lines. Values of 1000 should be used if the bootci option is TRUE although only 25 are used in the example to reduce computation time. |
limits |
Controls the upper and lower limits of the y-axis on the plot. The default is to set the limits at the 10th and 90th percentiles of the raw data. This option only affects how the data is plotted. |
graph |
Controls whether or not a plot is returned. If graph=FALSE, the program returns a data frame with two columns. The first column contains the sorted means from the actual groups, and the second column contains the sorted means from the pseudo groups. This can be useful for plotting results in other programs. |
bootci |
Determines whether approximate 95 percent confidence interval estimates are calculated and plotted. If bootci is TRUE, the nreps option should be 1000 or more. |
Produces either a plot (graph=TRUE) or a data.frame (graph=FALSE)
Paul Bliese [email protected]
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
data(bh1996) # with the bootci=TRUE option, nreps should be 1000 or more. The value # of 25 is used in the example to reduce computation time with(bh1996,graph.ran.mean(HRS,GRP,limits=c(8,16),nreps=25, bootci=TRUE)) GRAPH.DAT<-graph.ran.mean(bh1996$HRS,bh1996$GRP,limits=c(8,16),nreps=25, graph=FALSE)
data(bh1996) # with the bootci=TRUE option, nreps should be 1000 or more. The value # of 25 is used in the example to reduce computation time with(bh1996,graph.ran.mean(HRS,GRP,limits=c(8,16),nreps=25, bootci=TRUE)) GRAPH.DAT<-graph.ran.mean(bh1996$HRS,bh1996$GRP,limits=c(8,16),nreps=25, graph=FALSE)
Calculates the Intraclass Correlation Coefficient 1 or ICC(1) from an ANOVA model. This value is equivalent to the ICC discussed in the random coefficient modeling literature, and represents the amount of individual-level variance that can be "explained" by group membership.
ICC1(object)
ICC1(object)
object |
An ANOVA (aov) object from an one-way analysis of variance. |
Provides an estimate of ICC(1) for the sample.
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and Analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bartko, J.J. (1976). On various intraclass correlation reliability coefficients. Psychological Bulletin, 83, 762-765.
data(bh1996) hrs.mod<-aov(HRS~as.factor(GRP),data=bh1996) ICC1(hrs.mod)
data(bh1996) hrs.mod<-aov(HRS~as.factor(GRP),data=bh1996) ICC1(hrs.mod)
Calculates the Intraclass Correlation Coefficient 2 or ICC(2) from an ANOVA model. This value represents the reliability of the group means.
ICC2(object)
ICC2(object)
object |
An ANOVA (aov) object from an one-way analysis of variance. |
Provides an estimate of ICC(2) for the sample.
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and Analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bartko, J.J. (1976). On various intraclass correlation reliability coefficients. Psychological Bulletin, 83, 762-765.
data(bh1996) hrs.mod<-aov(HRS~as.factor(GRP),data=bh1996) ICC2(hrs.mod)
data(bh1996) hrs.mod<-aov(HRS~as.factor(GRP),data=bh1996) ICC2(hrs.mod)
Calculates item-total correlations in multi-item scales.
item.total(items)
item.total(items)
items |
A matrix or dataframe where each column represents an item in a multi-item scale. |
Variable |
Variable examined in the reliability analyses. |
Item.Total |
The item correlation with the mean of the other items. |
Alpha.Without |
The Cronbach Alpha reliability estimate of the scale without the variable. |
N |
The number of observations on which the analyses were calculated. |
Paul Bliese [email protected]
Cronbach L. J. (1951) Coefficient Alpha and the internal structure of tests. Psychometrika, 16,297-334
data(bhr2000) item.total(bhr2000[,2:11])
data(bhr2000) item.total(bhr2000[,2:11])
Contains the complete data used in Klein et al. (2000). The Klein et al. chapter uses this simulated data set to compare and contrast WABA, HLM, and Cross-Level Operator Analyses (CLOP). The simulated data set was created by Paul Bliese.
data(klein2000)
data(klein2000)
A data frame with 9 columns and 750 observations from 50 groups
[,1] | GRPID | numeric | Group Identifier |
[,2] | JOBSAT | numeric | Job Satisfaction (DV) |
[,3] | COHES | numeric | Cohesion |
[,4] | POSAFF | numeric | Positive Affect |
[,5] | PAY | numeric | Pay |
[,6] | NEGLEAD | numeric | Negative Leadership |
[,7] | WLOAD | numeric | Workload |
[,8] | TASKSIG | numeric | Task Significance |
[,9] | PHYSEN | numeric | Physical Environment |
Klein, K. J., Bliese, P.D., Kozlowski, S. W. J, Dansereau, F., Gavin, M. B., Griffin, M. A., Hofmann, D. A., James, L. R., Yammarino, F. J., & Bligh, M. C. (2000). Multilevel analytical techniques: Commonalities, differences, and continuing questions. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 512-553). San Francisco, CA: Jossey-Bass, Inc
Contains the complete data used in a special issue of Leadership Quarterly edited by Paul Bliese, Ronald Halverson and Chet Schriesheim in 2002 (Vol 13). Researchers from several universities analyzed this common dataset using various multilevel techniques. The three scales used in the analyses are Leadership Climate (LEAD), Task Significance (TSIG) and Hostility (HOSTILE). The data set contains each item making up these scales. These items were additionally used by Cohen, Doveh and Nahum-Shani (2009).
data(lq2002)
data(lq2002)
A data frame with 27 columns and 2,042 observations from 49 groups
[,1] | COMPID | numeric | Army Company Identifying Variable |
[,2] | SUB | numeric | Subject Number |
[,3] | LEAD01 | numeric | Officers Get Cooperation From Company (EXV01) |
[,4] | LEAD02 | numeric | NCOs Get Cooperation From Company (EXV02) |
[,5] | LEAD03 | numeric | Impressed By Leadership (EXV04) |
[,6] | LEAD04 | numeric | Go For Help Within Chain of Command (EXV05) |
[,7] | LEAD05 | numeric | Officers Would Lead Well In Combat (EXV07) |
[,8] | LEAD06 | numeric | NCOs Would Lead Well In Combat (EXV08) |
[,9] | LEAD07 | numeric | Officers Interested In Welfare (EXV11) |
[,10] | LEAD08 | numeric | NCOs Interested In Welfare (EXV13) |
[,11] | LEAD09 | numeric | Officers Interested In What I Think (EXV14) |
[,12] | LEAD10 | numeric | NCOs Interested In What I Think (EXV15) |
[,13] | LEAD11 | numeric | Chain Of Command Works Well (EXV16) |
[,14] | TSIG01 | numeric | What I Am Doing Is Important (MIS05) |
[,15] | TSIG02 | numeric | Making Contribution To Mission (MIS06) |
[,16] | TSIG03 | numeric | What I Am Doing Accomplishes Mission (MIS07) |
[,17] | HOSTIL01 | numeric | Easily Annoyed Or Irritated (BSI09) |
[,18] | HOSTIL02 | numeric | Temper Outburst That You Cannot Control (BSI18) |
[,19] | HOSTIL03 | numeric | Urges To Harm Someone (BSI47) |
[,20] | HOSTIL04 | numeric | Urges To Break Things (BSI49) |
[,21] | HOSTIL05 | numeric | Getting Into Frequent Arguments (BSI54) |
[,22] | LEAD | numeric | Leadership Climate Scale Score |
[,23] | TSIG | numeric | Task Significance Scale Score |
[,24] | HOSTILE | numeric | Hostility Scale Score |
[,25] | GLEAD | numeric | Leadership Climate Scale Score Aggregated By Company |
[,26] | GTSIG | numeric | Task Significance Scale Score Aggregated By Company |
[,27] | GHOSTILE | numeric | Hostility Scale Score Aggregated By Company |
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
Bliese, P. D., Halverson, R. R., & Schriesheim, C. A. (2002). Benchmarking multilevel methods: Comparing HLM, WABA, SEM, and RGR. Leadership Quarterly, 13, 3-14.
Cohen, A., Doveh, E., & Nahum-Shani, I. (2009). Testing agreement for multi-item scales with the indices rwg(j) and adm(j). Organizational Research Methods, 12, 148-164.
Longitudinal data is often stored in multivariate or wide form. In multivariate form, each row contains data from one subject, and repeated measures variables are indexed by different names (e.g., OUTCOME.T1, OUTCOME.T2, OUTCOME.T3). In repeated measures designs and growth modeling, data needs to be converted to univariate or stacked form where each row represents one of the repeated measures indexed by a TIME variable nested within subject. In univariate form, each subject has as many rows of data as there are time points. R has several functions to convert data from wide to long formats and vice versa including reshape. The code used in make.univ borrows heavily from code provided in Chambers and Hastie (1991).
make.univ(x,dvs,tname="TIME", outname="MULTDV")
make.univ(x,dvs,tname="TIME", outname="MULTDV")
x |
A dataframe in multivariate form. |
dvs |
A subset dataframe of x containing the repeated measures columns. Note that the repeated measures must be ordered from Time 1 to Time N for this function to work properly. |
tname |
An optional name for the new time variable. Defaults to TIME. |
outname |
An optional name for the outcome variable name. Defaults to MULTDV. |
Returns a dataframe in univariate (i.e., stacked) form with a TIME variable representing the repeated observations, and a variable named MULTDV representing the time-indexed variable. The TIME variable begins with 0.
Paul Bliese [email protected]
Bliese, P. D., & Ployhart, R. E. (2002). Growth modeling using random coefficient models: Model building, testing and illustrations. Organizational Research Methods, 5, 362-387.
Chambers, J. M., & Hastie, T. J. (1991). Statistical models in S. CRC Press, Inc..
data(univbct) #a dataframe in univariate form for job satisfaction TEMP<-univbct[3*1:495,c(22,1:17)] #convert back to multivariate form #Transform data to univariate form TEMP2<-make.univ(x=TEMP,dvs=TEMP[,c(10,13,16)]) #Same as above, but renaming repeated variable TEMP3<-make.univ(x=TEMP,dvs=TEMP[,c(10,13,16)],outname="JOBSAT")
data(univbct) #a dataframe in univariate form for job satisfaction TEMP<-univbct[3*1:495,c(22,1:17)] #convert back to multivariate form #Transform data to univariate form TEMP2<-make.univ(x=TEMP,dvs=TEMP[,c(10,13,16)]) #Same as above, but renaming repeated variable TEMP3<-make.univ(x=TEMP,dvs=TEMP[,c(10,13,16)],outname="JOBSAT")
Called by graph.ran.mean (and potentially other functions) to randomly mix data and create new pseudo group ID variables. Pseudo group IDs match real group IDs in terms of size.
mix.data(x,grpid)
mix.data(x,grpid)
x |
A matrix or vector containing data to be randomly sorted. |
grpid |
A vector containing a group identifier. |
newid |
A pseudo group ID. |
grpid |
The real group ID. |
x |
The values in x arranged as belonging to newid. |
Paul Bliese [email protected]
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
data(bh1996) mix.data(x=bh1996[c(1:10,200:210,300:310),2:3], grpid=bh1996$GRP[c(1:10,200:210,300:310)])
data(bh1996) mix.data(x=bh1996[c(1:10,200:210,300:310),2:3], grpid=bh1996$GRP[c(1:10,200:210,300:310)])
Estimates ICC(1) and ICC(2) values for each column given a data frame and a group identifier. Uses a mixed-effects estimate of the ICC, so ICC values cannot be negative. In cases where ICC values are assumed to be zero or negative, the ANOVA-based formulas should be used (see the ICC1 and ICC2 functions). The mult.icc function only works with one level of nesting.
mult.icc(x, grpid)
mult.icc(x, grpid)
x |
A data frame containing the variables of interest in each column. |
grpid |
A vector identifying the groups from which the variables originated. |
Variable |
The variable name. |
ICC1 |
Intraclass correlation coefficient 1. |
ICC2 |
Group mean reliability or intraclass correlation coefficient 2. |
Paul Bliese [email protected]
Bartko, J.J. (1976). On various intraclass correlation reliability coefficients. Psychological Bulletin, 83, 762-765.
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and Analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bliese, P. D., Maltarich, M. A., Hendricks, J. L., Hofmann, D. A., & Adler, A. B. (2019). Improving the measurement of group-level constructs by optimizing between-group differentiation. Journal of Applied Psychology, 104, 293-302.
library(nlme) data(bh1996) mult.icc(bh1996[,c("HRS","LEAD","COHES")],grpid=bh1996$GRP)
library(nlme) data(bh1996) mult.icc(bh1996[,c("HRS","LEAD","COHES")],grpid=bh1996$GRP)
Longitudinal data is often stored in multivariate or wide form. In multivariate form, each row contains data from one subject, and repeated measures variables are indexed by different names (e.g., OUTCOME.T1, OUTCOME.T2, OUTCOME.T3). In the case of repeated measures designs and growth modeling, it is necessary to convert the data to univariate or stacked form where each row represents one of the repeated measures indexed by a TIME variable and nested within subject. In univariate form, each subject has as many rows of data as there are time points. The make.univ function in the multilevel library will convert a single item to univariate form while the mult.make.univ function converts two or more variables to univariate form. The mult.make.univ function was developed by Patrick Downes at the University of Iowa, and was included in the multilevel library in January of 2013. R also has built-in function such as reshape to perform the same data manipulation.
mult.make.univ(x,dvlist,tname="TIME", outname="MULTDV")
mult.make.univ(x,dvlist,tname="TIME", outname="MULTDV")
x |
A dataframe in multivariate form. |
dvlist |
A list containing the repeated measures. Note that each element of the list must be ordered from Time 1 to Time N for this function to work properly. |
tname |
An optional name for the new time variable. Defaults to TIME. |
outname |
An optional name for the outcome variable name. Defaults to MULTDV1 to MULTDV(N). |
Returns a dataframe in univariate (i.e., stacked) form with a TIME variable representing the repeated observations, and new variables representing the time-indexed variables (MULTDV1, MULTDV2, etc.). The TIME variable begins with 0.
Patrick Downes [email protected] Paul Bliese [email protected]
Bliese, P. D., & Ployhart, R. E. (2002). Growth modeling using random coefficient models: Model building, testing and illustrations. Organizational Research Methods, 5, 362-387.
data(univbct) #a dataframe in univariate form for job sat TEMP<-univbct[3*1:495,c(22,1:17)] #convert back to multivariate form names(TEMP) #use the column names to find the column numbers #Create a list of DV's - each DV should have the same number of obs dvlist <- list(c(10,13,16),c(11,14,17)) names(dvlist) <- c("JOBSAT","COMMIT") #names for univariate output #Transform the data into univariate form with multiple level-1 variables mldata <- mult.make.univ(x=TEMP,dvlist=dvlist)
data(univbct) #a dataframe in univariate form for job sat TEMP<-univbct[3*1:495,c(22,1:17)] #convert back to multivariate form names(TEMP) #use the column names to find the column numbers #Create a list of DV's - each DV should have the same number of obs dvlist <- list(c(10,13,16),c(11,14,17)) names(dvlist) <- c("JOBSAT","COMMIT") #names for univariate output #Transform the data into univariate form with multiple level-1 variables mldata <- mult.make.univ(x=TEMP,dvlist=dvlist)
Contains a random sample of firm-level data from 196 firms for the years 2007 to 2011 based on data from COMPUSTAT and MSCI. The data are balanced in that each firm provided five years of data. The data contains a time variable and time varying covariates for the discontinuous growth model along with within-firm predictors related to the composition of boards of directors. The discontinuity was indexed to 2009 as the first year following the great recession. In addition to illustrating variants of growth models, the panel data is useful for contrasting econometric fixed-effect models and mixed-effect models (Bliese et al., 2020).
data(paneldat)
data(paneldat)
A data frame with 14 columns and 960 observations
[,1] | companyid | numeric | Firm ID |
[,2] | companyname | numeric | Firm Name |
[,3] | year | numeric | Calendar Year |
[,4] | time | numeric | Calendar Year minus 2007 |
[,5] | trans | numeric | Dummy Coded Variable Indexed to Transition |
[,6] | post | numeric | Time Varying Covariate for Post Transition Slope |
[,8] | roani | numeric | Return on Assets |
[,9] | boardindprop | numeric | Yearly Proportion of Independent Members of the Firm's Board |
[,10] | dirageavg | numeric | Yearly Average Age of the Firm's Directors |
[,11] | femaledirsprop | numeric | Yearly Female Board Members Proportion |
[,12] | debtassets | numeric | Yearly Debt to Assets Ratio |
[,13] | lnemp | numeric | Yearly Natural Log of Number of Employees |
[,14] | ceotenure | numeric | Yearly CEO Tenure |
Bliese, P. D., Schepker, D. J., Essman, S. M., & Ployhart, R. E. (2020). Bridging methodological divides between macro- and microresearch: Endogeneity and methods for panel data. Journal of Management, 46, 70-99.
Provides a concise quantile summary of objects created using the functions rwg.sim and rwg.j.sim. The simulation functions for rwg and rwg.j return a limited number of estimated values. Consequently, the normal quantile methods are biased. The quantile methods incorporated in this function produce unbiased estimates.
## S3 method for class 'agree.sim' quantile(x,confint,...)
## S3 method for class 'agree.sim' quantile(x,confint,...)
x |
An object of class 'agree.sim'. |
confint |
The confidence intervals to return. The values of 0.95 and 0.99 return the approximate 95th and 99th percentile confidence intervals (p=.05 and p=.01). |
... |
Optional arguments. None used. |
A dataframe with two columns. The first column contains the quantile value and the second contains the estimate based on the object.
Paul Bliese [email protected]
#An example from Dunlap et al. (2003). The estimate from Dunlap et al. #Table 2 is 0.53 RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=1000) quantile(RWG.OUT, c(.95,.99))
#An example from Dunlap et al. (2003). The estimate from Dunlap et al. #Table 2 is 0.53 RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=1000) quantile(RWG.OUT, c(.95,.99))
Provides a concise quantile summary of objects created using the function ad.m.sim. The simulation functions for the average deviation of the mean (or median) return a limited number of estimated values. Consequently, the normal quantile methods are biased. The quantile methods incorporated in this function produce unbiased estimates.
## S3 method for class 'disagree.sim' quantile(x,confint,...)
## S3 method for class 'disagree.sim' quantile(x,confint,...)
x |
An object of class 'disagree.sim'. |
confint |
The confidence intervals to return. The values of 0.05 and 0.01 return the approximate 5 percent and 1 percent confidence intervals. Values equal to or smaller than these values are significant (p=.05, p=.01). |
... |
Optional arguments. None used. |
A dataframe with two columns. The first column contains the quantile value and the second contains the estimate based on the object.
Paul Bliese [email protected]
#Example from Dunlap et al. (2003), Table 3. The listed significance #value (p=.05) for a group of size 5 with a 7-item response format is #0.64 or less. SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=1000) quantile(SIMOUT, c(.05,.01))
#Example from Dunlap et al. (2003), Table 3. The listed significance #value (p=.05) for a group of size 5 with a 7-item response format is #0.64 or less. SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=1000) quantile(SIMOUT, c(.05,.01))
Provides a concise quantile summary of objects created using the function rgr.waba.
## S3 method for class 'rgr.waba' quantile(x,confint,...)
## S3 method for class 'rgr.waba' quantile(x,confint,...)
x |
An object of class 'rgr.waba'. |
confint |
The confidence intervals to return. The values of 0.025 and 0.975 return the approximate two-tailed 95th percentile confidence intervals (p=.05). |
... |
Optional arguments. None used. |
A dataframe containing the confidence intervals for each parameter in the rgr.waba model.
Paul Bliese [email protected]
data(bh1996) #estimate the model based on actual group membership waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,100) quantile(RWABA,confint=c(.025,.975))
data(bh1996) #estimate the model based on actual group membership waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,100) quantile(RWABA,confint=c(.025,.975))
Called by rgr.agree (and potentially other functions). The ran.group function randomly mixes data and applies a function to the pseudo groups. Pseudo group IDs match real group IDs in terms of size.
ran.group(x,grpid,fun,...)
ran.group(x,grpid,fun,...)
x |
A matrix or vector containing data to be randomly sorted. |
grpid |
A vector containing a group identifier. |
fun |
A function to be applied to the observations within each random group. |
... |
Additional arguments to fun. |
A vector containing the results of applying the function to each random group.
Paul Bliese [email protected]
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
data(bh1996) ran.group(bh1996$HRS,bh1996$GRP,mean)
data(bh1996) ran.group(bh1996$HRS,bh1996$GRP,mean)
Uses random group resampling (RGR) to estimate within group agreement. RGR agreement compares within group variances from actual groups to within group variances from pseudo groups. Evidence of significant agreement is inferred when variances from the actual groups are significantly smaller than variances from pseudo groups. RGR agreement methods are rarely reported, but provide another way to consider group level properties in data.
rgr.agree(x, grpid, nrangrps)
rgr.agree(x, grpid, nrangrps)
x |
A vector upon which to estimate agreement. |
grpid |
A vector identifying the groups from which x originated (actual group membership). |
nrangrps |
A number representing the number of random groups to generate. Note that the number of random groups created must be directly divisible by the number of actual groups to ensure that group sizes of pseudo groups and actual groups are identical. The rgr.agree routine will generate the number of pseudo groups that most closely approximates nrangrps given the group size characteristics of the data. |
An object of class 'rgr.agree' with the following components:
NRanGrp |
The number of random groups created. |
AvRGRVar |
The average within-group variance of the random groups. |
SDRGRVar |
Standard deviation of random group variances used in the z-score estimate. |
zvalue |
Z-score difference between the actual group and random group variances. |
RGRVARS |
The random group variances. |
Paul Bliese [email protected]
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
Bliese, P.D., Halverson, R. R., & Rothberg, J. (2000). Using random group resampling (RGR) to estimate within-group agreement with examples using the statistical language R. Walter Reed Army Institute of Research.
Ludtke, O. & Robitzsch, A. (2009). Assessing within-group agreement: A critical examination of a random-group resampling approach. Organizational Research Methods, 12, 461-487.
data(bh1996) RGROUT<-rgr.agree(bh1996$HRS,bh1996$GRP,1000) summary(RGROUT)
data(bh1996) RGROUT<-rgr.agree(bh1996$HRS,bh1996$GRP,1000) summary(RGROUT)
Uses Random Group Resampling (RGR) within an Ordinary Least Square (OLS) framework to contrast actual group results with pseudo group results. This specific function performs an RGR on an OLS hierarchical OLS model with two predictors as in Bliese & Halverson (2002). To run this analysis on data with more predictors, the function would have to be modified.
rgr.ols(xdat1,xdat2,ydata,grpid,nreps)
rgr.ols(xdat1,xdat2,ydata,grpid,nreps)
xdat1 |
The first predictor. |
xdat2 |
The second predictor. |
ydata |
The outcome. |
grpid |
The group identifier. |
nreps |
The number of pseudo groups to create. |
A matrix containing mean squares. Each row provides mean square values for a single pseudo group iteration
Paul Bliese [email protected]
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
data(lq2002) RGROUT<-rgr.ols(lq2002$LEAD,lq2002$TSIG,lq2002$HOSTILE,lq2002$COMPID,100) #Compare values to those reported on p.62 in Bliese & Halverson (2002) summary(RGROUT)
data(lq2002) RGROUT<-rgr.ols(lq2002$LEAD,lq2002$TSIG,lq2002$HOSTILE,lq2002$COMPID,100) #Compare values to those reported on p.62 in Bliese & Halverson (2002) summary(RGROUT)
Performs the covariance theorem decomposition of a raw correlation in situations where lower-level entities (individuals) are nested in higher-level groups (see Dansereau, Alutto & Yammarino, 1984; Robinson, 1950). Builds upon previous work by incorporating Random Group Resampling or RGR. RGR is used to randomly assign individuals to pseudo groups and create a sampling distributions of the covariance theorem components. The sampling distribution provides a way to contrast actual group covariance components to pseudo group covariance components.
Note that rgr.waba is computationally intensive.
rgr.waba(x, y, grpid, nrep)
rgr.waba(x, y, grpid, nrep)
x |
A vector representing one variable for the correlation. |
y |
A vector representing the other variable for the correlation. |
grpid |
A vector identifying the groups from which X and Y originated. |
nrep |
The number of times that the entire data set is reassigned to pseudo groups |
Returns an object of class rgr.waba. The object is a list containing each random run for each component of the covariance theorem.
Paul Bliese [email protected]
Bliese, P. D. & Halverson, R. R. (1996). Individual and nomothetic models of job stress: An examination of work hours, cohesion, and well- being. Journal of Applied Social Psychology, 26, 1171-1189.
Bliese, P. D., & Halverson, R. R. (2002). Using random group resampling in multilevel research. Leadership Quarterly, 13, 53-68.
Dansereau, F., Alutto, J. A., & Yammarino, F. J. (1984). Theory testing in organizational behavior: The varient approach. Englewood Cliffs, NJ: Prentice-Hall.
Robinson, W. S. (1950). Ecological correlations and the behavior of individuals. American Sociological Review, 15, 351-357.
# This example is from Bliese & Halverson (1996). Notice that all of the # values from the RGR analysis differ from the values based on actual # group membership. Confidence intervals for individual components can # be estimated using the quantile command. In practice, the nrep option # should be more than 100 data(bh1996) #estimate the actual group model waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize the model RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,nrep=100) summary(RWABA) #Estimate 95th percentile confidence intervals (p=.05) quantile(RWABA,c(.025,.975))
# This example is from Bliese & Halverson (1996). Notice that all of the # values from the RGR analysis differ from the values based on actual # group membership. Confidence intervals for individual components can # be estimated using the quantile command. In practice, the nrep option # should be more than 100 data(bh1996) #estimate the actual group model waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize the model RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,nrep=100) summary(RWABA) #Estimate 95th percentile confidence intervals (p=.05) quantile(RWABA,c(.025,.975))
When large SPSS datasets are imported into R, non-numeric fields frequently have numerous blank spaces prior to the text. The blank spaces make it difficult to summarize non-numeric text. The function is applied to an entire dataframe and removes the blank spaces.
rmv.blanks(object)
rmv.blanks(object)
object |
Typically a dataframe created from an imported SPSS file. |
Returns a new dataframe without preceeding
Paul Bliese [email protected]
## Not run: library(foreign) mydata<-read.spss(file.choose(),to.data.frame=T,use.value.labels=F) mydata<-rmv.blanks(mydata) ## End(Not run)
## Not run: library(foreign) mydata<-read.spss(file.choose(),to.data.frame=T,use.value.labels=F) mydata<-rmv.blanks(mydata) ## End(Not run)
Transforms a correlation (r) to a z variate using the formula provided on page 53 of Cohen & Cohen (1983). The formula is z=.5*((log(1+r))-(log(1-r))) where r is the correlation.
rtoz(rvalue)
rtoz(rvalue)
rvalue |
The correlation to be z transformed. |
The z transformation.
Paul Bliese [email protected]
Cohen, J. & Cohen, P. (1983). Applied multiple regression/correlation analysis for the behavioral sciences (2nd Ed.). Hillsdale, NJ: Lawrence Erlbaum Associates.
rtoz(.84)
rtoz(.84)
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.
rwg(x, grpid, ranvar=2)
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
|
grpid |
The group identifier |
rwg |
The rwg estimate for the group |
gsize |
The group size |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating within-group interrater reliability with and without response bias. Journal of Applied Psychology, 69, 85-98.
ad.m
awg
rwg.j
rwg.sim
rgr.agree
rwg.j.lindell
data(lq2002) RWGOUT<-rwg(lq2002$LEAD,lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
data(lq2002) RWGOUT<-rwg(lq2002$LEAD,lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
Calculates the within group agreement measure rwg(j) for multiple item measures as described in James, Demaree and Wolf (1984). 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.j value of 0 (no agreement) for groups with large variances.
rwg.j(x, grpid, ranvar=2)
rwg.j(x, grpid, ranvar=2)
x |
A matrix representing the scale items. Each column of the matrix represents a separate item, and each row represents an individual respondent. |
grpid |
A vector identifying the group 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
|
grpid |
The group identifier |
rwg.j |
The rwg(j) estimate for the group |
gsize |
The group size |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating within-group interrater reliability with and without response bias. Journal of Applied Psychology, 69, 85-98.
ad.m
awg
rwg
rgr.agree
rwg.j.lindell
rwg.j.sim
data(lq2002) RWGOUT<-rwg.j(lq2002[,3:13],lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
data(lq2002) RWGOUT<-rwg.j(lq2002[,3:13],lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
Calculates the Lindell et al r*wg(j) within-group agreement index for multiple item measures. The r*wg(j) is similar to the James, Demaree and Wolf (1984) rwg and rwg(j) indices. The r*wg(j) index is calculated by taking the average item variability as the Observed Group Variance, and using the average item variability in the numerator of the rwg formula (rwg=1-(Observed Group Variance/ Expected Random Variance)). In practice, this means that the r*wg(j) does not increase as the number of items in the scale increases as does the rwg(j). Additionally, the r*wg(j) allows Observed Group Variances to be larger than Expected Random Variances. In practice this means that r*wg(j) values can be negative.
rwg.j.lindell(x, grpid, ranvar=2)
rwg.j.lindell(x, grpid, ranvar=2)
x |
A matrix representing the scale of interest upon which one is interested in estimating agreement. Each column of the matrix represents a separate scale item, and each row represents an individual respondent. |
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
|
grpid |
The group identifier |
rwg.lindell |
The r*wg(j) estimate for the group |
gsize |
The group size |
Paul Bliese [email protected]
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating within-group interrater reliability with and without response bias. Journal of Applied Psychology, 69, 85-98.
Lindell, M. K. & Brandt, C. J. (1999). Assessing interrater agreement on the job relevance of a test: A comparison of CVI, T, rWG(J), and r*WG(J) indexes. Journal of Applied Psychology, 84, 640-647.
data(lq2002) RWGOUT<-rwg.j.lindell(lq2002[,3:13],lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
data(lq2002) RWGOUT<-rwg.j.lindell(lq2002[,3:13],lq2002$COMPID) RWGOUT[1:10,] summary(RWGOUT)
Based on the work of Cohen, Doveh and Eick (2001) and Cohen, Doveh and Nahum-Shani (2009). Draws data from a random uniform null distribution and calculates the James, Demaree and Wolf (1984) within group agreement measure rwg(j) for multiple item scales. By repeatedly drawing random samples, a null distribution of the rwg(j) is generated. The null sampling distribution can be used to calculate confidence intervals for different combinations of group sizes and number of items (J). Users provide the number of scale response options (A) and the number of random samples. By default, items (J) drawn in the simulation are independent (non-correlated); however, an optional argument (itemcors) allows the user to specify a correlation matrix with relationships among items. Cohen et al. (2001) show that values of rwg(j) are primarily a function of the number of items and the group size and are not strongly influenced by correlations among items; nonetheless, assuming correlations among items is more realistic and thereby is a preferred model (see Cohen et al., 2009).
rwg.j.sim(gsize, nitems, nresp, itemcors=NULL, nrep)
rwg.j.sim(gsize, nitems, nresp, itemcors=NULL, nrep)
gsize |
Group size used in the rwg(j) simulation. |
nitems |
The number of items (J) in the multi-item scale on which to base the simulation. If itemcors are provided, this is an optional argument as nitems will be calculated from the correlation matrix. |
nresp |
The number of response options for the J items in the simulation (e.g., there would be 5 response options if using Strongly Disagree, Disagree, Neither, Agree, Strongly Agree). |
itemcors |
An optional argument containing a correlation matrix with the item correlations. |
nrep |
The number of rwg(j) values to simulate. This will generally be 10,000 or more, but only 500 are used in the examples to reduce computational demands. |
rwg.j |
rwg(j) value from each of the nrep simulations. |
gsize |
Simulation group size. |
nresp |
Simulated number of response options. |
nitems |
Number of items in the multiple item scale. Either provided in the call or calculated from the correlation matrix, if given. |
rwg.j.95 |
95 percent confidence interval estimate associated with a p-value of .05. Values greater than or equal to the rwg.j.95 value are considered significant. |
Paul Bliese [email protected]
Cohen, A., Doveh, E., & Nahum-Shani, I. (2009). Testing agreement for multi-item scales with the indices rwg(j) and adm(j). Organizational Research Methods, 12, 148-164.
Cohen, A., Doveh, E., & Eick, U. (2001). Statistical properties of the rwg(j) index of agreement. Psychological Methods, 6, 297-310.
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating within-group interrater reliability with and without response bias. Journal of Applied Psychology, 69, 85-98.
rwg.j
rwg
rwg.sim
rwg.j.lindell
rgr.agree
#An example assuming independent items RWG.J.OUT<-rwg.j.sim(gsize=10,nitems=6,nresp=5,nrep=500) summary(RWG.J.OUT) quantile(RWG.J.OUT, c(.95,.99)) #A more realistic example assuming correlated items. The #estimate in Cohen et al. (2006) is .61. data(lq2002) RWG.J.OUT<-rwg.j.sim(gsize=10,nresp=5, itemcors=cor(lq2002[,c("TSIG01","TSIG02","TSIG03")]), nrep=500) summary(RWG.J.OUT) quantile(RWG.J.OUT,c(.95,.99))
#An example assuming independent items RWG.J.OUT<-rwg.j.sim(gsize=10,nitems=6,nresp=5,nrep=500) summary(RWG.J.OUT) quantile(RWG.J.OUT, c(.95,.99)) #A more realistic example assuming correlated items. The #estimate in Cohen et al. (2006) is .61. data(lq2002) RWG.J.OUT<-rwg.j.sim(gsize=10,nresp=5, itemcors=cor(lq2002[,c("TSIG01","TSIG02","TSIG03")]), nrep=500) summary(RWG.J.OUT) quantile(RWG.J.OUT,c(.95,.99))
Based on the work of Dunlap, Burke and Smith-Crowe (2003). Draws data from a random uniform null distribution, and calculates the within group agreement measure rwg for single item measures as described in James, Demaree and& Wolf (1984). By repeatedly drawing random samples, a null distribution of the rwg is generated. The null sampling distribution can be used to calculate confidence intervals for different combinations of group sizes and number of response options (A).
rwg.sim(gsize, nresp, nrep)
rwg.sim(gsize, nresp, nrep)
gsize |
Group size upon which to base the rwg simulation. |
nresp |
The number of response options (e.g., there would be 5 response options if using Strongly Disagree, Disagree, Neither, Agree, Strongly Agree). |
nrep |
The number of rwg values to simulate. This will generally be 10,000 or more, although the examples use nrep of 500 to reduce computational demands. |
rwg |
rwg value from each simulation. |
gsize |
Group size used in the rwg simulation. |
nresp |
Simulated number of response options. |
nitems |
Will always be 1 for an rwg estimate. |
rwg.95 |
Estimated 95 percent confidence interval. Values greater than or equal to rwg.95 are considered significant, p<.05. |
Paul Bliese [email protected]
Cohen, A., Doveh, E., & Eick, U. (2001). Statistical properties of the rwg(j) index of agreement. Psychological Methods, 6, 297-310.
Dunlap, W. P., Burke, M. J., & Smith-Crowe, K. (2003). Accurate tests of statistical significance for rwg and average deviation interrater agreement indices. Journal of Applied Psychology, 88, 356-362.
James, L.R., Demaree, R.G., & Wolf, G. (1984). Estimating within-group interrater reliability with and without response bias. Journal of Applied Psychology, 69, 85-98.
ad.m
awg
rwg.j
rwg
rwg.j.sim
rgr.agree
#An example from Dunlap et al. (2003). The estimate from Dunlap #et al. Table 2 is 0.53 (p=.05) RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=500) summary(RWG.OUT) quantile(RWG.OUT, c(.95,.99))
#An example from Dunlap et al. (2003). The estimate from Dunlap #et al. Table 2 is 0.53 (p=.05) RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=500) summary(RWG.OUT) quantile(RWG.OUT, c(.95,.99))
Generate a sample vector (y) with a known population correlation to a given vector (x). The degree of correlation between x and y is determined by rho (the population correlation). Observed sample correlations between x and y will vary around rho, but this variation will decrease as the number of x observations increase.
sam.cor(x,rho)
sam.cor(x,rho)
x |
The given vector. |
rho |
Population correlation. |
The function prints the sample correlation for the specific set of numbers generated.
y |
A vector of numbers correlated with x. |
Paul Bliese [email protected]
data(bh1996) NEWVAR<-sam.cor(x=bh1996$LEAD,rho=.30) cor(bh1996$LEAD,NEWVAR)
data(bh1996) NEWVAR<-sam.cor(x=bh1996$LEAD,rho=.30) cor(bh1996$LEAD,NEWVAR)
Contains estimates of movement length (in inches) of a light in a completely dark room. Eight groups of three individuals provided three estimates for a total of 72 observations. In four of the groups, participants first made estimates alone prior to providing estimates as a group. In the other four groups participants started as groups. Lang and Bliese (2019) used these data to illustrate how variance functions in mixed-effects models (lme) could be used to test whether groups displayed consensus emergence. Data were obtained from
https://brocku.ca/MeadProject/Sherif/Sherif_1935a/Sherif_1935a_3.html
data(sherifdat)
data(sherifdat)
A dataframe with 5 columns and 72 observations
[,1] | person | numeric | Participant ID within a group |
[,2] | time | numeric | Measurment Occasion |
[,3] | group | numeric | Group Identifier |
[,4] | y | numeric | Estimate of movement length in inches |
[,5] | condition | numeric | Experimental Condition (0) starting as a group, (1) starting individually |
Sherif, M. (1935). A study of some social factors in perception: Chapter 3. Archives of Psychology, 27, 23- 46.
https://brocku.ca/MeadProject/Sherif/Sherif_1935a/Sherif_1935a_3.html
Lang, J. W. B., & Bliese, P. D., (2019). A Temporal Perspective on Emergence: Using 3-level Mixed Effects Models to Track Consensus Emergence in Groups. In S. E. Humphrey & J. M. LeBreton (Eds.), The Handbook for Multilevel Theory, Measurement, and Analysis. Washington, DC: American Psychological Association
Lang, J. W. B., Bliese, P. D., & Adler, A. B. (2019). Opening the Black Box: A Multilevel Framework for Studying Group Processes. Advances in Methods and Practices in Psychological Science, 2, 271-287.
Lang, J. W. B., Bliese, P. D., & de Voogt, A. (2018). Modeling Consensus Emergence in Groups Using Longitudinal Multilevel Methods. Personnel Psychology, 71, 255-281.
Lang, J. W. B., Bliese, P. D., & Runge, J. M. (2021). Detecting consensus emergence in organizational multilevel data: Power simulations. Organizational Research Methods, 24(2), 319-341.
ICC(1) values play an important role influencing the form of relationships among variables in nested data. This simulation allows one to create data with known ICC(1) values. Multiple variables can be created both with and without level-1 correlation.
sim.icc(gsize, ngrp, icc1, nitems=1, item.cor=FALSE)
sim.icc(gsize, ngrp, icc1, nitems=1, item.cor=FALSE)
gsize |
The simulated group size. |
ngrp |
The simulated number of groups. |
icc1 |
The simulated ICC(1) value. |
nitems |
The number of items (vectors) to simulate. |
item.cor |
An option to create level-1 correlation among items. Provided as a value between 0 and 1. If used, nitems must be larger than 1. |
GRP |
The grouping designator. |
VAR1 |
The simulated value. Multiple numbered columns if nitems>1 |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bliese, P. D., Maltarich, M. A., Hendricks, J. L., Hofmann, D. A., & Adler, A. B. (2019). Improving the measurement of group-level constructs by optimizing between-group differentiation. Journal of Applied Psychology, 104, 293-302.
## Not run: set.seed(1535324) ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15) ICC1(aov(VAR1~as.factor(GRP), ICC.SIM)) # 4 items with no level-1 correlation set.seed(15324) #items with no level-1 (within) correlation ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4) mult.icc(ICC.SIM[,2:5],ICC.SIM$GRP) with(ICC.SIM,waba(VAR1,VAR2,GRP))$Cov.Theorem #Examine CorrW # 4 items with a level-1 (within) correlation of .30 set.seed(15324) ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4, item.cor=.3) mult.icc(ICC.SIM[,2:5],ICC.SIM$GRP) with(ICC.SIM,waba(VAR1,VAR2,GRP))$Cov.Theorem #Examine CorrW ## End(Not run)
## Not run: set.seed(1535324) ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15) ICC1(aov(VAR1~as.factor(GRP), ICC.SIM)) # 4 items with no level-1 correlation set.seed(15324) #items with no level-1 (within) correlation ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4) mult.icc(ICC.SIM[,2:5],ICC.SIM$GRP) with(ICC.SIM,waba(VAR1,VAR2,GRP))$Cov.Theorem #Examine CorrW # 4 items with a level-1 (within) correlation of .30 set.seed(15324) ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4, item.cor=.3) mult.icc(ICC.SIM[,2:5],ICC.SIM$GRP) with(ICC.SIM,waba(VAR1,VAR2,GRP))$Cov.Theorem #Examine CorrW ## End(Not run)
In multilevel or hierarchical nested data, correlations at the within and between levels often differ in magnitude and/or sign. For instance, Bliese and Halverson (1996) showed that the within correlation between individual reports of work hours and individual well-being was -.11. When these same data were mean-aggregated to the group-level, the between correlation based on group means was -.71. A necessary, but not sufficient, condition for differences across levels is a non-zero ICC1 value for both variables (Bliese, 2000). This simulation creates a dataset with a group ID and an X and Y variable for any combination of group size, number of groups, within and between correlations, ICC1 values and reliability (alpha).
sim.mlcor(gsize,ngrp,gcor,wcor,icc1x,icc1y,alphax=1,alphay=1)
sim.mlcor(gsize,ngrp,gcor,wcor,icc1x,icc1y,alphax=1,alphay=1)
gsize |
The simulated group size. |
ngrp |
The simulated number of groups. |
gcor |
The simulated between group correlation. |
wcor |
The simulated within group correlation. |
icc1x |
The simulated ICC1 value for X. |
icc1y |
The simulated ICC1 value for Y. |
alphax |
The reliability (alpha) of X. |
alphay |
The reliability (alpha) of Y. |
GRP |
The grouping designator. |
X |
The simulated X value. |
Y |
The simulated Y value. |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bliese, P. D. & Halverson, R. R. (1996). Individual and nomothetic models of job stress: An examination of work hours, cohesion, and well-being. Journal of Applied Social Psychology, 26, 1171-1189.
Bliese, P. D., Maltarich, M. A., Hendricks, J. L., Hofmann, D. A., & Adler, A. B. (2019). Improving the measurement of group-level constructs by optimizing between-group differentiation. Journal of Applied Psychology, 104, 293-302.
## Not run: # # Examine the multilevel properties of work hours and well-being # in the bh1996 data # data(bh1996) with(bh1996,waba(HRS,WBEING,GRP)) mult.icc(bh1996[,c("HRS","WBEING")],bh1996$GRP) # #Estimate true group-mean correlation by adding ICC2 adjusted incremental #correlation back to within correlation. For value of -.8256 # -0.110703+(-0.7121729--0.110703)/(sqrt(0.9171286*0.771756)) # # Simulate data with same properties assuming no measurement error # set.seed(578323) SIM.ML.COR<-sim.mlcor(gsize=75,ngrp=99,gcor=-.8256,wcor=-.1107, icc1x=0.04338,icc1y=0.12924,alphax=1,alphay=1) # # Compare Simulated results to results (above) from bh1996 # with(SIM.ML.COR,waba(X,Y,GRP)) mult.icc(SIM.ML.COR[,c("X","Y")],SIM.ML.COR$GRP) ## End(Not run)
## Not run: # # Examine the multilevel properties of work hours and well-being # in the bh1996 data # data(bh1996) with(bh1996,waba(HRS,WBEING,GRP)) mult.icc(bh1996[,c("HRS","WBEING")],bh1996$GRP) # #Estimate true group-mean correlation by adding ICC2 adjusted incremental #correlation back to within correlation. For value of -.8256 # -0.110703+(-0.7121729--0.110703)/(sqrt(0.9171286*0.771756)) # # Simulate data with same properties assuming no measurement error # set.seed(578323) SIM.ML.COR<-sim.mlcor(gsize=75,ngrp=99,gcor=-.8256,wcor=-.1107, icc1x=0.04338,icc1y=0.12924,alphax=1,alphay=1) # # Compare Simulated results to results (above) from bh1996 # with(SIM.ML.COR,waba(X,Y,GRP)) mult.icc(SIM.ML.COR[,c("X","Y")],SIM.ML.COR$GRP) ## End(Not run)
Non-independence due to groups is a common characteristic of applied data. In non-independent data, responses from members of the same group are more similar to each other than would be expected by chance. Non-independence is typically measured using the Intraclass Correlation Coefficient 1 or ICC(1). When non-independent data is treated as though it is independent, standard errors will be biased and power can decrease. The simbias simulation allows one to estimate the bias and loss of statistical power that occurs when non-independent data is treated as though it is independent. The simulation contrasts a simple Ordinary Least Squares (OLS) model that fails to account for non-independence with a random coefficient model that accounts for non-independence. The simulation assumes that both the outcome (y) and the predictor (x) vary among individuals in the same group (i.e., are within variables).
simbias(corr,gsize,ngrp,icc1x,icc1y,nrep)
simbias(corr,gsize,ngrp,icc1x,icc1y,nrep)
corr |
The simulated true correlation between x and y. |
gsize |
The group size from which x and y are drawn. |
ngrp |
The number of groups. |
icc1x |
The simulated ICC(1) value for x. |
icc1y |
The simulated ICC(1) value for y. |
nrep |
The number of repetitions of simulated data sets. |
icc1.x |
Observed ICC(1) value for x in the simulation. |
icc1.y |
Observed ICC(1) value for y in the simulation. |
lme.coef |
Parameter estimate from the lme model. |
lme.se |
Standard error estimate from the lme model. |
lme.tvalue |
t-value from the lme model. |
lm.coef |
Parameter estimate from the linear model (OLS). |
lm.se |
Standard error estimate from the linear model (OLS). |
lm.tvalue |
t-value from the linear model (OLS). |
Paul Bliese [email protected]
Bliese, P. D. & Hanges, P. J. (2004). Being both too liberal and too conservative: The perils of treating grouped data as though they were independent. Organizational Research Methods, 7, 400-417.
library(nlme) set.seed(15) SIM.OUTPUT<-simbias(corr=.15,gsize=10,ngrp=50,icc1x=0.05, icc1y=0.35, nrep=100) apply(SIM.OUTPUT,2,mean) 1-pnorm(1.96-3.39) #Power of the lme model (two-tailed, alpha=.05) 1-pnorm(1.96-2.95) #Power of the OLS model (two-tailed, alpha=.05)
library(nlme) set.seed(15) SIM.OUTPUT<-simbias(corr=.15,gsize=10,ngrp=50,icc1x=0.05, icc1y=0.35, nrep=100) apply(SIM.OUTPUT,2,mean) 1-pnorm(1.96-3.39) #Power of the lme model (two-tailed, alpha=.05) 1-pnorm(1.96-2.95) #Power of the OLS model (two-tailed, alpha=.05)
Estimate Sobel's (1982) indirect test for mediation. The function provides an estimate of the magnitude of the indirect effect, Sobel's first-order estimate of the standard error associated with the indirect effect, and the corresponding z-value. The estimates are based upon three models as detailed on page 84 of MacKinnon, Lockwood, Hoffman, West and Sheets (2002).
sobel(pred,med,out)
sobel(pred,med,out)
pred |
The predictor or independent variable (X). |
med |
The mediating variable (M). |
out |
The outcome or dependent variable (Y). |
Mod1: Y~X |
A summary of coefficients from Model 1 of MacKinnon et al., (2002). |
Mod2: Y~X+M |
A summary of coefficients from Model 2 of MacKinnon et al., (2002). |
Mod3: M~X |
A summary of coefficients from Model 3 of MacKinnon et al., (2002). |
Indirect.Effect |
The estimate of the indirect mediating effect. |
SE |
Sobel's (1982) Standard Error estimate. |
z.value |
The estimated z-value. |
N |
The number of observations used in model estimation. |
Paul Bliese [email protected]
MacKinnon, D. P., Lockwood, C. M., Hoffman, J. M., West, S. G., Sheets, V. (2002). A comparison of methods to test mediation and other intervening variable effects. Psychological Methods, 7, 83-104.
Sobel, M. E., (1982). Asymptotic confidence intervals for indirect effects in structural equation models. In S. Leinhardt (Ed.), Sociological Methodology 1982 (pp. 290-312). Washington, DC: American Sociological Association.
data(bh1996) #A small but significant indirect effect indicates leadership mediates #the relationship between work hours and well-being. sobel(pred=bh1996$HRS,med=bh1996$LEAD,out=bh1996$WBEING)
data(bh1996) #A small but significant indirect effect indicates leadership mediates #the relationship between work hours and well-being. sobel(pred=bh1996$HRS,med=bh1996$LEAD,out=bh1996$WBEING)
Provides a concise summary of objects created using the functions rwg.sim and rwg.j.sim.
## S3 method for class 'agree.sim' summary(object,...)
## S3 method for class 'agree.sim' summary(object,...)
object |
An object of class 'agree.sim'. |
... |
Optional additional arguments. None used. |
A summary of all the output elements in the agree.sim class object.
Paul Bliese [email protected]
#An example from Dunlap et al. (2003). The estimate from Dunlap et al. #Table 2 is 0.53. Increase replications in actual use. RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=500) summary(RWG.OUT)
#An example from Dunlap et al. (2003). The estimate from Dunlap et al. #Table 2 is 0.53. Increase replications in actual use. RWG.OUT<-rwg.sim(gsize=10,nresp=5,nrep=500) summary(RWG.OUT)
Provides a concise summary of objects created using the function ad.m.sim.
## S3 method for class 'disagree.sim' summary(object,...)
## S3 method for class 'disagree.sim' summary(object,...)
object |
An object of class 'disagree.sim'. |
... |
Optional additional arguments. None used. |
A summary of all the output elements in the disagree.sim class object.
Paul Bliese [email protected]
#Example from Dunlap et al. (2003), Table 3. The listed significance #value for a group of size 5 with a 7-item response format is 0.64 or less. #Increase nrep in actual use SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=500) summary(SIMOUT)
#Example from Dunlap et al. (2003), Table 3. The listed significance #value for a group of size 5 with a 7-item response format is 0.64 or less. #Increase nrep in actual use SIMOUT<-ad.m.sim(gsize=5, nitems=1, nresp=7, itemcors=NULL, type="mean", nrep=500) summary(SIMOUT)
Provides a concise summary of objects created using the function rgr.agree.
## S3 method for class 'rgr.agree' summary(object,...)
## S3 method for class 'rgr.agree' summary(object,...)
object |
An object of class 'rgr.agree'. |
... |
Optional additional arguments. None used. |
Summary Statistics for Random and Real Groups |
Number of random groups, Average random group variance, Standard Deviation of random group variance, Actual group variance, z-value |
Lower Confidence Intervals (one-tailed) |
Lower confidence intervals based on sorted random group variances. |
Upper Confidence Intervals (one-Tailed) |
Upper confidence intervals based on sorted random group variances. |
Paul Bliese [email protected]
# Example with a small number of replications (500). Increase in actual use. data(bh1996) RGROUT<-rgr.agree(bh1996$HRS,bh1996$GRP,500) summary(RGROUT)
# Example with a small number of replications (500). Increase in actual use. data(bh1996) RGROUT<-rgr.agree(bh1996$HRS,bh1996$GRP,500) summary(RGROUT)
Provides a concise summary of objects created using the function rgr.waba.
## S3 method for class 'rgr.waba' summary(object,...)
## S3 method for class 'rgr.waba' summary(object,...)
object |
An object of class 'rgr.waba'. |
... |
Optional additional arguments. None used. |
A dataframe containing summary statistics in the form of number of repetitions (NRep), Mean and Standard Deviations (SD) for each parameter in the rgr.waba model.
Paul Bliese [email protected]
data(bh1996) #estimate the actual group model waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize results RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,100) summary(RWABA)
data(bh1996) #estimate the actual group model waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP) #create 100 pseudo group runs and summarize results RWABA<-rgr.waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP,100) summary(RWABA)
A partial sample of data collected by Lang and reported in Lang and Bliese (2009). The tankdat sub-sample was used as an example of discontinuous growth modeling in Bliese and Lang (2016). The data set is in long (univariate) format, and contains performance data from 184 participants over 12 repeated measures on a complex tank simulation task. In the research paradigm, the task was unexpectedly changed after the first six performance episodes. Discontinuous growth models were used to examine participants' reactions to the unexpected change. The data set contains the person-level predictor of conscientiousness.
data(tankdat)
data(tankdat)
A dataframe with 4 columns and 2208 observations
[,1] | ID | numeric | Participant ID |
[,2] | CONSC | numeric | Participant Conscientiousness |
[,3] | TIME | numeric | Time |
[,4] | SCORE | numeric | Task Performance |
Bliese, P. D., & Lang, J. W. B. (2016). Understanding relative and absolute change in discontinuous growth models: Coding alternatives and implications for hypothesis testing. Organizational Research Methods, 19, 562-592.
Lang, J. W. B., & Bliese, P. D. (2009). General mental ability and two types of adaptation to unforeseen change: Applying discontinuous growth models to the task-change paradigm. Journal of Applied Psychology, 92, 411-428.
Contains the complete data set used in Bliese and Ployhart (2002) focused on Job Satisfation. The data is in univariate (i.e., stacked) form. Data were collected at three time points.
data(univbct)
data(univbct)
A data frame with 22 columns and 1485 observations from 495 individuals
[,1] | BTN | numeric | BN Id |
[,2] | COMPANY | numeric | Co Id |
[,3] | MARITAL | numeric | Marital Status (1 single; 2 married; 3 separated; 4 divorced; 5 other) |
[,4] | GENDER | numeric | Gender (1 male; 2 female) |
[,5] | HOWLONG | numeric | Time in Unit |
[,6] | RANK | numeric | Rank |
[,7] | EDUCATE | numeric | Education |
[,8] | AGE | numeric | Age |
[,9] | JOBSAT1 | numeric | JOBSAT Time 1 |
[,10] | COMMIT1 | numeric | Commitment Time 1 |
[,11] | READY1 | numeric | Readiness Time 1 |
[,12] | JOBSAT2 | numeric | JOBSAT Time 2 |
[,13] | COMMIT2 | numeric | Commitment Time 2 |
[,14] | READY2 | numeric | Readiness Time 2 |
[,15] | JOBSAT3 | numeric | JOBSAT Time 3 |
[,16] | COMMIT3 | numeric | Commitment Time 3 |
[,17] | READY3 | numeric | Readiness Time 3 |
[,18] | TIME | numeric | 0 to 2 time maker |
[,19] | JSAT | numeric | Jobsat in univariate form |
[,20] | COMMIT | numeric | Commitment in univariate form |
[,21] | READY | numeric | Readiness in univariate form |
[,22] | SUBNUM | numeric | Subject number |
Bliese, P. D., & Ployhart, R. E. (2002). Growth modeling using random coefficient models: Model building, testing and illustrations. Organizational Research Methods, 5, 362-387.
Performs the covariance theorem decomposition of a raw correlation in situations where lower-level entities (individuals) are nested in higher-level groups (see Robinson, 1950). Dansereau, Alutto and Yammarino (1984) refer to the variance decomposition as "Within-And-Between-Analysis II" or "WABA II". The waba function decomposes a raw correlation from a two-level nested design into 6 components. These components are (1) eta-between value for X, (2) eta-between value for Y, (3) the group-size weighted group-mean correlation, (4) the within-eta value for X, (5) the within-eta value for Y, and (6) the within-group correlation between X and Y. The last value represents the correlation between X and Y after each variable has been group-mean centered (demeaned).
The program is designed to automatically perform listwise deletion on missing values; consequently, users should pay attention to the diagnostic information (Number of Groups and Number of Observations) provided as part of the output.
Note that Within-And-Between-Analysis proposed by Dansereau et al. involves more than covariance theorem decomposition of correlations. Specifically, WABA involves decision rules based on eta-values. These are not replicated in the R multilevel library because the eta based decision rules have been shown to be highly related to group size (Bliese, 2000; Bliese & Halverson, 1998), a factor not accounted for in the complete Within-And-Between-Analysis methodology.
waba(x, y, grpid)
waba(x, y, grpid)
x |
A vector representing one variable in the correlation. |
y |
A vector representing the other variable in the correlation. |
grpid |
A vector identifying the groups from which x and y originated. |
Returns a list with three elements.
Cov.Theorem |
A 1 row dataframe with all of the elements of the covariance theorem. |
n.obs |
The number of observations used to calculate the covariance theorem. |
n.grps |
The number of groups in the data set. |
Paul Bliese [email protected]
Bliese, P. D. (2000). Within-group agreement, non-independence, and reliability: Implications for data aggregation and Analysis. In K. J. Klein & S. W. Kozlowski (Eds.), Multilevel Theory, Research, and Methods in Organizations (pp. 349-381). San Francisco, CA: Jossey-Bass, Inc.
Bliese, P. D., & Halverson, R. R. (1998). Group size and measures of group-level properties: An examination of eta-squared and ICC values. Journal of Management, 24, 157-172.
Dansereau, F., Alutto, J. A., & Yammarino, F. J. (1984). Theory testing in organizational behavior: The varient approach. Englewood Cliffs, NJ: Prentice-Hall.
Robinson, W. S. (1950). Ecological correlations and the behavior of individuals. American Sociological Review, 15, 351-357.
data(bh1996) waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP)
data(bh1996) waba(bh1996$HRS,bh1996$WBEING,bh1996$GRP)