-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Mixed effects models relate an observed response, such as an intensity measure (IM) (or its residual), to covariates, such as earthquake and site name. Interestingly, the covariates of mixed effects models can be categorical, meaning that they are labels rather than numerical values. In our case, we use the event and (optionally) site names as the labels for the categorical variables.
Mixed effects models are so named because they include both fixed effects and random effects. Fixed effects capture the
overall trend of the observed response, and would be parameters such as the
intercept,
Fig. 1: Example mixed effects regression where the slope remains constant and the intercept is allowed to vary.
The black line represents the result of fitting the intercept as a fixed effect. The other lines represent the
result of adding a random effect for each group. Figure adopted from pythonfordatascience.org at this
link.
Formally, there are subtle differences between fixed and random effects. For example, fixed effects are referred to as model parameters and can be directly estimated from the fit, along with corresponding standard errors. Conversely, random effects are formally referred to as variance components, and cannot formally have best fit values or standard errors. However, in practice, we can treat a random effect’s Best Linear Unbiased Predictor (BLUP), which is also known as its conditional mode, as something like a best fit value. Similarly, a random effect's conditional standard deviation can be regarded as something like a standard error. The word conditional is used to emphasize that these values are conditional on the fitted values of the fixed effects and conditional modes of the other random effects. For more information about the terminology and mathematics of random effects, please refer to Chapter 1 of Bates 2018. The MERA package provides a BLUP or conditional mode and a conditional standard deviation for each event and (optionally) site that are considered as random effects.
The Mixed Effects Regression Analysis (MERA) package is Python code that utilizes the robust lme4 library in the R programming language. It achieves this with the Pymer4 package which uses the rpy2 library to establish an interface between Python and R.
R is an open source programming language that is often used for statistical analyses.
The primary developer of R’s lme4 package is a statistician called Douglas Bates who took great care to ensure that
the lme4 package is extremely statistically robust. As a consequence, lme4 explicitly provides standard errors for
fixed effects parameters like the “intercept” or overall bias, but does not provide standard errors for random effects.
Other statistics software may claim to provide standard errors for random effects, but these numbers are likely
unreliable (please see Chapter 1 of Bates 2018
for more information).