[R-sig-ME] Plotting effects in original units

Fox, John jfox at mcmaster.ca
Fri Feb 12 14:36:53 CET 2016

Dear Mariano,

The objects returned by the Effect() function, which is called repeatedly by allEffects(), contains all the information you need to create a custom plot. The fitted values for each effect on the scale of the linear predictor (i.e., not transformed to the scale of the response) -- that is, e.g., on the logit scale rather than the probability scale for a logit model --  are in the 'fit' component of the object. As I understand it, this is what you want to plot. The object also contains the combinations of values of the predictors at which the fit was evaluated in the 'x' component. Similarly, the confidence limits are in 'lower' and 'upper', also on the scale of the linear predictor. See ?Effect for more information about the returned object.

As to plotting on the original scales of the predictors rather than the standardized scales, you should be able easily to back-transform each predictor. But why bother? Why not just fit the model with the unstandardized predictors?

Finally, although the print() method for effect objects by default transforms effects to the scale of the response, and the plot() method plots on the scale of the linear predictor but labels the response axis on the scale of the response, you can modify this default behaviour. See ?print.eff and ?plot.eff (and in particular the type argument).

I hope this helps,

John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
web: socserv.mcmaster.ca/jfox

From: R-sig-mixed-models [r-sig-mixed-models-bounces at r-project.org] on behalf of Mariano Devoto [mdevoto at agro.uba.ar]
Sent: February 12, 2016 6:59 AM
To: r-sig-mixed-models at r-project.org
Subject: [R-sig-ME] Plotting effects in original units

Hi everyone. I am using 'glmer' function in lme4 package to run a glmm with
rescaled explanatory variables (i.e. I used 'scale' function to centre and
standardise each variable). I am now trying to use the output of the
'allEffects' function in the 'effects' package to calculate and plot the
effects. For each explanatory variable I want to extract the fitted values
(and the confidence interval) and plot them but labeling the axes in the
original units. I don't want to use the default plot function because I am
trying to make custom-made figures. Is there a way around having to use the
inverse of the link function and then backtransforming using the inverse of
the scaling to get the values I am looking for? I'd appreciate any tips.



Dr. Mariano Devoto
Investigador Adjunto del CONICET
Cátedra de Botánica General
Facultad de Agronomía de la U.B.A.
Av. San Martin 4453
C.A. de Buenos Aires


        [[alternative HTML version deleted]]

R-sig-mixed-models at r-project.org mailing list

More information about the R-sig-mixed-models mailing list