simbias: Simulate Standard Error Bias in Non-Independent Data

View source: R/multilevel.R

simbiasR Documentation

Simulate Standard Error Bias in Non-Independent Data

Description

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).

Usage

simbias(corr,gsize,ngrp,icc1x,icc1y,nrep)

Arguments

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.

Value

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).

Author(s)

Paul Bliese pdbliese@gmail.com

References

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.

See Also

ICC1

Examples


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)


multilevel documentation built on March 18, 2022, 5:47 p.m.