= Where can I find out about using random effects models in R including obtaining proportion of variance attributable to a variable? =
Random effects models are becoming increasingly used for both continuous and binary outcomes. Jaeger (2008) recommends using binary logistic mixed models for the latter cases after noting shortcomings using the traditional arcsine transformed responses in ANOVAs to approximating proportions near to zero or one.
Paul Bleise has written an [[attachment:nlmeR.pdf|introductory guide ]] to fitting random effects models in R using the nlme software with some case studies and general tips on using R objects.
The guide mentions, in particular, the function VarCorr() which computes residual variances of models specified to VarCorr. Comparisons of VarCorrs() related to nested models enables the computation of percentage of variance explained by variable sets. For example if VarCorr(y~a+b) gives residual variance A and VarCorr(y~a) gives residual variance B (<=A) the proportion of variance explained by variable B = 1 - B/A. Further details of this R-squared for random effects may be found in Snijders and Bosker (1999).
You can also fit random effects models in R using the lme4 program which computes percentiles of Monte-Carlo Markov Chain (mcmc) for regression estimates and variance components derived from simulations using the random effects model. The usual REML estimates are also produced. The median (50 percentile) of the mcmc estimates should approximately equal the analogous REML ones.
There is also a R guide on multilevel modelling by Baayen, R.H. (2008) in pdf format [[attachment:Baayenlmer.pdf|here.]]
SPSS have a 28 page [[attachment:spssmixed.pdf|document]] giving case studies using GLM and MIXED procedures. Data input, syntax and interpretation of output are all considered. This document is also available on-line from [[http://www.spss.ch/upload/1126184451_Linear%20Mixed%20Effects%20Modeling%20in%20SPSS.pdf|here]].
There are some excellent comprehensive descriptions in these selected slides (in pdf format) for fitting '''Mixed models in R using the lme4 package''' (Bates and Rahway, 2010) using lmer and glmer procedures:
Repeated measures models may also be estimated using glmmPQL from the MASS package (version 7.3-29) – see Venables and Ripley (2002) which use Generalized linear mixed models (GLMMs) to fit a random intercept.
[[attachment:3simple.pdf|Part 3: Linear mixed models with simple, scalar random effects]]
[[attachment:4longitudinal.pdf|Part 4: Longitudinal data, modeling interactions]]
[[attachment:7GLMM.pdf|Part 7: Generalized linear mixed models]]
In MATLAB the procedure nlmefit may be used to fit mixed models (see [[ http://uk.mathworks.com/matlabcentral/answers/67041-how-to-compute-a-linear-mixed-effect-using-nlmefit | here]] and [[http://uk.mathworks.com/help/stats/nlmefit.html | here]]
for some worked examples).
Alex Quent has also fitted random effects models in R to simulated data (His R code using the lmer procedure fitted to a variety of models is [[https://jaquent.github.io/2018/0314_mixedModels.html |here]]) reproduced [[FAQ/alexR | here]] if link broken. Non-convergence can be a problem, however, due to increasing numbers of random effects, variation in numbers of observations across levels of the random effects and size of data set (see this [[attachment:eager+roy.pdf | pdf here]] by Eager and Roy (2017) taken from [[https://arxiv.org/abs/1701.04858 | here.]]).
__References__
Baayen, R.H. (2008) Analyzing linguistic data:a practical introduction to statistics using R. Cambridge University Press.
Baguley, T. (2012) Serious Stats. A guide to advanced statistics for the behavioral scoences. Palgrave MacMillan:New York. Comprehensive coverage with R code in Chapter 18.
[[attachment:arcsine.pdf|Jaeger, T.F. (2008) Categorical data analysis:away from ANOVAs. ]]
''J Mem Lang'' 59(4) 434-446.
Eager, C. and Roy, J. (2017) Write up for poster presented at Linguistic Society of America 2017: Eager, Christopher and Joseph Roy. Mixed Effects are Sometimes Terrible. Linguistic Society of America, Poster (January 5-8, 2017). Cite as: [[https://arxiv.org/abs/1701.04858v1 |arXiv:1701.04858v1]] '''[stat.AP]'''. (The stat.AP stands for the poster topic theme of 'Applications in Statistics').
Heck, R.H., Thomas, S.L. and Tabata, L. N. (2010) Multilevel and longitudinal modeling with IBM SPSS. Routledge:New York.
Heck, R.H., Thomas, S.L. and Tabata, L. N. (2012) Multilevel modeling of categorical outcomes using IBM SPSS. Routledge:New York.
Peugh, J.L., & Enders, C.K. (2005) Using the SPSS mixed procedure to fit cross-sectional and longitudinal multilevel models. ''Educational and Psychological Measurement'', '''65''', 717–741.
Snijders, T. and Bosker, R. (1999) Multilevel analysis: an introduction to basic and advanced multilevel modelling. Sage:London.
Venables, W.N. & Ripley, B.D. (2002) Modern Applied Statistics with S (4th ed.). Springer: New York. ISBN 0-387-95457-0
Wright, D.B. & London, K. (2009) Multilevel modelling: Beyond the basic applications. ''British Journal of Mathematical and Statistical Psychology'' '''62''', 439-456. This is a teaching primer article including worked examples of data management prior to analysis. A PDF copy of this paper is available [[attachment:randeff.pdf|here.]]