13
$\begingroup$

How can one obtain standardized (fixed effect) regression weights from a multilevel regression?

And, as an "add-on": What is the easiest way to obtain these standardized weights from a mer-object (from the lmer function of the lme4package in R)?

$\endgroup$
3
  • $\begingroup$ Specifically mer or you are asking for any linear model coefficients? $\endgroup$ Feb 6, 2012 at 15:43
  • $\begingroup$ Actually I'm more interested on how to do it generally (I would standardize all variables beforehand, as in regular linear models, but I'm not sure if that approach is valid in MLMs). Above, I would like to see how it is done with lme4 objects. I rephrased the question accordingly! $\endgroup$
    – Felix S
    Feb 6, 2012 at 16:40
  • 1
    $\begingroup$ You may be interested in this paper by Andrew Gelman and Iain Pardoe (2007) Average Predictive Comparisons for Models with Nonlinearity, Interactions, and Variance Components. $\endgroup$
    – Andy W
    Feb 6, 2012 at 17:36

4 Answers 4

10
$\begingroup$

Simply scale your explanatory variables to having mean of zero and variance of one before you put them in the model. Then the coefficients will all be comparable. The mixed effects nature of the model doesn't impact on this issue.

The best way to do it, and least likely to go wrong, is to use scale() before you fit the model.

$\endgroup$
1
  • $\begingroup$ Thanks, that's what I wanted to know: rescaling to the grand mean (ignoring the group structure ...). $\endgroup$
    – Felix S
    Feb 7, 2012 at 8:19
3
$\begingroup$

For standard linear models regressed with lm() you can either scale() your predictors data or just use this simple formula:

lm.results = lm(mydata$Y ~ mydata$x1)

sd.y = sd(mydata$Y)
sd.x1 = sd(mydata$x1)
x1.Beta = coef(lm.results)["mydata$x1"] * (sd.x1 / sd.y)
$\endgroup$
3
$\begingroup$

For a quick way to get at the standardized beta coefficients directly from any lm (or glm) model in R, try using lm.beta(model) from the QuantPsyc package. For example:

library("MASS")
glmModel = glm(dependentResponseVar ~ predictor1 + predictor2, data=myData)
summary(glmModel)

library(QuantPsyc)
lm.beta(glmModel)
$\endgroup$
2
  • 1
    $\begingroup$ In this e-mail Ben Bolker translated this function to "lmer-land". $\endgroup$
    – crsh
    Nov 3, 2013 at 18:47
  • $\begingroup$ But the linked code that Ben provides isn't actually functional as written in that email, it doesn't look like. It includes words/pseudocode.... Edit: The answer to this question will provide the working code: stats.stackexchange.com/questions/123366/… $\endgroup$
    – Bajcz
    Jan 10, 2017 at 14:55
1
$\begingroup$

Assuming you have set the output of your lmer model to lmer.results, fixef(lmer.results) will return the overall fixed effects coefficients.

$\endgroup$
3
  • 2
    $\begingroup$ They won't be "standardized" though, will they? I read the question as wanting to know the size of fixed effects if the explanatory variables were all on the same scale. $\endgroup$ Feb 6, 2012 at 18:59
  • $\begingroup$ I don't know that it is possible to get the standardised coefficients from a mer object - they don't appear in the summary, so I assume the lme4 methods don't create them. fixef() will return all fixed effect information available from a mer object. $\endgroup$
    – Michelle
    Feb 6, 2012 at 19:46
  • 1
    $\begingroup$ As Peter already commented: the focus of the question was about the 'standardized' coefficients ... $\endgroup$
    – Felix S
    Feb 7, 2012 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.