back.emmeans | R Documentation |
Back-transforms EMMeans (produced by emmeans
) when the model was built on a transformed response variable. This is typically the case when a LM(M) with log(x+1) as response variable gives a better fitting than a GLM(M) for count data, or when a beta regression takes as response a variable on the [0;1] interval that has been rescaled to the (0;1) interval using p.beta
.
back.emmeans(emm, transform = c("log", "logit", "sqrt", "4rt", "inverse", "p.beta"),
base = exp(1), add = 0, n = NULL, C = 2, ord = FALSE, decreasing = TRUE)
emm |
object returned by |
transform |
transformation applied to the response variable before building the model on which |
base |
the base with respect to which the logarithm transformation was computed (if |
add |
value to be added to x before computing the transformation, if needed (e.g. |
n |
total number of observations in the initial data set. Only used with |
C |
number of categories from which initial continuous proportions were computed. Only used with |
ord |
logical indicating if back-transformed EMMeans should be ordered. |
decreasing |
logical indicating in which order back-transformed EMMeans should be ordered, if |
Maxime HERVE <maxime.herve@univ-rennes1.fr>
emmeans
require(emmeans)
set.seed(1149)
tab <- data.frame(
response <- c(rpois(30,0),rpois(30,2),rpois(30,4)),
fact <- gl(3,30,labels=LETTERS[1:3])
)
model <- lm(log(response+1)~fact,data=tab)
EMM <- emmeans(model,~fact)
back.emmeans(EMM,transform="log",add=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.