# Interpretation of a quadratic term on a log transformed target variable

I've done some searching and found several posts related to this, e.g.: In linear regression, when is it appropriate to use the log of an independent variable instead of the actual values?

Suppose I have the following models:

library(tidyverse)

# create some models
simple_model <- lm(price ~ carat, data = diamonds)
log_model <- lm(log(price) ~ carat, data = diamonds)
quadratic_model <- lm(price ~ carat + caratSqd, data = diamonds %>% mutate(caratSqd = carat^2))
quadratic_log_model <- lm(log(price) ~ carat + caratSqd, data = diamonds %>% mutate(caratSqd = carat^2))

# compare them based on fit only (adjusted r.sqd)
eval_mods <- list(simple_model = simple_model,
log_model = log_model,
imap_dfr(broom::glance, .id = "model_name")
print(eval_mods)


Then the output:

# A tibble: 4 x 12
model_name          r.squared adj.r.squared    sigma statistic p.value    df   logLik     AIC     BIC      deviance df.residual
<chr>                   <dbl>         <dbl>    <dbl>     <dbl>   <dbl> <int>    <dbl>   <dbl>   <dbl>         <dbl>       <int>
1 simple_model            0.849         0.849 1549.      304051.       0     2 -472730. 945467. 945493. 129345695398.       53938
2 log_model               0.847         0.847    0.397   298092.       0     2  -26729.  53464.  53491.         8508.       53938
3 quadratic_model         0.851         0.851 1540.      153998.       0     3 -472434. 944877. 944912. 127934024108.       53937
4 quadratic_log_model     0.929         0.929    0.269   355429.       0     3   -5803.  11613.  11649.         3916.       53937


So, based on fit alone with Adjusted R squared (no RMSE or MAE), the log level model with a quadratic term is best.

According to Graham's answer on the linked post above, in those cases where you have a log transformation on only one side of an equation then:

Y and X -- a one unit increase in X would lead to a 𝛽 increase/decrease in Y

Log Y and Log X -- a 1% increase in X would lead to a 𝛽 % increase/decrease in Y

Log Y and X -- a one unit increase in X would lead to a 𝛽∗100% increase/decrease in Y

Y and Log X -- a 1% increase in X would lead to a 𝛽/100 increase/decrease in Y

The log_model summary is:

summary(log_model)

Call:
lm(formula = log(price) ~ carat, data = diamonds)

Residuals:
Min      1Q  Median      3Q     Max
-6.2844 -0.2449  0.0335  0.2578  1.5642

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.215021   0.003348    1856   <2e-16 ***
carat       1.969757   0.003608     546   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3972 on 53938 degrees of freedom
Multiple R-squared:  0.8468,    Adjusted R-squared:  0.8468
F-statistic: 2.981e+05 on 1 and 53938 DF,  p-value: < 2.2e-16


This model corresponds to:

Log Y and X -- a one unit increase in X would lead to a 𝛽∗100% increase/decrease in Y

My first question is, if this is the case then can I interpret coefficient 1.969757 as 'a increase in carat by 1 results in an estimated increase in price by 1.96%'? Or is that 196%? A doubling in price?

My second question is, in the case of quadratic_log_model, how can I interpret the coefficients?

Log Y and X + X^2 -- ???

How can I interpret these coefficients:

> summary(quadratic_log_model)

Call:
lm(formula = log(price) ~ carat + caratSqd, data = diamonds %>%
mutate(caratSqd = carat^2))

Residuals:
Min      1Q  Median      3Q     Max
-1.3724 -0.1724 -0.0023  0.1785  7.7200

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)  5.450685   0.003794  1436.5   <2e-16 ***
carat        3.916561   0.008119   482.4   <2e-16 ***
caratSqd    -0.916073   0.003643  -251.5   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.2695 on 53937 degrees of freedom
Multiple R-squared:  0.9295,    Adjusted R-squared:  0.9295
F-statistic: 3.554e+05 on 2 and 53937 DF,  p-value: < 2.2e-16