Skip to main content
22 votes
Accepted

Predicting y from log y as the dependent variable

The underlying model is $$E[\log Y] = \beta_0 + \beta_1 x_1 + \cdots + \beta_k x_k$$ or, in terms of error terms $\varepsilon_i,$ $$\log Y_i = \beta_0 + \beta_1 x_{1i} + \cdots + \beta_k x_{ki} + \...
whuber's user avatar
  • 330k
10 votes
Accepted

Log model too good to be true, maybe I'm interpreting results incorrectly?

You need to transform your prediction back to the original space before calculating residuals rather than transforming the residuals from the log space. $ \newcommand{\Exp}{\operatorname{Exp}} \...
Richard Redding's user avatar
10 votes
Accepted

Transforming regression coefficients back to original values from square-root -transformed data

The coefficients and their associated results apply on the scale on which they are estimated. The only transformation that makes sense is to transform predictions of the response back to the original ...
Nick Cox's user avatar
  • 58.6k
9 votes

Regression RMSE when dependent variable is log transformed

Once you take logs, your response is not in seconds. In effect it's unit free. When you calculate mean absolute error on the log scale, it, too, is not a measurement in seconds. It's (roughly-...
Glen_b's user avatar
  • 287k
7 votes
Accepted

How to back-transform a log transformed regression model in R with bias correction

You didn't give any details about why you think the outputs are wildly unlikely, but my guess is that your errors are not normally distributed. That "smearing adjustment" (bias correction) you're ...
The Laconic's user avatar
  • 1,604
7 votes

When is performing back-transformation of inferences on transformed variables Ok, and when is it not Ok?

You actually lay out most of the important points in your question. I assume we're restricting attention to strictly monotonic transformations. Monotonic transformations preserve order so quantiles ...
Glen_b's user avatar
  • 287k
7 votes
Accepted

Back Transforming log-log Model for Prediction

Duan's approach applies to logged outcome models, as does the normal approximation described here. It does not matter whether the covariates are logged, except insofar as you will need to calculate $\...
dimitriy's user avatar
  • 37.8k
5 votes

Reporting glmer.nb Results

A couple of comments: The estimated variance of the random effect is extremely low. This could indicate that you do not need to include the random effect (i.e., there are correlations in the ...
Dimitris Rizopoulos's user avatar
5 votes
Accepted

Backtransforming log(x+1) transformed SE

In general, if you use a smooth nonlinear transformation $f(x)$ to transform a random variable $x$, its standard deviation will be approximately scaled (multiplied) by a factor $\phi=\left. \frac{\...
Ben Bolker's user avatar
  • 45.1k
4 votes

Basic math: x-y versus sqrt(x)-sqrt(y)

There's no general way to calculate $x-y$ from $\sqrt{x}-\sqrt{y}$ alone. Two different $(x,y)$ pairs with the same $\sqrt{x}-\sqrt{y}$ can have different $x-y$ values. For example, consider $x_1=9, ...
Glen_b's user avatar
  • 287k
4 votes

Re-transformation problem with different base in log

If you used base $m$ logs instead of base $e$, you just do $m^{\text{whatever}}$ instead of $e^{\text{whatever}}$ for whichever equivalent of the terms or sum of terms you would have exponentiated ...
Glen_b's user avatar
  • 287k
4 votes
Accepted

Interpretation of linear regression results where dependent variable is transformed using ln(y+1)

You have fit a formula of the form $$\log(y+1) = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \ldots$$ where $y$ is the dependent variable (duration), $x_i$ are the covariates (indicators for sex, ...
Paul's user avatar
  • 11k
4 votes
Accepted

Back transformed Median of log normal data, not equal to median of original data

In principle, median(log()) yields the same as log(median()). As @Henry rightly comments, there is no issue here with any sample with an odd number of values, as the median is then the middlemost ...
Nick Cox's user avatar
  • 58.6k
4 votes

What is the inverse normal transformation (INT) and what are the reasons behind using it?

Basically you start with the assumption that your variable is normally distributed, and actively ignore any empirical information that that might not be the case. Actively ignoring empirical ...
Maarten Buis's user avatar
  • 21.3k
3 votes
Accepted

Linear mixed effect model interpretation with log transformed dependent variable

Even if the model is quite complicated, interpretation of the effect of A on the response variable is straightforward, as is any other linear model: according to your output, all other things being ...
Nworno's user avatar
  • 46
3 votes

Linear mixed effect model interpretation with log transformed dependent variable

The standard error can't be used after you transform, because exp(x)+exp(y)~=exp(x+y). I find it easier to think in terms of confidence intervals instead: you can ...
Bryan Krause's user avatar
  • 1,506
3 votes
Accepted

back transformation of log means and log standard deviations

I will share some educated guesses, as a long-time consumer and interpreter of this kind of hydrogeologic information. "Log mean" surely is the "geometric mean." The relationships among the columns ...
whuber's user avatar
  • 330k
3 votes

How to back-transform negative Beta coefficients of linear regression after log transformation?

You don't just exponentiate the parameter when you back-transform (even when it's positive). You still have a decreasing relationship after exponentiation. e.g. if you fit a model like $\log(Y) = \...
Glen_b's user avatar
  • 287k
3 votes
Accepted

How to back transform a folded root?

Okay, so with help from @whuber and @Nick Cox (thank you!), I think I can now answer this for a folded root with $\lambda=(1/2)$. a. @Nick Cox gives the formula $f(p) = p^\lambda - (1 - p)^\lambda$ ...
Izy's user avatar
  • 639
3 votes
Accepted

Standard errors in R, package emmeans

I'm not sure, but I do note that the emmeans SEs are proportional to sqrt(prob*(1-prob)) within each group: ...
Russ Lenth's user avatar
  • 20.9k
3 votes

A question about the trimfill function in the "meta" package in R

The issue here is that it is difficult to work out the back transformation for the summary although relatively easy for the individual studies. Sometimes also referred to as the double arcsin(e) ...
mdewey's user avatar
  • 18.2k
3 votes
Accepted

Bayesian lognormal model: how to correctly back-transform the estimates?

The effect size of a log-normal model has not a univoque value on the same scale of y, because of the log-relation between $\mu$ and the position of the log-normal distribution (its median, its mean). ...
carlo's user avatar
  • 4,545
3 votes

Why use the bootstrap for a skewed distribution when you can use a transform?

If you are interested in the mean and confidence interval for the observed data, probably the most sensible approach is to use the mean and bootstrapped confidence intervals. For the kind of data set ...
Sal Mangiafico's user avatar
2 votes
Accepted

Evaluation of log Vs. non log models

Yes, what you describe is a logical approach. Aside (back-)transforming the response variable I would suggest considering a model that does not rely heavily on assumptions regarding the model's error-...
usεr11852's user avatar
  • 45.2k
2 votes

Basic math: x-y versus sqrt(x)-sqrt(y)

Let $y = f(x)$. To uniquely determine $x$ given $y$, the function $f$ must be injective. A function $f$ is called injective if for any value $y$, there is at most one value $x$ such that $f(x) = y$. ...
Matthew Gunn's user avatar
  • 22.8k
2 votes
Accepted

How to convert estimated precision to variance?

Following the suggestion of @BenBolker, I've asked this on the R-INLA mailing list, where I received an extremely rapid and detailed response from Håvard Rue. Briefly, log precision should be ...
2 votes

Back transform mixed-effects model's regression coefficients for fixed-effects from log to original scale

The reason those numbers don't make sense is because the whole linear part is exponential, since you log transformed the response. To get the right values on the original scale, first add the ...
Frans Rodenburg's user avatar
2 votes

How to back transform a folded root?

Adding to the other excellent answer, here I just show a solution for general $\lambda$. That must be a numerical solution. First, I define the folded power as $$ f(p) = \frac{p^\lambda - (1-p)^\...
kjetil b halvorsen's user avatar
2 votes

XGboost Regression Log Transform Target

The results of the model trained based on the transformed target to the log space are misleading. Briefly, the log transformation shrinks the variance of the outcomes. Hence, the log transformation ...
Naik's user avatar
  • 129
2 votes

Reversing Log-transformed target after training : r2 score interpretation

You should be calculating r2_score on the test data that is transformed in the same manner as the train data. In your case, the data that is transformed with log transformation, as the weights that ...
to_code_or_not_to_code's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible