How to convert the y-axis of a plot from log(y) to y

175 Views Asked by At

I'm an R newbie. I want to estimate a regression of log(CONSUMPTION) on INCOME and then make a plot of CONSUMPTION and INCOME.

I can run the following regression and plot the results.

results <- lm(I(log(CONSUMPTION)) ~ INCOME, data=dataset)
effect_plot(results, pred=INCOME)

If I do this, I get log(CONSUMPTION) on the vertical axis rather than CONSUMPTION.

How can I get a plot with CONSUMPTION on the vertical axis?

Another way to ask the question is how do I convert the y-axis of a plot from log(y) to y? While my question is for the function effect_plot(), I would be happy with any plot function.

Thanks for any help you can give me.

1

There are 1 best solutions below

0
On

Thank you for the responses. I was able to figure out a workaround using Poisson regression:

results1 <- glm(CONSUMPTION ~ INCOME+WEALTH, family=poisson, data=Consumption )
effect_plot(results1,pred=INCOME,data=Consumption)

This allows me to identify the effect of one variable (INCOME) even when the regression has more than one explanatory variable (INCOME+WEALTH), and plots the estimated effect with CONSUMPTION on the vertical axis rather than ln(CONSUMPTION), with INCOME on the horizontal axis.

The associated estimates are virtually identical to what I would get from the log-linear regression:

results2 <- lm(I(log(CONSUMPTION)) ~ INCOME+WEALTH, data=Consumption )

I appreciate you for taking the time to help me with my problem.