sim.icc: Simulate 2-level ICC(1) values with and without level-1...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/multilevel.R

Description

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.

Usage

1
sim.icc(gsize, ngrp, icc1,nitems=1,item.cor=FALSE)

Arguments

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.

Value

GRP

The grouping designator.

VAR1

The simulated value. Multiple numbered columns if nitems>1

Author(s)

Paul Bliese [email protected]

References

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.

See Also

ICC1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 ## 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)
ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4) #items with no level-1 correlation
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 correlation of .30
set.seed(15324)
ICC.SIM<-sim.icc(gsize=10,ngrp=100,icc1=.15,nitems=4, item.cor=.3) #.30 level-1 item correlations
mult.icc(ICC.SIM[,2:5],ICC.SIM$GRP)
with(ICC.SIM,waba(VAR1,VAR2,GRP))$Cov.Theorem  #Examine CorrW 

## End(Not run)

Example output

Loading required package: nlme
Loading required package: MASS
[1] 0.16681
  Variable      ICC1      ICC2
1     VAR1 0.2035837 0.7188047
2     VAR2 0.1442111 0.6275778
3     VAR3 0.2229725 0.7415725
4     VAR4 0.1549414 0.6470794
     RawCorr    EtaBx     EtaBy     CorrB    EtaWx     EtaWy       CorrW
1 0.07728039 0.530273 0.4775097 0.5939511 0.847827 0.8786265 -0.09815005
  Variable      ICC1      ICC2
1     VAR1 0.1669452 0.6671118
2     VAR2 0.1558558 0.6486689
3     VAR3 0.1381652 0.6158502
4     VAR4 0.1715351 0.6743219
    RawCorr    EtaBx     EtaBy     CorrB     EtaWx     EtaWy     CorrW
1 0.3987741 0.498367 0.4883034 0.6976093 0.8669662 0.8726739 0.3026887

multilevel documentation built on May 29, 2017, 5:38 p.m.