[R-sig-eco] AIC in R: back-transforming standardized model parameters (slopes)

Drew Tyre atyre2 at unl.edu
Tue Jan 12 00:12:54 CET 2016


Hi Matt,

This isn't going to be a complete answer, but it might help. 

I wasn't 100% sure what standardize() was doing, or how it was doing it, so I did

getMethod("standardize","glm") 

to see the source code. That function calls standardize.default() which is a bit hard to get but 

getFromNamespace("standardize.default","arm")

pulls it out. From that code you can see that standardize() extracts the data from the model object, centers and scales it, and then refits the model to the centered and scaled data. So the formula you're looking for is

z.time = (time - mean(time))/2*sd(time)

similar to a standard Z transformation but using 2 times the sd in the denominator. 

> Therefore I wished to know (preferably) the calculation being made, and more
> importantly the function/code to back-transform my slope estimates to
> reportable 'real' slopes.

Hmmm, but the main reason to do the transformation in the first place is to make it easier to do comparisons between the effect sizes of different variables. If you want to report "real" slopes, just use the ones from your model1, which should be near identical to the backtransformed versions of the ones from model2. 

Another reason for centering and scaling is to improve numerical stability of your estimates, but if you were able to fit model1 and it didn't complain, not sure that you need to bother with the standardization. 

There are other reasons too, but I don't think any of them apply here. There's a great discussion of when to scale and why here:
http://stats.stackexchange.com/questions/29781/when-conducting-multiple-regression-when-should-you-center-your-predictor-varia

-- 
Drew Tyre

School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974

phone: +1 402 472 4054 
fax: +1 402 472 2946
email: atyre2 at unl.edu
http://snr.unl.edu/tyre
http://aminpractice.blogspot.com
http://www.flickr.com/photos/atiretoo

> -----Original Message-----
> From: R-sig-ecology [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of
> Matt Perkins
> Sent: Monday, January 11, 2016 1:40 AM
> To: r-sig-ecology at r-project.org
> Subject: [R-sig-eco] AIC in R: back-transforming standardized model parameters
> (slopes)
> 
> 
> Hi All,
> 
> 
> I have a simple Q that I'm having some difficulty finding an answer for. I'm
> conducting AIC analyses in R, and I would like to be able to report 'real' slope
> values from my model summary output (i.e. take the slopes and report them
> within simple y=mx+c linear equations in my paper). However, following Greuber
> etal 2011, I have standardised the explanatory variables in my model by
> centering them to a mean of zero and and an SD of 2, using the following code
> and the R package "arm". My model has a normal error distribution.
> 
> 
> stdz.model1<-standardize(model1, standardize.y=FALSE)
> 
> 
> 
> I do not yet know the sums behind this code in order to know how and what
> change has been made to my explanatory variables, in order that I could
> manually make back-transformations.
> 
> 
> Therefore I wished to know (preferably) the calculation being made, and more
> importantly the function/code to back-transform my slope estimates to
> reportable 'real' slopes.
> 
> 
> Addtionally, is it correct (or does it even matter) that I should be focusing my
> back-transformation on the slope estimate taken from the model summary, as
> opposed to instead using the model summary standardised slope estimate to
> calculate a y value in my linear equation (y=mx+c), and then back-transforming
> that y value?
> 
> 
> 
> ##
> 
> 
> If it is useful, my model and summary tables are below.
> 
> 
> I would like to test if treatment (kept in air or ice) affects nitrogen (N) within
> shrimps over time. I have repeated measures per shrimp (unique.id) that I use as
> a random factor to account for non-independence within an individual.
> 
> 
> My model is a linear mixed model of the form:
> 
> 
> model1<-lmer( N ~ time* air.ice + (1|unique.id), data=shrimp, REML=FALSE)
> 
> 
> 
> The two model summary tables below show the 1) un-standardised model with
> ready-to-use slope value ("time" = 0.008156)
> 
> and 2) standardised model with much-larger slope value ("z.time" = 0.50782)
> 
> 
> 1)
> 
> Fixed effects:
>                                                   Estimate       Std. Error    t value
> (Intercept)                              12.522535   0.197024      63.56
> time                                           0.008156    0.001134       7.19
> air.ice                                       -0.801936   0.278634      -2.88
> time:air.ice                              -0.004442   0.001604     -2.77
> 
> 
> 2)
> 
>                                                    Estimate      Std. Error    t value
> (Intercept)                                12.48242      0.13051      95.65
> z.time                                          0.50782       0.06861       7.40
> c.air.ice                                      -1.07202       0.26102      -4.11
> z.time:c.air.ice                          -0.38008       0.13722     -2.77
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



More information about the R-sig-ecology mailing list