Scripts


Back to home page

"A man got to have a code" (Omar Little, The Wire)

A collection of R scripts which I regularly use in my work. Feel free to use and further customize them in any way you need. If you spot a mistake, I'd be grateful if you sent me an email with the problem. In that way I can correct the script and improve it further (I'll credit the help offered).

Computing ICC for 2-level and 3-level models with lme4

The script includes 3 functions (ICC.2(), ICC.3.1(), and ICC.3.2()). The first is used for 2-level models, while the last two are used for 3-level ones. ICC.3.1() will offer an estimate of the level-3 variance as share of total variance, while ICC.3.2() will estimate level-2 and level-3 variance as a share of total variance. Both functions take as argument a lmerMod class object that is produced by lmer() output.