# Multilevel/Mixed Models

### From Wiki1

- Introductory references on multilevel and longitudinal data analysis
- Judith D. Singer & John B. Willett (2003)
*Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence*, New York: Oxford University Press.

- Judith D. Singer & John B. Willett (2003)

- Papers on the relationship between the multilevel/mixed modeling and structural equation modeling (SEM) with latent variables:

## Contents |

## Reporting Mixed Models

- Betsy McCoach ....
- Jaeger 2011 Fitting, Evaluating, and Reporting Mixed Models
- Winter 2013? Linear models and linear mixed effects models in R with linguistic applications

## Multilevel/Hierarchical/Mixed Model RSquared

Links:

- Note by Gelman
- Gelman and Pardoe (2006) Bayesian Measures of Explained Variance and Pooling in Multilevel (Hierarchical) Models
- A mixed model paradox

## Software for Multilevel Models

- plm package for the Econometric Analysis of Panel Data
- Packages for mixed models

Name | Software | Summary | Reference |
---|---|---|---|

npmlreg Non-parametric maximum likelihood | R | Rnews (2007) |

## Notes on Snijders & Bosker (2012)

### Hausman test (p. 57)

Is equivalent to a test that the between group effect of a variable is equal to the within group effect, i.e. that there is no 'contextual' effect of the variable beyond its within group effect. S&B state that the test has been wrongly used to decided between using a random effects versus a fixed effects model. It should be used to decide on the inclusion of a 'contextual' variable in addition to the original 'raw' variable or, equivalently in the fixed portion of the model, the inclusion of the contextual variable together with the 'centered-with-group' variable.

### Within- and between-group regression coefficients (p. 58)

They can have opposite signs providing an example of Robinson's Paradox.

### Centering variables with random slopes (p. 87ff)

This issue concerns centering the variable that appears in the 'random' portion of the model. The variable can appear uncentered or centered in fixed part of the model independently of the way it appears in the random part of the model. If the contextual variable is included in the fixed part of the model, then choosing either the centered-within-group (CWG) or the raw variable in the fixed part yields the same model with different parametrizations. Note that the contextual variable would not normally appear in the random part of the model because it is a level-2 variable. Using the raw variable versus the CWG variable in the random part yields different models as S&B discuss in the bottom half of p. 88.

It's a small point but the second to last paragraph on p. 88 might give the impression that the same variable (CWG or raw) needs to be used in the fixed part and in the random part. This is not the case. One can use raw in the fixed part so that the regression output provides a direct estimate of the contextual effect and the CWG in the random part.

The last paragraph seems to reify the relationship between Y and X versus Y and X-Xbar. In the presence of Xbar they are not distinguishable. What matters to distinguish the two models is the shape of the random scatter of within-group regression lines relative to group means for X and for Y.

There's a relevant connected point at the top of p. 89: Interactions among level-1 variables will produce different fixed models depending on the centering of the variables.

## Issues in mixed models

### Random slopes

- Holger Schielzeth and Wolfgang Forstmeier (2009) "Conclusions beyond support: overconfident estimates in mixed models"
*Behavioral Ecology*advocate the wider used of random slopes models. Convergence problems are mentioned but not really addressed.

### Missing data in longitudinal studies

#### Multiple imputation for longitudinal studies

- Michael Spratt et al., (2010) Strategies for Multiple Imputation in Longitudinal Studies.
- Schafer, Joe (2005) Missing Data in Longitudinal Studies: A Review

#### Using Julia from R to fit mixed models

from Doug Bates (2018):

Many users experience long execution times and convergence warnings when trying to fit complex linear mixed-effects models with lmer. I have, in the past, shown that such models can be fit using the MixedModels ( https://github.com/dmbates/MixedModels.jl) package for Julia ( https://julialang.org) and that the data can be pulled from an R representation using either the RCall ( https://github.com/JuliaInterop/RCall.jl) or RData ( https://github.com/JuliaData/RData.jl).

Recently the JuliaCall package for R (https://github.com/Non-Contradiction/JuliaCall) has become available on CRAN. I have a short note at http://rpubs.com/dmbates/377897 on how to use that package to fit models using MixedModels from R.