# OLS effect of X squared ond dependent variable

I have my OLS regression: $$y = \beta_1 + \beta_2 X_2 + \beta_3 X_3 +\beta_4 (X_3)^2$$

Could anybody please explain to me the effect of a change in $$X_3$$ on the dependent variable?(Is the effect positive or negative). An example would be greatly appreciated.

As @Tomas already explained greatly in his answer you have to drive to $$X_3$$.

$$\frac{\partial y}{\partial X_3}= \beta_3 + 2 \times \beta_4 \times X_3$$.

As you want to now whether the derivative is positive you face the inquality:

$$0>\beta_3 + 2 \times \beta_4 \times X_3$$.

Depending on $$X_3$$ you can change the equation to

$$\frac{-\beta_3}{2 * \beta_4} > X_3$$

Let us look at an example in which you have real numbers for the Betas:

When you have the equation:

$$\beta_1 = 5$$

$$\beta_2 = 3$$

$$\beta_3 = 4$$

$$\beta_4 = 2$$

$$y = 5 + 3X_2 + 4X_3 + 2(X_3)^2$$

and $$X_3$$ will have a positive effect when:

$$\frac{-4}{2 \cdot 2} > X_3$$

which is simplified:

$$1 > X_3$$

library(ggplot2)
my_df <- data.frame()
ggplot(df) + xlim(-10,10) + ylim(-10,10) + geom_abline(intercept=-4, slope=4) + geom_vline(xintercept=1, colour = "red")+ xlab("X_3") + ylab("derivative of X_3")


Everything left of the red line has a positive effect on the dependent variable

Note that the "change in the conditional mean of outcome y when regressors change by one unit" is also called marginal effect. You might look at the tag description and question tagged with this tag to get a broader understanding. In your case you want to know whether the marginal effect of $$X_3$$ is positive (or negative).

This question: Regression with Quadratic Term - Understanding Marginal Effect is closely related to your question as it also talks about the marginal effect with a quadratic term.

You just take the first derivative of the function with respect to $$X_3$$: $$\frac{\partial y}{\partial X_3}= \beta_3 + 2 \times \beta_4 \times X_3$$ You may see that the effect of changing $$X_3$$ on $$y$$ is not constant, but depends on the observed value of $$X_3$$ (for some, say, $$i$$-th observation). Also, ceteris paribus (other things fixed) interpretation holds only with respect to fixed $$X_2$$, but you cannot change $$(X_3)^2$$ while holding $$X_3$$ fixed.

The effect that a change in $$X_3$$ will have on the outcome depend on the coefficients of $$\beta_3$$ and $$\beta_4$$. If both $$\beta_3$$ and $$\beta_4$$ are positive, then any increase in $$X_3$$ will cause $$Y$$ to increase. If both $$\beta_3$$ and $$\beta_4$$ are negative, then the an increse in $$X_3$$ leads to a decrease in $$Y$$. (Granted, all this is given that $$X_3$$ is increased without changing the values of $$X_2$$.)

If the signs of $$\beta_3$$ and $$\beta_4$$ differ, then the net effect of an increase of $$X_3$$ on $$Y$$ will depend on the relative magnitude of $$\beta_3$$ and $$\beta_4$$, as well as the increase in $$X_3$$.