# Marginal Effect in a Gamma GLM with Quadratic Terms

I am building a gamma GLM regression model with a log link function. The model I fit is below:

$log(y)&space;=&space;6.04&space;+&space;0.00016(x)&space;-&space;0.0000000027(x)^{2}&space;+&space;0.00013(z)$

I understand that I can calculate the marginal effect of x on log(y) by taking the derivative with respect to x. How can I calculate the marginal effect of x on y?

$$\begin{split} \frac{dy}{dx} & = \frac{dy}{d\log y} \frac{d\log y}{dx} \\ & = \left(\frac{d\log y}{dy}\right)^{-1} \frac{d\log y}{dx} \\ & = y \cdot \frac{d\log y}{dx} \end{split}$$ In practice this means that the marginal effect of $$x$$ on $$y$$ *depends on the value of $$y$$, so you'd have to pick reference values of $$x$$ and $$z$$ (typically the mean values) to do the calculation.
Alternatively, you can frame the marginal effect on a log-response as a proportional change. If you compute the marginal effect of $$x$$ on $$\log y$$ and exponentiate it, you can frame it as a proportional effect (e.g. "a one-unit change in $$x$$ is associated with a ()-fold change in $$y$$")