0
$\begingroup$

I run an lmer model using standardized data like scale(y) ~ 1 + (1|categorical) Now, I have a standard deviation for the random effect in normalized world but I would like to transform it back to original scale. By trying z_sd * sd(y) + mean(y) I am getting something that looks more like the var and not the sd.

Am I missing something obvious?

Take as example this one, and the model course ~ 1 + (1 | school) The Std.Dev. of School intercept is 8.674, now the scale(course) ~ 1 + (1 | school) will return a Std.Dev. for School intercept 0.5315.

However, I can't scale back the Std.Dev using the school_sd * sd(course) + mean(course)

$\endgroup$
4
  • $\begingroup$ Your question is unclear, what do you mean by "I am getting something that looks more like the var and not the sd."? $\endgroup$ – Firebug Aug 18 '20 at 13:07
  • $\begingroup$ @Firebug, sorry for the confusion, I want to scale back the estimated from the model standard deviation. However, by multiplying the estimated_sd with the original_sd and by adding the original_mean I get something too high that looks like the variance and not the standard deviation. $\endgroup$ – Lefty Aug 18 '20 at 13:18
  • $\begingroup$ "Now, I have a standard deviation in normalized world but I would like to transform it back to original scale" There is information missing here. What exactly do you have a standard deviation of? Do you actually mean the standard error of a regression coefficient? Or perhaps the standard deviation of the model residuals? Maybe the standard error of a prediction? Your proposed equation z_sd * sd(y) + mean(y) demonstrates a lack of understanding what a standard deviation is and how it is calculated. $\endgroup$ – Roland Aug 18 '20 at 13:28
  • 1
    $\begingroup$ Is there some reason why you used standardization in the first place? Statistical analysis can be hard enough without getting caught up in this type of numerical confusion. Standardization is seldom needed for regression models. When it is important, for example in penalized regressions like ridge and lasso, the standardization and later back-correction is usually a default of the process. Don't make life harder for yourself that is necessary. $\endgroup$ – EdM Aug 18 '20 at 16:26
0
$\begingroup$

It seems that in the case of this example the Std Dev can be standardized back by multiplying it with the sd of the original scale.

So, for example

M3 <- lmer(formula = course ~ 1 + female + (1 + female | school), 
           data = GCSE, # the GCSE data are coming from example on the link
           REML = FALSE)
print(M3, digits = 10)

M31 <- lmer(formula = scale(course) ~ 1 + female + (1 + female | school), 
           data = GCSE, 
           REML = FALSE)
print(M31, digits = 10)

the SD for the original scale is

GCSE$course %>% sd(na.rm = T) %>% print(digits = 10)

and by multiplying it with any SD from M31 I get the same SD from M3.

And here a video talking about it (it's the last example).

$\endgroup$

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.